Add flag to getEnteColorScheme and getEnteTextTheme to get the opposite theme's colors and styles

This commit is contained in:
ashilkn 2022-12-07 19:05:59 +05:30
parent a56e36a263
commit 6148243157
2 changed files with 17 additions and 4 deletions

View file

@ -343,6 +343,9 @@ extension CustomColorScheme on ColorScheme {
EnteTheme get enteTheme => EnteTheme get enteTheme =>
brightness == Brightness.light ? lightTheme : darkTheme; brightness == Brightness.light ? lightTheme : darkTheme;
EnteTheme get inverseEnteTheme =>
brightness == Brightness.light ? darkTheme : lightTheme;
} }
OutlinedButtonThemeData buildOutlinedButtonThemeData({ OutlinedButtonThemeData buildOutlinedButtonThemeData({

View file

@ -36,10 +36,20 @@ EnteTheme darkTheme = EnteTheme(
shadowButton: shadowButtonDark, shadowButton: shadowButtonDark,
); );
EnteColorScheme getEnteColorScheme(BuildContext context) { EnteColorScheme getEnteColorScheme(
return Theme.of(context).colorScheme.enteTheme.colorScheme; BuildContext context, {
bool inverse = false,
}) {
return inverse
? Theme.of(context).colorScheme.inverseEnteTheme.colorScheme
: Theme.of(context).colorScheme.enteTheme.colorScheme;
} }
EnteTextTheme getEnteTextTheme(BuildContext context) { EnteTextTheme getEnteTextTheme(
return Theme.of(context).colorScheme.enteTheme.textTheme; BuildContext context, {
bool inverse = false,
}) {
return inverse
? Theme.of(context).colorScheme.inverseEnteTheme.textTheme
: Theme.of(context).colorScheme.enteTheme.textTheme;
} }