Skip to content

Commit

Permalink
Theme Update Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
its-me-abhishek committed Nov 21, 2023
1 parent 979cee4 commit e812653
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 31 deletions.
31 changes: 0 additions & 31 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,37 +118,6 @@ class _MyAppState extends State<MyApp> {
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: {
Expand Down
67 changes: 67 additions & 0 deletions lib/widgets/add_Task.dart
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,39 @@ class _AddTaskBottomSheetState extends State<AddTaskBottomSheet> {
: 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(),
Expand All @@ -143,6 +176,40 @@ class _AddTaskBottomSheetState extends State<AddTaskBottomSheet> {
);
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()),
Expand Down

0 comments on commit e812653

Please sign in to comment.