ElessarST commented on a change in pull request #16757:
URL: https://github.com/apache/beam/pull/16757#discussion_r800620651



##########
File path: playground/frontend/lib/config/theme.dart
##########
@@ -22,16 +22,34 @@ import 'package:playground/constants/font_weight.dart';
 import 'package:playground/constants/fonts.dart';
 import 'package:playground/constants/sizes.dart';
 import 'package:provider/provider.dart';
+import 'package:shared_preferences/shared_preferences.dart';
+
+const kThemeMode = 'theme_mode';
+const kDarkModeString = 'ThemeMode.dark';
 
 class ThemeProvider extends ChangeNotifier {
+  late SharedPreferences _preferences;
   ThemeMode themeMode = ThemeMode.light;
 
+  init() {
+    _setPreferences();
+  }
+
+  _setPreferences() async {
+    _preferences = await SharedPreferences.getInstance();
+    themeMode = _preferences.getString(kThemeMode) == kDarkModeString

Review comment:
       it's better to use `_preferences.getString(kThemeMode) == 
ThemeMode.dark.toString()` here




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to