Skip to content

Commit

Permalink
Snooze Tile Bottom Overflow & NumberPicker Error Fix: wrapped Column …
Browse files Browse the repository at this point in the history
…widget in a sized box to prevent overflow, then handled 0 or negative values for snooze duration to fix number picker error (#632)
  • Loading branch information
amaydixit11 authored Jan 28, 2025
1 parent ff76222 commit 797e4f4
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ class ShakeToDismiss extends StatelessWidget {
// ' - no more lazy snoozing :)',
description: 'shakeDescription'.tr,
iconData: Icons.vibration_sharp,
isLightMode: themeController.currentTheme.value == ThemeMode.light,
isLightMode:
themeController.currentTheme.value == ThemeMode.light,
);
},
),
Expand Down Expand Up @@ -122,7 +123,8 @@ class ShakeToDismiss extends StatelessWidget {
.textTheme
.displaySmall!
.copyWith(
color: themeController.secondaryTextColor.value,
color: themeController
.secondaryTextColor.value,
),
),
),
Expand Down
93 changes: 54 additions & 39 deletions lib/app/modules/addOrUpdateAlarm/views/snooze_duration_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,49 +36,64 @@ class SnoozeDurationTile extends StatelessWidget {
backgroundColor: themeController.secondaryBackgroundColor.value,
title: 'Select duration'.tr,
titleStyle: Theme.of(context).textTheme.displaySmall,
content: Obx(
() => Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
NumberPicker(
value: controller.snoozeDuration.value,
minValue: 1,
maxValue: 1440,
onChanged: (value) {
Utils.hapticFeedback();
controller.snoozeDuration.value = value;
},
content: SizedBox(
height: MediaQuery.of(context).size.height * 0.3,
child: Obx(
() => Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
NumberPicker(
value: controller.snoozeDuration.value <= 0
? 1
: controller.snoozeDuration
.value, // Handle 0 or negative values
minValue: 1,
maxValue: 1440,
onChanged: (value) {
Utils.hapticFeedback();
controller.snoozeDuration.value = value;
},
),
Text(
controller.snoozeDuration.value > 1
? 'minutes'.tr
: 'minute'.tr,
),
],
),
),
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: ElevatedButton(
onPressed: () {
Utils.hapticFeedback();
Get.back();
},
style: ElevatedButton.styleFrom(
backgroundColor: kprimaryColor,
),
Text(
controller.snoozeDuration.value > 1
? 'minutes'.tr
: 'minute'.tr,
child: Text(
'Done'.tr,
style: Theme.of(context)
.textTheme
.displaySmall!
.copyWith(
color: themeController.secondaryTextColor.value,
),
),
],
),
),
ElevatedButton(
onPressed: () {
Utils.hapticFeedback();
Get.back();
},
style: ElevatedButton.styleFrom(
backgroundColor: kprimaryColor,
),
child: Text(
'Done'.tr,
style: Theme.of(context).textTheme.displaySmall!.copyWith(
color: themeController.secondaryTextColor.value,
),
),
),
),
],
],
),
),
// ),
),
);
},
Expand Down

0 comments on commit 797e4f4

Please sign in to comment.