45 lines
1.0 KiB
Dart
45 lines
1.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:gymlink_module_web/theme.dart';
|
|
|
|
class GymLinkProvider with ChangeNotifier {
|
|
bool _isLoading = true;
|
|
bool get isLoading => _isLoading;
|
|
bool _blackTheme = false;
|
|
bool get blackTheme => _blackTheme;
|
|
String _token = '';
|
|
String get token => _token;
|
|
ThemeData _theme = myTheme;
|
|
ThemeData get theme => _theme;
|
|
void Function() _onError = () => {};
|
|
|
|
void Function() get onError => _onError;
|
|
|
|
void onTokenReceived(String token) {
|
|
_token = token;
|
|
_isLoading = false;
|
|
notifyListeners();
|
|
// if (token == 'token123') {
|
|
// _isLoading = false;
|
|
// notifyListeners();
|
|
// } else {
|
|
// _isLoading = true;
|
|
// notifyListeners();
|
|
// }
|
|
}
|
|
|
|
void changeTheme(int color) {
|
|
_blackTheme = !_blackTheme;
|
|
_theme = getThemeData(Color(color), _blackTheme);
|
|
notifyListeners();
|
|
}
|
|
|
|
void setTheme(ThemeData theme) {
|
|
_theme = theme;
|
|
notifyListeners();
|
|
}
|
|
|
|
void setOnError(void Function() onError) {
|
|
_onError = onError;
|
|
}
|
|
}
|