From cc99d4d772be6635639a0d398076a8890f4e6a42 Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Tue, 23 Jan 2024 15:51:45 -0500 Subject: Connect audio settings button Rework to connect the audio settings button on the media pages to the appropriate settings page, and have the back button go back to the expected previous page. To enable this, the global AppState provider was reworked to track the previous page and add explicit update and back member functions. Bug-AGL: SPEC-5030 Change-Id: I5858d1b1bf511a184b6538b2ce8c183b00c24fc6 Signed-off-by: Scott Murray --- lib/data/data_providers/app_provider.dart | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'lib/data/data_providers/app_provider.dart') diff --git a/lib/data/data_providers/app_provider.dart b/lib/data/data_providers/app_provider.dart index ee6d29e..a74c0fd 100644 --- a/lib/data/data_providers/app_provider.dart +++ b/lib/data/data_providers/app_provider.dart @@ -47,7 +47,26 @@ enum AppState { year } -final appProvider = StateProvider((ref) => AppState.splash); +class AppStateNotifier extends Notifier { + AppState previous = AppState.home; + + @override + AppState build() { + return AppState.splash; + } + + void update(AppState newState) { + previous = state; + state = newState; + } + + void back() { + state = previous; + } +} + +final appProvider = + NotifierProvider(AppStateNotifier.new); final valClientProvider = Provider((ref) { KuksaConfig config = ref.watch(appConfigProvider).kuksaConfig; -- cgit 1.2.3-korg