Theme Switcher added to drawers all files updated
This commit is contained in:
@@ -6,7 +6,9 @@ class MyTheme {
|
||||
late int _errColor;
|
||||
late int _succColor;
|
||||
late int _mesColor;
|
||||
late ThemeData data;
|
||||
// late ThemeData _dark;
|
||||
// late ThemeData _light;
|
||||
late String mode;
|
||||
|
||||
// Options:-
|
||||
// f3f9d2 = Cream
|
||||
@@ -19,40 +21,75 @@ class MyTheme {
|
||||
// a63446 = red
|
||||
|
||||
MyTheme() {
|
||||
_mainColor = 0XFF3A4454;
|
||||
_secondColor = 0XFFbedcfe;
|
||||
mode = "Light";
|
||||
// _mainColor = 0XFF3A4454;
|
||||
// _secondColor = 0XFFbedcfe;
|
||||
_errColor = 0xffD87E8B;
|
||||
_succColor = 0xffB0F2B4;
|
||||
_mesColor = 0xffc8c8c8d9;
|
||||
data = ThemeData(
|
||||
scaffoldBackgroundColor: primaryColor(),
|
||||
colorScheme: ColorScheme.dark(
|
||||
primary: messageTextColor(),
|
||||
onPrimary: primaryColor(),
|
||||
onSurface: secondaryColor(),
|
||||
),
|
||||
datePickerTheme: DatePickerThemeData(
|
||||
backgroundColor: primaryColor(),
|
||||
// _dark = darkMode();
|
||||
// _light = lightMode();
|
||||
}
|
||||
|
||||
//------------------------------
|
||||
cancelButtonStyle: ButtonStyle(
|
||||
foregroundColor: WidgetStatePropertyAll(secondaryColor()),
|
||||
overlayColor: WidgetStatePropertyAll(messageTextColor()),
|
||||
ThemeData getData() {
|
||||
return ThemeData(
|
||||
scaffoldBackgroundColor: primaryColor(),
|
||||
colorScheme: ColorScheme.dark(
|
||||
primary: messageTextColor(),
|
||||
onPrimary: primaryColor(),
|
||||
onSurface: secondaryColor(),
|
||||
),
|
||||
//------------------------------
|
||||
confirmButtonStyle: ButtonStyle(
|
||||
foregroundColor: WidgetStatePropertyAll(secondaryColor()),
|
||||
overlayColor: WidgetStatePropertyAll(messageTextColor()),
|
||||
datePickerTheme: DatePickerThemeData(
|
||||
backgroundColor: primaryColor(),
|
||||
|
||||
//------------------------------
|
||||
cancelButtonStyle: ButtonStyle(
|
||||
foregroundColor: WidgetStatePropertyAll(secondaryColor()),
|
||||
overlayColor: WidgetStatePropertyAll(messageTextColor()),
|
||||
),
|
||||
//------------------------------
|
||||
confirmButtonStyle: ButtonStyle(
|
||||
foregroundColor: WidgetStatePropertyAll(secondaryColor()),
|
||||
overlayColor: WidgetStatePropertyAll(messageTextColor()),
|
||||
),
|
||||
headerBackgroundColor: secondaryColor(),
|
||||
headerForegroundColor: primaryColor(),
|
||||
),
|
||||
headerBackgroundColor: secondaryColor(),
|
||||
headerForegroundColor: primaryColor(),
|
||||
),
|
||||
appBarTheme: AppBarTheme(
|
||||
color: secondaryColor(),
|
||||
),
|
||||
floatingActionButtonTheme:
|
||||
FloatingActionButtonThemeData(backgroundColor: secondaryColor()),
|
||||
);
|
||||
appBarTheme: AppBarTheme(
|
||||
color: secondaryColor(),
|
||||
foregroundColor: primaryColor(),
|
||||
titleTextStyle: TextStyle(
|
||||
color: primaryColor(),
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
floatingActionButtonTheme: FloatingActionButtonThemeData(
|
||||
backgroundColor: secondaryColor(),
|
||||
foregroundColor: primaryColor(),
|
||||
extendedTextStyle: TextStyle(color: primaryColor()),
|
||||
),
|
||||
drawerTheme: DrawerThemeData(
|
||||
backgroundColor: primaryColor(),
|
||||
));
|
||||
}
|
||||
|
||||
void setMode(String m) {
|
||||
mode;
|
||||
}
|
||||
|
||||
ThemeData darkMode() {
|
||||
//mode = "Dark";
|
||||
// _mainColor = 0XFF3A4454;
|
||||
// _secondColor = 0XFFbedcfe;
|
||||
return getData();
|
||||
}
|
||||
|
||||
ThemeData lightMode() {
|
||||
//mode = "Light";
|
||||
// _secondColor = 0XFF3A4454;
|
||||
// _mainColor = 0XFFbedcfe;
|
||||
return getData();
|
||||
}
|
||||
|
||||
Color messageTextColor() {
|
||||
@@ -68,10 +105,24 @@ class MyTheme {
|
||||
}
|
||||
|
||||
Color primaryColor() {
|
||||
if (mode == "Dark") {
|
||||
_mainColor = 0XFF3A4454;
|
||||
//_secondColor = 0XFFbedcfe;
|
||||
} else {
|
||||
//_secondColor = 0XFF3A4454;
|
||||
_mainColor = 0XFFbedcfe;
|
||||
}
|
||||
return Color(_mainColor);
|
||||
}
|
||||
|
||||
Color secondaryColor() {
|
||||
if (mode == "Dark") {
|
||||
//_mainColor = 0XFF3A4454;
|
||||
_secondColor = 0XFFbedcfe;
|
||||
} else {
|
||||
_secondColor = 0XFF3A4454;
|
||||
//_mainColor = 0XFFbedcfe;
|
||||
}
|
||||
return Color(_secondColor);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user