Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79578de1f7 | ||
|
|
183634dee5 |
No files matched your search
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.8 KiB |
@@ -327,18 +327,26 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
if (value) {
|
||||
await _scheduleAlarm();
|
||||
} else {
|
||||
_alarmTimer?.cancel();
|
||||
if (!Platform.isLinux) {
|
||||
// Notification Method
|
||||
if (ANDROID_USE_NOTIF) await _notifications.cancel(id: _alarmId);
|
||||
|
||||
// Alarm Method
|
||||
if (ANDROID_USE_ALARM) await Alarm.stop(_alarmId);
|
||||
}
|
||||
_showSnack('Alarm Cancelled');
|
||||
_stopAlarm();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _stopAlarm() async {
|
||||
if (Platform.isLinux) {
|
||||
_alarmTimer?.cancel();
|
||||
} else if (Platform.isAndroid) {
|
||||
// Notification Method
|
||||
if (ANDROID_USE_NOTIF) {
|
||||
await _notifications.cancel(id: _alarmId);
|
||||
}
|
||||
// Alarm Method
|
||||
if (ANDROID_USE_ALARM) {
|
||||
await Alarm.stop(_alarmId);
|
||||
}
|
||||
}
|
||||
_showSnack('Alarm Cancelled');
|
||||
}
|
||||
|
||||
void _showSnack(String msg) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(msg)));
|
||||
}
|
||||
@@ -462,6 +470,9 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
),
|
||||
),
|
||||
onChanged: (v) {
|
||||
if (v == "") {
|
||||
_stopAlarm();
|
||||
}
|
||||
final val = _validateTime(v);
|
||||
if (val == null) {
|
||||
_savePrefs();
|
||||
@@ -538,10 +549,15 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
subtitle: Text(
|
||||
_alarmEnabled
|
||||
? '${_minutesBefore} Minute${_plural} Before @ $_alarmDisplayTime'
|
||||
: '',
|
||||
: (_sunsetController.text == ""
|
||||
? "Time Missing"
|
||||
: ""),
|
||||
),
|
||||
value: _alarmEnabled,
|
||||
onChanged: _toggleAlarm,
|
||||
value:
|
||||
_sunsetController.text != "" ? _alarmEnabled : false,
|
||||
// If _isDataLoaded is false, onChanged is null, disabling the switch
|
||||
onChanged:
|
||||
_sunsetController.text != "" ? _toggleAlarm : null,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||