Skip to content

Commit 8d1c939

Browse files
kushchoudhary98Kush Choudhary
andauthored
fix: incorrect weekdays & 'Daily' checkbox in repeat_tile widget (#682)
* [Fixed]: Incorrect weekdays selection * fix: checkbox of buildDailyTile --------- Co-authored-by: Kush Choudhary <[email protected]>
1 parent 0e0bc9f commit 8d1c939

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class RepeatTile extends StatelessWidget {
2222
var height = Get.height;
2323
var width = Get.width;
2424

25-
2625
return Obx(
2726
() => InkWell(
2827
onTap: () {
@@ -172,7 +171,15 @@ class RepeatTile extends StatelessWidget {
172171
activeColor: kprimaryColor.withOpacity(0.8),
173172
value: controller.isDailySelected.value,
174173
onChanged: (value) {
175-
// This onChanged can be empty, as we handle the tap in InkWell
174+
Utils.hapticFeedback();
175+
controller
176+
.setIsDailySelected(!controller.isDailySelected.value);
177+
178+
// Update repeatDays based on isDailySelected value
179+
for (int i = 0; i < controller.repeatDays.length; i++) {
180+
controller.repeatDays[i] =
181+
controller.isDailySelected.value;
182+
}
176183
},
177184
),
178185
],
@@ -364,9 +371,9 @@ class RepeatTile extends StatelessWidget {
364371

365372
// Update repeatDays based on isWeekdaysSelected value
366373
for (int i = 0; i < controller.repeatDays.length; i++) {
367-
// Assuming weekdays are from Monday to Friday (index 0 to 5)
374+
// Assuming weekdays are from Monday to Friday (index 0 to 4)
368375
controller.repeatDays[i] =
369-
controller.isWeekdaysSelected.value && i >= 0 && i < 5;
376+
controller.isWeekdaysSelected.value && i >= 0 && i <= 4;
370377
}
371378
},
372379
child: Padding(
@@ -394,11 +401,11 @@ class RepeatTile extends StatelessWidget {
394401

395402
// Update repeatDays based on isWeekdaysSelected value
396403
for (int i = 0; i < controller.repeatDays.length; i++) {
397-
// Assuming weekdays are from Monday to Friday (index 1 to 5)
404+
// Assuming weekdays are from Monday to Friday (index 0 to 4)
398405
controller.repeatDays[i] =
399406
controller.isWeekdaysSelected.value &&
400-
i >= 1 &&
401-
i <= 5;
407+
i >= 0 &&
408+
i <= 4;
402409
}
403410
},
404411
),

0 commit comments

Comments
 (0)