Skip to content

Commit

Permalink
Feature: Implemented SliverAppBar on HomePage (#62)
Browse files Browse the repository at this point in the history
* adding the sliver app bar to home page

* solving the merge conflict

* solving the merge conflict 2
  • Loading branch information
superiorsd10 authored Sep 7, 2023
1 parent 02fc37a commit 9e78ce1
Show file tree
Hide file tree
Showing 2 changed files with 282 additions and 234 deletions.
13 changes: 13 additions & 0 deletions lib/app/modules/home/controllers/home_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class HomeController extends GetxController with AlarmHandlerSetupModel {

final alarmIdController = TextEditingController();

ScrollController scrollController = ScrollController();
RxDouble scalingFactor = 1.0.obs;

loginWithGoogle() async {
// Logging in again to ensure right details if User has linked account
if (await SecureStorageProvider().retrieveUserModel() != null) {
Expand Down Expand Up @@ -167,6 +170,16 @@ class HomeController extends GetxController with AlarmHandlerSetupModel {
void onInit() async {
super.onInit();
if (!isUserSignedIn.value) await loginWithGoogle();

scrollController.addListener(() {
final offset = scrollController.offset;
const maxOffset = 100.0;
const minFactor = 0.8;
const maxFactor = 1.0;

final newFactor = 1.0 - (offset / maxOffset).clamp(0.0, 1.0);
scalingFactor.value = (minFactor + (maxFactor - minFactor) * newFactor);
});
}

refreshUpcomingAlarms() async {
Expand Down
Loading

0 comments on commit 9e78ce1

Please sign in to comment.