From 54e44cb41fecdbcdd806ccb4498c380745d33305 Mon Sep 17 00:00:00 2001 From: Anand kumar Date: Sat, 6 Apr 2024 18:25:38 +0530 Subject: [PATCH] Fixed Enabled/disabled color of toggles are misleading #178 --- lib/ui/utils/theme_controller.dart | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/ui/utils/theme_controller.dart b/lib/ui/utils/theme_controller.dart index 83fc6982..653c47a5 100644 --- a/lib/ui/utils/theme_controller.dart +++ b/lib/ui/utils/theme_controller.dart @@ -128,6 +128,15 @@ class ThemeController extends GetxController { letterSpacing: 1, fontWeight: FontWeight.bold), ), + switchTheme: SwitchThemeData( + thumbColor: MaterialStateProperty.resolveWith( + (Set states) { + if (states.contains(MaterialState.selected)) { + return primarySwatch[100]!.withLightness(50); + } + return Colors.white.withOpacity(0.3); + }), + ), indicatorColor: Colors.white, progressIndicatorTheme: ProgressIndicatorThemeData( linearTrackColor: (primarySwatch[300])!.computeLuminance() > 0.3 @@ -215,6 +224,15 @@ class ThemeController extends GetxController { valueIndicatorColor: Colors.black38, thumbColor: Colors.white, ), + switchTheme: SwitchThemeData( + thumbColor: MaterialStateProperty.resolveWith( + (Set states) { + if (states.contains(MaterialState.selected)) { + return Colors.white.withLightness(50); + } + return Colors.white.withOpacity(0.3); + }), + ), inputDecorationTheme: const InputDecorationTheme( focusColor: Colors.white, focusedBorder: UnderlineInputBorder( @@ -273,7 +291,7 @@ class ThemeController extends GetxController { color: Colors.grey[800], fontWeight: FontWeight.bold)), bottomSheetTheme: const BottomSheetThemeData( backgroundColor: Colors.white, modalBarrierColor: Colors.white), - sliderTheme: SliderThemeData( + sliderTheme:SliderThemeData( //base bar color inactiveTrackColor: Colors.black38, //buffered progress @@ -282,6 +300,15 @@ class ThemeController extends GetxController { valueIndicatorColor: Colors.white38, thumbColor: Colors.grey[800], ), + switchTheme: SwitchThemeData( + thumbColor: MaterialStateProperty.resolveWith( + (Set states) { + if (states.contains(MaterialState.selected)) { + return Colors.white.withLightness(50); + } + return Colors.grey.withOpacity(0.3); + }), + ), inputDecorationTheme: const InputDecorationTheme( focusColor: Colors.black, focusedBorder: UnderlineInputBorder(