File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11//adapted from https://gist.github.com/RodBr/4d6ebfea8b1f9432ff088bec4455e15c#file-main4-dart
22
3- import 'package:flutter/foundation.dart' ;
43import 'package:flutter/material.dart' ;
54import 'package:get_storage/get_storage.dart' ;
65import '../../notificationUtil/prevent_update_notifs.dart' ;
@@ -12,16 +11,15 @@ class ThemeController with ChangeNotifier {
1211 set themeMode (ThemeMode ? themeMode) {
1312 PreventUpdatingNotifs .setNow ();
1413 _themeMode = themeMode;
15- GetStorage ().write ('theme' , themeMode.toString ().split ('.' )[ 1 ] );
14+ GetStorage ().write ('theme' , themeMode.toString ().split ('.' ).last );
1615 notifyListeners ();
1716 }
1817
1918 ThemeController () {
2019 String themeText =
2120 GetStorage ().read ('theme' ) ?? 'light' ; //by default, light is selected
2221 try {
23- _themeMode =
24- ThemeMode .values.firstWhere ((e) => describeEnum (e) == themeText);
22+ _themeMode = ThemeMode .values.byName (themeText);
2523 } catch (e) {
2624 _themeMode = ThemeMode .system;
2725 }
You can’t perform that action at this time.
0 commit comments