Theme change functionality#22
Conversation
| import 'app_colors.dart'; | ||
|
|
||
| class AppThemes { | ||
| // light theme configurations |
There was a problem hiding this comment.
Our code should be self explanatory. don't need to add unnecessary comment.
| ); | ||
| } | ||
|
|
||
| // dark theme configurations |
There was a problem hiding this comment.
Our code should be self explanatory. don't need to add unnecessary comment.
| // Get themeMode info from local storage and return current ThemeMode | ||
| Future<ThemeMode> get themeMode async => | ||
| await _loadThemeFromSharedPref() ? ThemeMode.dark : ThemeMode.light; | ||
|
|
||
| // Load themeMode from local storage | ||
| Future<bool> _loadThemeFromSharedPref() async { | ||
| return await _preferenceManager.getBool(themeModeKey); | ||
| } | ||
|
|
||
| // Load isDarkMode status from local storage | ||
| Future<bool> getCurrentThemeMode() async { | ||
| return await _preferenceManager.getBool(themeModeKey); | ||
| } | ||
|
|
||
| // change isDarkMode status in local storage | ||
| changeThemeMode(bool isDarkMode) { | ||
| _preferenceManager.setBool(themeModeKey, isDarkMode); | ||
| } |
There was a problem hiding this comment.
Our code should be self explanatory. don't need to add unnecessary comment.
| getCurrentThemeMode() async { | ||
| currentThemeMode.value = await themeService.themeMode; | ||
| } | ||
|
|
||
| setCurrentThemeMode(ThemeMode themeMode) { | ||
| currentThemeMode.value = themeMode; | ||
| } |
Here the background color of the cards are static colors from AppColors file, to make it dynamic we need to use colors from the theme regardless of we use GetX theme or our custom theme class. Should I refactor them to use colors from theme? |


Why? (ticket link or issue description)
#16
What was done and how?
Theme changing was implemented with GetX
Anything special? (optional)