Fix back navigation in settings screens 77/30677/1 19.90.0 trout/19.90.0 trout_19.90.0
authorAnuj Solanki <anuj603362@gmail.com>
Mon, 16 Dec 2024 09:58:14 +0000 (15:28 +0530)
committerAnuj Solanki <anuj603362@gmail.com>
Mon, 16 Dec 2024 09:58:14 +0000 (15:28 +0530)
Fix navigation issue caused by direct transitioning to settings page
without correctly updating previous and current state in AppStateNotifier

Bug-AGL: SPEC-5322
Change-Id: Ic5b604efd21aa648a1013047ada1e97845c62b4b
Signed-off-by: Anuj Solanki <anuj603362@gmail.com>
lib/presentation/screens/settings/settings_screens/bluetooth/widgets/bluetooth_content.dart
lib/presentation/screens/settings/settings_screens/date_time/date_time_screen.dart
lib/presentation/screens/settings/settings_screens/profiles/widgets/profiles_content.dart
lib/presentation/screens/settings/settings_screens/units/units_screen.dart
lib/presentation/screens/settings/settings_screens/version_info/version_info_screend.dart
lib/presentation/screens/settings/settings_screens/wifi/widgets/wifi_content.dart
lib/presentation/screens/settings/settings_screens/wired/wired_screen.dart

index 3fbb75f..1a6de4e 100644 (file)
@@ -75,7 +75,7 @@ class BluetoothContentState extends ConsumerState<BluetoothContent> {
           title: "Bluetooth",
           hasBackButton: true,
           onPressed: () {
-            context.flow<AppState>().update((state) => AppState.settings);
+            ref.read(appProvider.notifier).back();
           },
         ),
         Expanded(
index acc1541..8ab55c1 100644 (file)
@@ -19,7 +19,7 @@ class DateTimePage extends ConsumerWidget {
             title: 'Date & Time',
             hasBackButton: true,
             onPressed: () {
-              context.flow<AppState>().update((state) => AppState.settings);
+              ref.read(appProvider.notifier).back();
             },
           ),
           Expanded(
index 48e1565..3fc895b 100644 (file)
@@ -35,7 +35,7 @@ class ProfilesContentState extends ConsumerState<ProfilesContent> {
           title: "Profiles",
           hasBackButton: true,
           onPressed: () {
-            context.flow<AppState>().update((state) => AppState.settings);
+            ref.read(appProvider.notifier).back();
           },
         ),
         Expanded(
index ba84471..181eeb9 100644 (file)
@@ -18,7 +18,7 @@ class UnitsPage extends ConsumerWidget {
             title: 'Units',
             hasBackButton: true,
             onPressed: () {
-              context.flow<AppState>().update((state) => AppState.settings);
+              ref.read(appProvider.notifier).back();
             },
           ),
           Expanded(
index c5e571d..3b973a4 100644 (file)
@@ -41,7 +41,7 @@ class VersionInfoPage extends ConsumerWidget {
             title: 'Version Information',
             hasBackButton: true,
             onPressed: () {
-              context.flow<AppState>().update((state) => AppState.settings);
+              ref.read(appProvider.notifier).back();
             },
           ),
           Padding(
index 2473847..1fbeeb5 100644 (file)
@@ -72,7 +72,7 @@ class WifiContentState extends ConsumerState<WifiContent> {
           title: "Wifi",
           hasBackButton: true,
           onPressed: () {
-            context.flow<AppState>().update((state) => AppState.settings);
+            ref.read(appProvider.notifier).back();
           },
         ),
         Expanded(
index 1d2e679..8aeab70 100644 (file)
@@ -9,12 +9,13 @@ class WiredPage extends ConsumerWidget {
   static Page<void> page() => const MaterialPage<void>(child: WiredPage());
   @override
   Widget build(BuildContext context, WidgetRef ref) {
-    return const Scaffold(body: WiredScreen());
+    return Scaffold(body: WiredScreen(ref: ref));
   }
 }
 
 class WiredScreen extends StatefulWidget {
-  const WiredScreen({super.key});
+  WidgetRef ref;
+  WiredScreen({super.key, required this.ref});
 
   @override
   State<WiredScreen> createState() => _WiredScreenState();
@@ -81,7 +82,7 @@ class _WiredScreenState extends State<WiredScreen> {
           title: 'Wired',
           hasBackButton: true,
           onPressed: () {
-            context.flow<AppState>().update((state) => AppState.settings);
+              widget.ref.read(appProvider.notifier).back();
           },
         ),
         Expanded(child: ListView.separated(