mirror of
https://github.com/qinglong-app/qinglong_app.git
synced 2025-10-09 16:48:19 +08:00
add checkbox
This commit is contained in:
@@ -21,11 +21,11 @@ class ThemeViewModel extends ChangeNotifier {
|
||||
}
|
||||
|
||||
bool isInDartMode() {
|
||||
return SpUtil.getBool(sp_Theme, defValue: false);
|
||||
return SpUtil.getBool(spTheme, defValue: false);
|
||||
}
|
||||
|
||||
void changeThemeReal(bool dark, [bool notify = true]) {
|
||||
SpUtil.putBool(sp_Theme, dark);
|
||||
SpUtil.putBool(spTheme, dark);
|
||||
if (!dark) {
|
||||
currentTheme = lightTheme;
|
||||
themeColor = LightThemeColors();
|
||||
@@ -39,7 +39,7 @@ class ThemeViewModel extends ChangeNotifier {
|
||||
}
|
||||
|
||||
void changeTheme() {
|
||||
changeThemeReal(!SpUtil.getBool(sp_Theme, defValue: false), true);
|
||||
changeThemeReal(!SpUtil.getBool(spTheme, defValue: false), true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +76,20 @@ ThemeData darkTheme = ThemeData.dark().copyWith(
|
||||
secondary: _primaryColor,
|
||||
primary: _primaryColor,
|
||||
),
|
||||
toggleableActiveColor: _primaryColor,
|
||||
checkboxTheme: CheckboxThemeData(
|
||||
checkColor: MaterialStateProperty.resolveWith(
|
||||
(Set<MaterialState> states) {
|
||||
if (states.contains(MaterialState.disabled)) {
|
||||
return Colors.transparent;
|
||||
}
|
||||
if (states.contains(MaterialState.selected)) {
|
||||
return Colors.white;
|
||||
}
|
||||
return Colors.white;
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
ThemeData lightTheme = ThemeData.light().copyWith(
|
||||
brightness: Brightness.light,
|
||||
@@ -122,6 +136,20 @@ ThemeData lightTheme = ThemeData.light().copyWith(
|
||||
borderSide: BorderSide(color: _primaryColor),
|
||||
),
|
||||
),
|
||||
toggleableActiveColor: _primaryColor,
|
||||
checkboxTheme: CheckboxThemeData(
|
||||
checkColor: MaterialStateProperty.resolveWith(
|
||||
(Set<MaterialState> states) {
|
||||
if (states.contains(MaterialState.disabled)) {
|
||||
return Colors.transparent;
|
||||
}
|
||||
if (states.contains(MaterialState.selected)) {
|
||||
return Colors.white;
|
||||
}
|
||||
return Colors.black;
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
abstract class ThemeColors {
|
||||
|
||||
Reference in New Issue
Block a user