From 3d3460ef192322786a2b3af256e5a8adfe4f538d Mon Sep 17 00:00:00 2001 From: AhsanSarwar45 Date: Tue, 17 Sep 2024 13:51:20 +0500 Subject: [PATCH] Fix timer picker intitial duration --- lib/timer/widgets/duration_picker.dart | 2 +- lib/timer/widgets/numpad_duration_picker.dart | 7 +++++-- lib/timer/widgets/timer_picker.dart | 2 +- lib/timer/widgets/timer_preset_picker.dart | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/timer/widgets/duration_picker.dart b/lib/timer/widgets/duration_picker.dart index 226fd668..2641a25f 100644 --- a/lib/timer/widgets/duration_picker.dart +++ b/lib/timer/widgets/duration_picker.dart @@ -10,7 +10,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart'; Future showDurationPicker( BuildContext context, { TimeDuration initialTimeDuration = - const TimeDuration(hours: 0, minutes: 5, seconds: 0), + const TimeDuration(hours: 0, minutes: 0, seconds: 0), bool showHours = true, }) async { final theme = Theme.of(context); diff --git a/lib/timer/widgets/numpad_duration_picker.dart b/lib/timer/widgets/numpad_duration_picker.dart index 2a617b1f..cea39231 100644 --- a/lib/timer/widgets/numpad_duration_picker.dart +++ b/lib/timer/widgets/numpad_duration_picker.dart @@ -112,6 +112,7 @@ class _NumpadDurationPickerState extends State { ); } else if (index == 9) { return TimerButton( + isHighlighted: true, label: "00", onTap: () { _addDigit("0", 2); @@ -123,6 +124,7 @@ class _NumpadDurationPickerState extends State { ); } else { return TimerButton( + isHighlighted: true, icon: Icons.backspace_outlined, onTap: _removeDigit, ); @@ -139,9 +141,10 @@ class TimerButton extends StatelessWidget { final String? label; final IconData? icon; final VoidCallback onTap; + final bool isHighlighted; const TimerButton( - {super.key, this.label, required this.onTap, this.icon}); + {super.key, this.label, required this.onTap, this.icon, this.isHighlighted = false}); @override Widget build(BuildContext context) { @@ -153,7 +156,7 @@ class TimerButton extends StatelessWidget { borderRadius: BorderRadius.circular(100), child: Container( decoration: BoxDecoration( - color: colorScheme.onBackground.withOpacity(0.1), + color: isHighlighted ? colorScheme.primary.withOpacity(0.2) : colorScheme.onBackground.withOpacity(0.1), borderRadius: BorderRadius.circular(100), ), child: Center( diff --git a/lib/timer/widgets/timer_picker.dart b/lib/timer/widgets/timer_picker.dart index 81e35163..d99ea7e4 100644 --- a/lib/timer/widgets/timer_picker.dart +++ b/lib/timer/widgets/timer_picker.dart @@ -25,7 +25,7 @@ Future?> showTimerPicker( context: context, builder: (BuildContext context) { ClockTimer timer = ClockTimer.from( - initialTimer ?? ClockTimer(const TimeDuration(minutes: 5))); + initialTimer ?? ClockTimer(const TimeDuration(minutes: 0))); TimerPreset? selectedPreset; List presets = loadListSync("timer_presets"); diff --git a/lib/timer/widgets/timer_preset_picker.dart b/lib/timer/widgets/timer_preset_picker.dart index 2dfe4dc9..1da3804d 100644 --- a/lib/timer/widgets/timer_preset_picker.dart +++ b/lib/timer/widgets/timer_preset_picker.dart @@ -16,7 +16,7 @@ Future showTimerPresetPicker(BuildContext context, context: context, builder: (BuildContext context) { TimerPreset timerPreset = TimerPreset.from(initialTimerPreset ?? - TimerPreset("New Preset", const TimeDuration(minutes: 5))); + TimerPreset("New Preset", const TimeDuration(minutes: 0))); TextEditingController controller = TextEditingController( text: timerPreset.name,