booleanbites / houzi-support

Support forum repo for issues & bugs reported for Houzi Flutter App.
4 stars 0 forks source link

Enable Dark Mode By Default #142

Closed xAshry closed 3 weeks ago

xAshry commented 7 months ago

Hello ,, i want to enable the dark theme by default instead of lite theme ,, where i can find the variable code to change it to dark ? thank you

Hassan6197 commented 7 months ago

Hello @xAshry, Go to packages/houzi_package/lib/files/theme_service_files/theme_notifier.dart and look for ThemeNotifier._internal() method and replace it with the following:

ThemeNotifier._internal(){
    String themeMode = ThemeStorageManager.readData(THEME_MODE_INFO) ?? DARK_THEME_MODE;
    if(themeMode == null || themeMode.isEmpty){
      _themeMode = ThemeMode.dark;
      // _themeMode = ThemeMode.system;
    }else if (themeMode == LIGHT_THEME_MODE) {
      _themeMode = ThemeMode.light;
    } else if (themeMode == DARK_THEME_MODE){
      _themeMode = ThemeMode.dark;
    } else if (themeMode == SYSTEM_THEME_MODE){
      _themeMode = ThemeMode.system;
    }
    notifyListeners();
  }

Then go to packages/houzi_package/lib/pages/app_settings_pages/dark_mode_setting.dart and look for void initState() method and replace the 23 line with:

String themeMode = ThemeStorageManager.readData(THEME_MODE_INFO) ?? DARK_THEME_MODE;
quitriz commented 7 months ago

wow, that's a bit of codes :) can you have it like the language default in the constant.dart file in lib/common ? default "Dark" or "light" something like that like the "en" or "fr" etc .. till the next update we screw it up again .. :)

Hassan6197 commented 7 months ago

@quitriz Thank you for your suggestion. We will consider it.

quitriz commented 7 months ago

@quitriz Thank you for your suggestion. We will consider it.

NP Hassan, when do is it planned for the next updates is comming out ? just waiting for the moderation functions to be implemented. I really need those functions.

Thanks

AdilSoomro commented 3 months ago

@MuhammadSulemanSaleem we should have a hook for the dark mode or light mode.

MuhammadSulemanSaleem commented 3 weeks ago

Added support of hook for the dark mode or light mode i.e. getDefaultAppThemeModeHook() in Houzi 1.4.2.