summaryrefslogtreecommitdiffstats
path: root/lib/data/data_providers
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2024-01-23 15:51:45 -0500
committerScott Murray <scott.murray@konsulko.com>2024-01-23 16:40:09 -0500
commitcc99d4d772be6635639a0d398076a8890f4e6a42 (patch)
treedb3b41545c94337b43421bab00b829181fdbf57d /lib/data/data_providers
parentee592b5048543951f712c0abb997a6e97c036544 (diff)
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 <scott.murray@konsulko.com>
Diffstat (limited to 'lib/data/data_providers')
-rw-r--r--lib/data/data_providers/app_provider.dart21
1 files changed, 20 insertions, 1 deletions
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<AppState>((ref) => AppState.splash);
+class AppStateNotifier extends Notifier<AppState> {
+ 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, AppState>(AppStateNotifier.new);
final valClientProvider = Provider((ref) {
KuksaConfig config = ref.watch(appConfigProvider).kuksaConfig;