-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dff6c57
commit 4fb01e1
Showing
8 changed files
with
58 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,27 @@ | ||
import 'package:shared_preferences/shared_preferences.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class SelectedTheme { | ||
static SharedPreferences? _preferences; | ||
|
||
static Future init() async => | ||
_preferences = await SharedPreferences.getInstance(); | ||
static Future init() async { | ||
_preferences = await SharedPreferences.getInstance(); | ||
} | ||
|
||
static Future saveMode(bool mode) async => | ||
await _preferences?.setBool('_isDark', mode); | ||
static Future saveMode(bool mode) async { | ||
await _preferences?.setBool('_isDark', mode); | ||
} | ||
|
||
static bool? getMode() => _preferences?.getBool('_isDark'); | ||
static bool? getMode() { | ||
return _preferences?.getBool('_isDark'); | ||
} | ||
} | ||
|
||
class AppSettings { | ||
static bool isDarkMode = SelectedTheme.getMode() ?? true; | ||
} | ||
static bool isDarkMode = true; | ||
|
||
static Future init() async { | ||
await SelectedTheme.init(); | ||
isDarkMode = SelectedTheme.getMode() ?? true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters