diff options
Diffstat (limited to 'lib/data/data_providers/app_provider.dart')
-rw-r--r-- | lib/data/data_providers/app_provider.dart | 21 |
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; |