didvan-app/lib/providers/core.dart

24 lines
661 B
Dart

import 'package:didvan/main.dart';
import 'package:didvan/models/enums.dart';
import 'package:didvan/utils/action_sheet.dart';
import 'package:flutter/cupertino.dart';
class CoreProvier with ChangeNotifier {
AppState _appState = AppState.busy;
set appState(AppState newState) {
if (newState == AppState.isolatedBusy) {
ActionSheetUtils(navigatorKey.currentContext!).showLogoLoadingIndicator();
}
if (_appState == AppState.isolatedBusy) {
ActionSheetUtils(navigatorKey.currentContext!).pop();
}
_appState = newState;
notifyListeners();
}
void update() => notifyListeners();
AppState get appState => _appState;
}