From a38a9835611a6deed1f75fcc8c2bf684206a2d51 Mon Sep 17 00:00:00 2001 From: sindhu Date: Fri, 26 Jan 2024 23:37:16 +0700 Subject: [PATCH] step 15 : fix route navigator, not fixed --- lib/screen/home/home_screen.dart | 15 ++++++++------- lib/widget/custom_drawer.dart | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/screen/home/home_screen.dart b/lib/screen/home/home_screen.dart index 19d472d..486de5d 100644 --- a/lib/screen/home/home_screen.dart +++ b/lib/screen/home/home_screen.dart @@ -153,13 +153,14 @@ class HomeScreen extends HookConsumerWidget { } else if (next is CheckDistanceStateDone) { isLoadingProsesCheckDistance.value = false; - if (varCurrentDistanceProvider?.selfie == "TRUE") { - ref.read(currentPageProvider.notifier).update((state) => -1); - Navigator.of(context).pushNamed(presensiSelfieRoute); + if (next.model.selfie == "TRUE") { + ref.read(currentPageProvider.notifier).update((state) => 99); + // Navigator.of(context).pop(); + Navigator.of(context).restorablePushNamed(presensiSelfieRoute); } else { - if (varCurrentDistanceProvider?.selfie == "FALSE") { - ref.read(currentPageProvider.notifier).update((state) => -1); - Navigator.of(context).pushNamed(presensiRoute); + if (next.model.selfie == "FALSE") { + ref.read(currentPageProvider.notifier).update((state) => 99); + Navigator.of(context).restorablePushNamed(presensiRoute); } } } @@ -197,7 +198,7 @@ class HomeScreen extends HookConsumerWidget { ) : FloatingActionButton( onPressed: () async { - requestLocationPermission(); + await requestLocationPermission(); }, backgroundColor: Color(0xFFFFFFFF), shape: CircleBorder(), diff --git a/lib/widget/custom_drawer.dart b/lib/widget/custom_drawer.dart index 69eb791..d8a69e7 100644 --- a/lib/widget/custom_drawer.dart +++ b/lib/widget/custom_drawer.dart @@ -134,7 +134,7 @@ class CustomDrawer extends HookConsumerWidget { // Handle navigation to Home screen Navigator.pop(context); ref.read(currentPageProvider.state).update((state) => 0); - Navigator.pushNamed(context, homeRoute); + Navigator.of(context).popAndPushNamed(homeRoute); }, ), @@ -170,7 +170,7 @@ class CustomDrawer extends HookConsumerWidget { alignment: Alignment.bottomRight, child: Text( 'Versi ${Constant.version}', - style: Constant.titleH1_700(context: context) + style: Constant.logintitle_700(context: context) .copyWith(color: Constant.textLightGrey), ), ),