From e812653f1ac23cea881d7056638bb40ab96b6b11 Mon Sep 17 00:00:00 2001 From: its-me-abhishek Date: Tue, 21 Nov 2023 20:38:50 +0530 Subject: [PATCH] Theme Update Fixes --- lib/main.dart | 31 ------------------ lib/widgets/add_Task.dart | 67 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 31 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 721d2dae..02e1b2b7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -118,37 +118,6 @@ class _MyAppState extends State { useMaterial3: true, primarySwatch: Palette.kToDark, visualDensity: VisualDensity.adaptivePlatformDensity, - colorScheme: ColorScheme( - brightness: AppSettings.isDarkMode - ? Brightness.dark - : Brightness.light, - primary: AppSettings.isDarkMode - ? Colors.white - : const Color(0xFF191919), - onPrimary: AppSettings.isDarkMode - ? const Color(0xFF191919) - : Colors.white, - secondary: AppSettings.isDarkMode - ? Colors.white - : const Color(0xFF191919), - onSecondary: AppSettings.isDarkMode - ? Colors.white - : const Color(0xFF191919), - error: Colors.red, - onError: Colors.red, - background: AppSettings.isDarkMode - ? const Color(0xFF191919) - : Colors.white, - onBackground: AppSettings.isDarkMode - ? const Color(0xFF191919) - : Colors.white, - surface: AppSettings.isDarkMode - ? const Color(0xFF191919) - : Colors.white, - onSurface: AppSettings.isDarkMode - ? Colors.white - : const Color(0xFF191919), - ), ), // initialRoute: PageRoutes.home, routes: { diff --git a/lib/widgets/add_Task.dart b/lib/widgets/add_Task.dart index eb0f42b8..62f49d4f 100644 --- a/lib/widgets/add_Task.dart +++ b/lib/widgets/add_Task.dart @@ -135,6 +135,39 @@ class _AddTaskBottomSheetState extends State { : null, onTap: () async { var date = await showDatePicker( + builder: (BuildContext context, Widget? child) { + return Theme( + data: Theme.of(context).copyWith( + colorScheme: AppSettings.isDarkMode + ? const ColorScheme( + brightness: Brightness.dark, + primary: Colors.white, + onPrimary: Colors.black, + secondary: Colors.black, + onSecondary: Colors.white, + error: Colors.red, + onError: Colors.black, + background: Colors.black, + onBackground: Colors.white, + surface: Colors.black, + onSurface: Colors.white, + ) + : const ColorScheme( + brightness: Brightness.light, + primary: Colors.black, + onPrimary: Colors.white, + secondary: Colors.white, + onSecondary: Colors.black, + error: Colors.red, + onError: Colors.white, + background: Colors.white, + onBackground: Colors.black, + surface: Colors.white, + onSurface: Colors.black, + )), + child: child!, + ); + }, fieldHintText: "Month/Date/Year", context: context, initialDate: due ?? DateTime.now(), @@ -143,6 +176,40 @@ class _AddTaskBottomSheetState extends State { ); if (date != null) { var time = await showTimePicker( + builder: (BuildContext context, Widget? child) { + return Theme( + data: Theme.of(context).copyWith( + textTheme: const TextTheme(), + colorScheme: AppSettings.isDarkMode + ? const ColorScheme( + brightness: Brightness.dark, + primary: Colors.white, + onPrimary: Colors.black, + secondary: Colors.black, + onSecondary: Colors.white, + error: Colors.red, + onError: Colors.black, + background: Colors.black, + onBackground: Colors.white, + surface: Colors.black, + onSurface: Colors.white, + ) + : const ColorScheme( + brightness: Brightness.light, + primary: Colors.black, + onPrimary: Colors.white, + secondary: Colors.white, + onSecondary: Colors.black, + error: Colors.red, + onError: Colors.white, + background: Colors.white, + onBackground: Colors.black, + surface: Colors.white, + onSurface: Colors.black, + )), + child: child!, + ); + }, context: context, initialTime: TimeOfDay.fromDateTime(due ?? DateTime.now()),