mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 21:09:21 +00:00
Add force mobile mode preference
This commit is contained in:
parent
21d844b2ba
commit
d04b40f662
@ -10,11 +10,16 @@ import 'package:shared_preferences/shared_preferences.dart';
|
|||||||
///
|
///
|
||||||
/// @author Pierre HUBERT
|
/// @author Pierre HUBERT
|
||||||
|
|
||||||
enum PreferencesKeyList { LOGIN_TOKENS, ENABLE_DARK_THEME }
|
enum PreferencesKeyList {
|
||||||
|
LOGIN_TOKENS,
|
||||||
|
ENABLE_DARK_THEME,
|
||||||
|
FORCE_MOBILE_MODE,
|
||||||
|
}
|
||||||
|
|
||||||
const _PreferenceKeysName = {
|
const _PreferenceKeysName = {
|
||||||
PreferencesKeyList.LOGIN_TOKENS: "login_tokens",
|
PreferencesKeyList.LOGIN_TOKENS: "login_tokens",
|
||||||
PreferencesKeyList.ENABLE_DARK_THEME: "dark_theme",
|
PreferencesKeyList.ENABLE_DARK_THEME: "dark_theme",
|
||||||
|
PreferencesKeyList.FORCE_MOBILE_MODE: "force_mobile_mode",
|
||||||
};
|
};
|
||||||
|
|
||||||
class PreferencesHelper {
|
class PreferencesHelper {
|
||||||
@ -75,6 +80,7 @@ class PreferencesHelper {
|
|||||||
/// Get all settings as an [ApplicationPreferences] object
|
/// Get all settings as an [ApplicationPreferences] object
|
||||||
ApplicationPreferences get preferences => ApplicationPreferences(
|
ApplicationPreferences get preferences => ApplicationPreferences(
|
||||||
enableDarkMode: getBool(PreferencesKeyList.ENABLE_DARK_THEME),
|
enableDarkMode: getBool(PreferencesKeyList.ENABLE_DARK_THEME),
|
||||||
|
forceMobileMode: getBool(PreferencesKeyList.FORCE_MOBILE_MODE),
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Apply new preferences
|
/// Apply new preferences
|
||||||
|
@ -6,8 +6,11 @@ import 'package:flutter/cupertino.dart';
|
|||||||
|
|
||||||
class ApplicationPreferences {
|
class ApplicationPreferences {
|
||||||
bool enableDarkMode;
|
bool enableDarkMode;
|
||||||
|
bool forceMobileMode;
|
||||||
|
|
||||||
ApplicationPreferences({
|
ApplicationPreferences({
|
||||||
@required this.enableDarkMode,
|
@required this.enableDarkMode,
|
||||||
}) : assert(enableDarkMode != null);
|
@required this.forceMobileMode,
|
||||||
|
}) : assert(enableDarkMode != null),
|
||||||
|
assert(forceMobileMode != null);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user