uwu mode in settingsprovider

This commit is contained in:
Kima 2024-03-21 22:46:32 +01:00
parent ee64468a8f
commit 461338d99b

View File

@ -100,6 +100,7 @@ class SettingsProvider extends ChangeNotifier {
String _calendarId; String _calendarId;
bool _navShadow; bool _navShadow;
bool _newColors; bool _newColors;
bool _uwuMode;
SettingsProvider({ SettingsProvider({
DatabaseProvider? database, DatabaseProvider? database,
@ -165,6 +166,7 @@ class SettingsProvider extends ChangeNotifier {
required String calendarId, required String calendarId,
required bool navShadow, required bool navShadow,
required bool newColors, required bool newColors,
required bool uwuMode,
}) : _database = database, }) : _database = database,
_language = language, _language = language,
_startPage = startPage, _startPage = startPage,
@ -227,7 +229,8 @@ class SettingsProvider extends ChangeNotifier {
_calSyncRenamed = calSyncRenamed, _calSyncRenamed = calSyncRenamed,
_calendarId = calendarId, _calendarId = calendarId,
_navShadow = navShadow, _navShadow = navShadow,
_newColors = newColors; _newColors = newColors,
_uwuMode = uwuMode;
factory SettingsProvider.fromMap(Map map, factory SettingsProvider.fromMap(Map map,
{required DatabaseProvider database}) { {required DatabaseProvider database}) {
@ -310,6 +313,7 @@ class SettingsProvider extends ChangeNotifier {
calendarId: map['calendar_id'], calendarId: map['calendar_id'],
navShadow: map['nav_shadow'] == 1, navShadow: map['nav_shadow'] == 1,
newColors: map['new_colors'] == 1, newColors: map['new_colors'] == 1,
uwuMode: map['uwu_mode'] == 1,
); );
} }
@ -380,6 +384,7 @@ class SettingsProvider extends ChangeNotifier {
"calendar_id": _calendarId, "calendar_id": _calendarId,
"nav_shadow": _navShadow ? 1 : 0, "nav_shadow": _navShadow ? 1 : 0,
"new_colors": _newColors ? 1 : 0, "new_colors": _newColors ? 1 : 0,
"uwu_mode": _uwuMode ? 1 : 0,
}; };
} }
@ -454,6 +459,7 @@ class SettingsProvider extends ChangeNotifier {
calendarId: '', calendarId: '',
navShadow: true, navShadow: true,
newColors: true, newColors: true,
uwuMode: false,
); );
} }
@ -519,6 +525,7 @@ class SettingsProvider extends ChangeNotifier {
String get calendarId => _calendarId; String get calendarId => _calendarId;
bool get navShadow => _navShadow; bool get navShadow => _navShadow;
bool get newColors => _newColors; bool get newColors => _newColors;
bool get uwuMode => _uwuMode;
Future<void> update({ Future<void> update({
bool store = true, bool store = true,
@ -580,6 +587,7 @@ class SettingsProvider extends ChangeNotifier {
String? calendarId, String? calendarId,
bool? navShadow, bool? navShadow,
bool? newColors, bool? newColors,
bool? uwuMode,
}) async { }) async {
if (language != null && language != _language) _language = language; if (language != null && language != _language) _language = language;
if (startPage != null && startPage != _startPage) _startPage = startPage; if (startPage != null && startPage != _startPage) _startPage = startPage;
@ -753,6 +761,9 @@ class SettingsProvider extends ChangeNotifier {
if (newColors != null && newColors != _newColors) { if (newColors != null && newColors != _newColors) {
_newColors = newColors; _newColors = newColors;
} }
if (uwuMode != null && uwuMode != _uwuMode) {
_uwuMode = uwuMode;
}
// store or not // store or not
if (store) await _database?.store.storeSettings(this); if (store) await _database?.store.storeSettings(this);
notifyListeners(); notifyListeners();