Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,8 @@ class AddOrUpdateAlarmController extends GetxController {
timeToAlarm.value = Utils.timeUntilAlarm(
TimeOfDay.fromDateTime(selectedTime.value),
repeatDays,
ringOn: isFutureDate.value,
alarmDate: selectedDate.value.toString(),
);

repeatDays.value = alarmRecord.value.days;
Expand Down Expand Up @@ -862,6 +864,8 @@ class AddOrUpdateAlarmController extends GetxController {
timeToAlarm.value = Utils.timeUntilAlarm(
TimeOfDay.fromDateTime(selectedTime.value),
repeatDays,
ringOn: isFutureDate.value,
alarmDate: selectedDate.value.toString(),
);

// store initial values of the variables
Expand Down Expand Up @@ -912,7 +916,12 @@ class AddOrUpdateAlarmController extends GetxController {
selectedTime.listen((time) {
debugPrint('CHANGED CHANGED CHANGED CHANGED');
timeToAlarm.value =
Utils.timeUntilAlarm(TimeOfDay.fromDateTime(time), repeatDays);
Utils.timeUntilAlarm(
TimeOfDay.fromDateTime(time),
repeatDays,
ringOn: isFutureDate.value,
alarmDate: selectedDate.value.toString(),
);
_compareAndSetChange('selectedTime', time);
});

Expand Down Expand Up @@ -1553,6 +1562,96 @@ class AddOrUpdateAlarmController extends GetxController {

return int.parse(dialCodeA).compareTo(int.parse(dialCodeB));
}

void showCustomDaysDialog(BuildContext context) {
final List<String> daysOfWeek = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
final List<bool> tempDays = List.from(repeatDays);

Get.dialog(
Dialog(
backgroundColor: themeController.secondaryBackgroundColor.value,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'Select Days',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: themeController.primaryTextColor.value,
),
),
const SizedBox(height: 16),
Wrap(
spacing: 8,
runSpacing: 8,
alignment: WrapAlignment.center,
children: List.generate(
7,
(index) => StatefulBuilder(
builder: (context, setState) {
return InkWell(
onTap: () {
setState(() {
tempDays[index] = !tempDays[index];
});
},
child: CircleAvatar(
backgroundColor: tempDays[index]
? themeController.primaryColor.value
: themeController.secondaryBackgroundColor.value,
child: Text(
daysOfWeek[index],
style: TextStyle(
color: tempDays[index]
? Colors.white
: themeController.primaryTextColor.value,
),
),
),
);
},
),
),
),
const SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
TextButton(
onPressed: () => Get.back(),
child: Text(
'Cancel',
style: TextStyle(
color: themeController.primaryTextColor.value,
),
),
),
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: themeController.primaryColor.value,
),
onPressed: () {
repeatDays.value = tempDays;
daysRepeating.value = Utils.getRepeatDays(repeatDays);
Get.back();
},
child: const Text(
'Save',
style: TextStyle(color: Colors.white),
),
),
],
),
],
),
),
),
);
}
}

class LimitRange extends TextInputFormatter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ import 'package:ultimate_alarm_clock/app/utils/utils.dart';
import '../controllers/add_or_update_alarm_controller.dart';
import 'alarm_date_tile.dart';
import 'guardian_angel.dart';
import 'scheduling_options_tile.dart';
import 'repeat_once_tile.dart';
import 'repeat_tile.dart';
import 'screen_activity_tile.dart';

class AddOrUpdateAlarmView extends GetView<AddOrUpdateAlarmController> {
AddOrUpdateAlarmView({super.key});
Expand Down Expand Up @@ -786,15 +790,7 @@ class AddOrUpdateAlarmView extends GetView<AddOrUpdateAlarmController> {
() => controller.alarmSettingType.value == 0
? Column(
children: [
AlarmDateTile(
controller: controller,
themeController: themeController,
),
Divider(
color: themeController
.primaryDisabledTextColor.value,
),
RepeatTile(
SchedulingOptionsTile(
controller: controller,
themeController: themeController,
),
Expand Down
Loading