From 614824315775599b79be4a11daa438b8168dd766 Mon Sep 17 00:00:00 2001 From: ashilkn Date: Wed, 7 Dec 2022 19:05:59 +0530 Subject: [PATCH] Add flag to getEnteColorScheme and getEnteTextTheme to get the opposite theme's colors and styles --- lib/ente_theme_data.dart | 3 +++ lib/theme/ente_theme.dart | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/ente_theme_data.dart b/lib/ente_theme_data.dart index e9e963168..371e9a1f6 100644 --- a/lib/ente_theme_data.dart +++ b/lib/ente_theme_data.dart @@ -343,6 +343,9 @@ extension CustomColorScheme on ColorScheme { EnteTheme get enteTheme => brightness == Brightness.light ? lightTheme : darkTheme; + + EnteTheme get inverseEnteTheme => + brightness == Brightness.light ? darkTheme : lightTheme; } OutlinedButtonThemeData buildOutlinedButtonThemeData({ diff --git a/lib/theme/ente_theme.dart b/lib/theme/ente_theme.dart index e11075b04..f1290c161 100644 --- a/lib/theme/ente_theme.dart +++ b/lib/theme/ente_theme.dart @@ -36,10 +36,20 @@ EnteTheme darkTheme = EnteTheme( shadowButton: shadowButtonDark, ); -EnteColorScheme getEnteColorScheme(BuildContext context) { - return Theme.of(context).colorScheme.enteTheme.colorScheme; +EnteColorScheme getEnteColorScheme( + BuildContext context, { + bool inverse = false, +}) { + return inverse + ? Theme.of(context).colorScheme.inverseEnteTheme.colorScheme + : Theme.of(context).colorScheme.enteTheme.colorScheme; } -EnteTextTheme getEnteTextTheme(BuildContext context) { - return Theme.of(context).colorScheme.enteTheme.textTheme; +EnteTextTheme getEnteTextTheme( + BuildContext context, { + bool inverse = false, +}) { + return inverse + ? Theme.of(context).colorScheme.inverseEnteTheme.textTheme + : Theme.of(context).colorScheme.enteTheme.textTheme; }