setTheme method

void setTheme({
  1. required ThemeMode theme,
})

Method to set the app's theme

Implementation

void setTheme({required ThemeMode theme}) async {
  /// If the new theme is the same as the current theme, do nothing
  if (_themeMode == theme) {
    return;
  }

  _themeMode = theme; /// Update the theme mode


  ProKitTheme.changeAppTheme(
      themeType: _themeMode == ThemeMode.light ? ThemeType.light : ThemeType.dark);

  /// Save the new theme to SharedPreferences
  await ProKitPrefManager.setString(
    'theme',
    theme.toString().split('.').last,
  );

  notifyListeners();
}