Skip to content

Commit 797e4f4

Browse files
authored
Snooze Tile Bottom Overflow & NumberPicker Error Fix: wrapped Column widget in a sized box to prevent overflow, then handled 0 or negative values for snooze duration to fix number picker error (#632)
1 parent ff76222 commit 797e4f4

File tree

2 files changed

+58
-41
lines changed

2 files changed

+58
-41
lines changed

lib/app/modules/addOrUpdateAlarm/views/shake_to_dismiss_tile.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ class ShakeToDismiss extends StatelessWidget {
4949
// ' - no more lazy snoozing :)',
5050
description: 'shakeDescription'.tr,
5151
iconData: Icons.vibration_sharp,
52-
isLightMode: themeController.currentTheme.value == ThemeMode.light,
52+
isLightMode:
53+
themeController.currentTheme.value == ThemeMode.light,
5354
);
5455
},
5556
),
@@ -122,7 +123,8 @@ class ShakeToDismiss extends StatelessWidget {
122123
.textTheme
123124
.displaySmall!
124125
.copyWith(
125-
color: themeController.secondaryTextColor.value,
126+
color: themeController
127+
.secondaryTextColor.value,
126128
),
127129
),
128130
),

lib/app/modules/addOrUpdateAlarm/views/snooze_duration_tile.dart

Lines changed: 54 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -36,49 +36,64 @@ class SnoozeDurationTile extends StatelessWidget {
3636
backgroundColor: themeController.secondaryBackgroundColor.value,
3737
title: 'Select duration'.tr,
3838
titleStyle: Theme.of(context).textTheme.displaySmall,
39-
content: Obx(
40-
() => Column(
41-
children: [
42-
Padding(
43-
padding: const EdgeInsets.symmetric(vertical: 10.0),
44-
child: Row(
45-
mainAxisAlignment: MainAxisAlignment.center,
46-
crossAxisAlignment: CrossAxisAlignment.center,
47-
children: [
48-
NumberPicker(
49-
value: controller.snoozeDuration.value,
50-
minValue: 1,
51-
maxValue: 1440,
52-
onChanged: (value) {
53-
Utils.hapticFeedback();
54-
controller.snoozeDuration.value = value;
55-
},
39+
content: SizedBox(
40+
height: MediaQuery.of(context).size.height * 0.3,
41+
child: Obx(
42+
() => Column(
43+
mainAxisAlignment: MainAxisAlignment.center,
44+
mainAxisSize: MainAxisSize.min,
45+
children: [
46+
Padding(
47+
padding: const EdgeInsets.symmetric(vertical: 10.0),
48+
child: Row(
49+
mainAxisAlignment: MainAxisAlignment.center,
50+
crossAxisAlignment: CrossAxisAlignment.center,
51+
children: [
52+
NumberPicker(
53+
value: controller.snoozeDuration.value <= 0
54+
? 1
55+
: controller.snoozeDuration
56+
.value, // Handle 0 or negative values
57+
minValue: 1,
58+
maxValue: 1440,
59+
onChanged: (value) {
60+
Utils.hapticFeedback();
61+
controller.snoozeDuration.value = value;
62+
},
63+
),
64+
Text(
65+
controller.snoozeDuration.value > 1
66+
? 'minutes'.tr
67+
: 'minute'.tr,
68+
),
69+
],
70+
),
71+
),
72+
Padding(
73+
padding: const EdgeInsets.only(bottom: 10),
74+
child: ElevatedButton(
75+
onPressed: () {
76+
Utils.hapticFeedback();
77+
Get.back();
78+
},
79+
style: ElevatedButton.styleFrom(
80+
backgroundColor: kprimaryColor,
5681
),
57-
Text(
58-
controller.snoozeDuration.value > 1
59-
? 'minutes'.tr
60-
: 'minute'.tr,
82+
child: Text(
83+
'Done'.tr,
84+
style: Theme.of(context)
85+
.textTheme
86+
.displaySmall!
87+
.copyWith(
88+
color: themeController.secondaryTextColor.value,
89+
),
6190
),
62-
],
63-
),
64-
),
65-
ElevatedButton(
66-
onPressed: () {
67-
Utils.hapticFeedback();
68-
Get.back();
69-
},
70-
style: ElevatedButton.styleFrom(
71-
backgroundColor: kprimaryColor,
72-
),
73-
child: Text(
74-
'Done'.tr,
75-
style: Theme.of(context).textTheme.displaySmall!.copyWith(
76-
color: themeController.secondaryTextColor.value,
77-
),
91+
),
7892
),
79-
),
80-
],
93+
],
94+
),
8195
),
96+
// ),
8297
),
8398
);
8499
},

0 commit comments

Comments
 (0)