setTheme method
Sets the theme of the app to the ThemeData that corresponds to the themeId
.
If no ThemeData is registered for the given themeId
, the ThemeCollections
fallback theme is used.
Implementation
Future<void> setTheme(int themeId) async {
setState(() {
_currentTheme = widget.themeCollection[themeId];
_currentDarkTheme = widget.darkThemeCollection[themeId];
_currentThemeId = themeId;
});
_prefs.setSelectedThemeId(_currentThemeId);
}