📅  最后修改于: 2022-03-11 14:57:30.279000             🧑  作者: Mango
class ThemeNotifier extends ChangeNotifier {
final String key = "theme";
SharedPreferences _pref;
bool _darkTheme;
bool get darkTheme => _darkTheme;
ThemeNotifier() {
_darkTheme = true;
}
toggleTheme(){
_darkTheme = !_darkTheme;
notifyListeners();
}
}