[ 
https://issues.apache.org/jira/browse/BEAM-13655?focusedWorklogId=721880&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-721880
 ]

ASF GitHub Bot logged work on BEAM-13655:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 07/Feb/22 12:48
            Start Date: 07/Feb/22 12:48
    Worklog Time Spent: 10m 
      Work Description: 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]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 721880)
    Time Spent: 20m  (was: 10m)

> [Playground] Persist the dark/light mode selection
> --------------------------------------------------
>
>                 Key: BEAM-13655
>                 URL: https://issues.apache.org/jira/browse/BEAM-13655
>             Project: Beam
>          Issue Type: Task
>          Components: beam-playground
>            Reporter: Artur Khanin
>            Assignee: Alexander Zhuravlev
>            Priority: P2
>              Labels: beam-playground-frontend, beam-playground-sprint-7, 
> beam-playground-sprint-8
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> The preference of the dark/light mode of Beam Playground should be saved in 
> the persistent state.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to