From bf49975244508fd25e8111b9aa4cf010ffa41ce4 Mon Sep 17 00:00:00 2001 From: Anuj Solanki Date: Mon, 16 Dec 2024 15:28:14 +0530 Subject: Fix back navigation in settings screens 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 --- .../settings_screens/bluetooth/widgets/bluetooth_content.dart | 2 +- .../settings/settings_screens/date_time/date_time_screen.dart | 2 +- .../settings_screens/profiles/widgets/profiles_content.dart | 2 +- .../screens/settings/settings_screens/units/units_screen.dart | 2 +- .../settings_screens/version_info/version_info_screend.dart | 2 +- .../settings/settings_screens/wifi/widgets/wifi_content.dart | 2 +- .../screens/settings/settings_screens/wired/wired_screen.dart | 7 ++++--- 7 files changed, 10 insertions(+), 9 deletions(-) (limited to 'lib/presentation/screens/settings') diff --git a/lib/presentation/screens/settings/settings_screens/bluetooth/widgets/bluetooth_content.dart b/lib/presentation/screens/settings/settings_screens/bluetooth/widgets/bluetooth_content.dart index 3fbb75f..1a6de4e 100644 --- a/lib/presentation/screens/settings/settings_screens/bluetooth/widgets/bluetooth_content.dart +++ b/lib/presentation/screens/settings/settings_screens/bluetooth/widgets/bluetooth_content.dart @@ -75,7 +75,7 @@ class BluetoothContentState extends ConsumerState { title: "Bluetooth", hasBackButton: true, onPressed: () { - context.flow().update((state) => AppState.settings); + ref.read(appProvider.notifier).back(); }, ), Expanded( diff --git a/lib/presentation/screens/settings/settings_screens/date_time/date_time_screen.dart b/lib/presentation/screens/settings/settings_screens/date_time/date_time_screen.dart index acc1541..8ab55c1 100644 --- a/lib/presentation/screens/settings/settings_screens/date_time/date_time_screen.dart +++ b/lib/presentation/screens/settings/settings_screens/date_time/date_time_screen.dart @@ -19,7 +19,7 @@ class DateTimePage extends ConsumerWidget { title: 'Date & Time', hasBackButton: true, onPressed: () { - context.flow().update((state) => AppState.settings); + ref.read(appProvider.notifier).back(); }, ), Expanded( diff --git a/lib/presentation/screens/settings/settings_screens/profiles/widgets/profiles_content.dart b/lib/presentation/screens/settings/settings_screens/profiles/widgets/profiles_content.dart index 48e1565..3fc895b 100644 --- a/lib/presentation/screens/settings/settings_screens/profiles/widgets/profiles_content.dart +++ b/lib/presentation/screens/settings/settings_screens/profiles/widgets/profiles_content.dart @@ -35,7 +35,7 @@ class ProfilesContentState extends ConsumerState { title: "Profiles", hasBackButton: true, onPressed: () { - context.flow().update((state) => AppState.settings); + ref.read(appProvider.notifier).back(); }, ), Expanded( diff --git a/lib/presentation/screens/settings/settings_screens/units/units_screen.dart b/lib/presentation/screens/settings/settings_screens/units/units_screen.dart index ba84471..181eeb9 100644 --- a/lib/presentation/screens/settings/settings_screens/units/units_screen.dart +++ b/lib/presentation/screens/settings/settings_screens/units/units_screen.dart @@ -18,7 +18,7 @@ class UnitsPage extends ConsumerWidget { title: 'Units', hasBackButton: true, onPressed: () { - context.flow().update((state) => AppState.settings); + ref.read(appProvider.notifier).back(); }, ), Expanded( diff --git a/lib/presentation/screens/settings/settings_screens/version_info/version_info_screend.dart b/lib/presentation/screens/settings/settings_screens/version_info/version_info_screend.dart index c5e571d..3b973a4 100644 --- a/lib/presentation/screens/settings/settings_screens/version_info/version_info_screend.dart +++ b/lib/presentation/screens/settings/settings_screens/version_info/version_info_screend.dart @@ -41,7 +41,7 @@ class VersionInfoPage extends ConsumerWidget { title: 'Version Information', hasBackButton: true, onPressed: () { - context.flow().update((state) => AppState.settings); + ref.read(appProvider.notifier).back(); }, ), Padding( diff --git a/lib/presentation/screens/settings/settings_screens/wifi/widgets/wifi_content.dart b/lib/presentation/screens/settings/settings_screens/wifi/widgets/wifi_content.dart index 2473847..1fbeeb5 100644 --- a/lib/presentation/screens/settings/settings_screens/wifi/widgets/wifi_content.dart +++ b/lib/presentation/screens/settings/settings_screens/wifi/widgets/wifi_content.dart @@ -72,7 +72,7 @@ class WifiContentState extends ConsumerState { title: "Wifi", hasBackButton: true, onPressed: () { - context.flow().update((state) => AppState.settings); + ref.read(appProvider.notifier).back(); }, ), Expanded( diff --git a/lib/presentation/screens/settings/settings_screens/wired/wired_screen.dart b/lib/presentation/screens/settings/settings_screens/wired/wired_screen.dart index 1d2e679..8aeab70 100644 --- a/lib/presentation/screens/settings/settings_screens/wired/wired_screen.dart +++ b/lib/presentation/screens/settings/settings_screens/wired/wired_screen.dart @@ -9,12 +9,13 @@ class WiredPage extends ConsumerWidget { static Page page() => const MaterialPage(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 createState() => _WiredScreenState(); @@ -81,7 +82,7 @@ class _WiredScreenState extends State { title: 'Wired', hasBackButton: true, onPressed: () { - context.flow().update((state) => AppState.settings); + widget.ref.read(appProvider.notifier).back(); }, ), Expanded(child: ListView.separated( -- cgit 1.2.3-korg