Skip to content

Commit 8f4fbe8

Browse files
sprobst76claude
andcommitted
fix: Dark Mode visibility for DatePicker and TimePicker dialogs
Fixed issues where DatePicker and TimePicker dialogs were not visible in Dark Mode due to white text on white background. Applied proper theming to ensure text contrast in both light and dark modes. Changes: - Settings page: Birth date picker now uses DatePickerThemeData - Health Mode setup: Date picker theming for pause start date - Comeback setup: Date picker theming for illness start date - Workout scheduler: Date and time picker theming for workout scheduling - Fixed StrengthWorkoutDao method call: getWorkout → getWorkoutById All date/time pickers now respect the current theme and display properly in Dark Mode with correct text colors and contrast. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
1 parent 9c5e58d commit 8f4fbe8

File tree

5 files changed

+98
-1
lines changed

5 files changed

+98
-1
lines changed

lib/data/mappers/scheduled_workout_mapper.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ScheduledWorkoutMapper {
2828
createdAt: entity.createdAt,
2929
);
3030
} else {
31-
final workout = await _strengthWorkoutDao.getWorkout(entity.workoutId);
31+
final workout = await _strengthWorkoutDao.getWorkoutById(entity.workoutId);
3232

3333
return ScheduledWorkout(
3434
id: entity.id,

lib/features/comeback/presentation/pages/comeback_setup_page.dart

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,26 @@ class _ComebackSetupPageState extends ConsumerState<ComebackSetupPage> {
295295
initialDate: _illnessStartDate ?? DateTime.now().subtract(const Duration(days: 7)),
296296
firstDate: DateTime.now().subtract(const Duration(days: 60)),
297297
lastDate: DateTime.now(),
298+
builder: (context, child) {
299+
return Theme(
300+
data: Theme.of(context).copyWith(
301+
useMaterial3: true,
302+
datePickerTheme: DatePickerThemeData(
303+
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
304+
elevation: 8,
305+
headerBackgroundColor: AppColors.primary,
306+
headerForegroundColor: Colors.white,
307+
weekdayStyle: const TextStyle(
308+
color: AppColors.textPrimary,
309+
fontWeight: FontWeight.bold,
310+
),
311+
dayStyle: const TextStyle(color: AppColors.textPrimary),
312+
yearStyle: const TextStyle(color: AppColors.textPrimary),
313+
),
314+
),
315+
child: child ?? const SizedBox(),
316+
);
317+
},
298318
);
299319
if (date != null) {
300320
setState(() => _illnessStartDate = date);

lib/features/health_mode/presentation/pages/health_mode_setup_page.dart

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,26 @@ class _HealthModeSetupPageState extends ConsumerState<HealthModeSetupPage> {
343343
initialDate: _pauseStartDate ?? DateTime.now().subtract(const Duration(days: 7)),
344344
firstDate: DateTime.now().subtract(const Duration(days: 60)),
345345
lastDate: DateTime.now(),
346+
builder: (context, child) {
347+
return Theme(
348+
data: Theme.of(context).copyWith(
349+
useMaterial3: true,
350+
datePickerTheme: DatePickerThemeData(
351+
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
352+
elevation: 8,
353+
headerBackgroundColor: AppColors.primary,
354+
headerForegroundColor: Colors.white,
355+
weekdayStyle: const TextStyle(
356+
color: AppColors.textPrimary,
357+
fontWeight: FontWeight.bold,
358+
),
359+
dayStyle: const TextStyle(color: AppColors.textPrimary),
360+
yearStyle: const TextStyle(color: AppColors.textPrimary),
361+
),
362+
),
363+
child: child ?? const SizedBox(),
364+
);
365+
},
346366
);
347367
if (date != null) {
348368
setState(() => _pauseStartDate = date);

lib/features/settings/presentation/pages/settings_page.dart

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,26 @@ class SettingsPage extends ConsumerWidget {
526526
firstDate: DateTime(1950),
527527
lastDate: DateTime.now(),
528528
locale: const Locale('de', 'DE'),
529+
builder: (context, child) {
530+
return Theme(
531+
data: Theme.of(context).copyWith(
532+
useMaterial3: true,
533+
datePickerTheme: DatePickerThemeData(
534+
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
535+
elevation: 8,
536+
headerBackgroundColor: AppColors.primary,
537+
headerForegroundColor: Colors.white,
538+
weekdayStyle: const TextStyle(
539+
color: AppColors.textPrimary,
540+
fontWeight: FontWeight.bold,
541+
),
542+
dayStyle: const TextStyle(color: AppColors.textPrimary),
543+
yearStyle: const TextStyle(color: AppColors.textPrimary),
544+
),
545+
),
546+
child: child ?? const SizedBox(),
547+
);
548+
},
529549
);
530550

531551
if (pickedDate != null) {

lib/features/workout_scheduler/presentation/widgets/schedule_workout_dialog.dart

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,26 @@ class __ScheduleWorkoutDialogState
106106
firstDate: DateTime.now(),
107107
lastDate: DateTime.now().add(const Duration(days: 365)),
108108
locale: const Locale('de', 'DE'),
109+
builder: (context, child) {
110+
return Theme(
111+
data: Theme.of(context).copyWith(
112+
useMaterial3: true,
113+
datePickerTheme: DatePickerThemeData(
114+
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
115+
elevation: 8,
116+
headerBackgroundColor: AppColors.primary,
117+
headerForegroundColor: Colors.white,
118+
weekdayStyle: const TextStyle(
119+
color: AppColors.textPrimary,
120+
fontWeight: FontWeight.bold,
121+
),
122+
dayStyle: const TextStyle(color: AppColors.textPrimary),
123+
yearStyle: const TextStyle(color: AppColors.textPrimary),
124+
),
125+
),
126+
child: child ?? const SizedBox(),
127+
);
128+
},
109129
);
110130

111131
if (date != null) {
@@ -117,6 +137,23 @@ class __ScheduleWorkoutDialogState
117137
final time = await showTimePicker(
118138
context: context,
119139
initialTime: TimeOfDay.now(),
140+
builder: (context, child) {
141+
return Theme(
142+
data: Theme.of(context).copyWith(
143+
useMaterial3: true,
144+
timePickerTheme: TimePickerThemeData(
145+
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
146+
hourMinuteTextColor: AppColors.textPrimary,
147+
hourMinuteColor: AppColors.primary.withValues(alpha: 0.1),
148+
dialHandColor: AppColors.primary,
149+
dialBackgroundColor: AppColors.surfaceLight,
150+
entryModeIconColor: AppColors.textSecondary,
151+
helpTextStyle: const TextStyle(color: AppColors.textPrimary),
152+
),
153+
),
154+
child: child ?? const SizedBox(),
155+
);
156+
},
120157
);
121158

122159
if (time != null) {

0 commit comments

Comments
 (0)