main, continue ensuring actual alarm gets changed if sunset time is changed, add reference to notification icon.
This commit is contained in:
1 parent
4926c869b9
commit
8167c748ff
1 file changed
+8
-3
+8
-3
@@ -193,6 +193,10 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
} finally {
|
} finally {
|
||||||
setState(() => _loading = false);
|
setState(() => _loading = false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_alarmEnabled) {
|
||||||
|
_scheduleAlarm();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer? _alarmTimer;
|
Timer? _alarmTimer;
|
||||||
@@ -303,6 +307,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
title: 'Sunset Alarm',
|
title: 'Sunset Alarm',
|
||||||
body: 'Sun is setting in ${_minutesBefore} minute(s)!',
|
body: 'Sun is setting in ${_minutesBefore} minute(s)!',
|
||||||
stopButton: 'Dismiss',
|
stopButton: 'Dismiss',
|
||||||
|
icon: 'ic_notification',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
await Alarm.set(alarmSettings: settings);
|
await Alarm.set(alarmSettings: settings);
|
||||||
@@ -444,6 +449,9 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
_sunsetController.text,
|
_sunsetController.text,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
if (_alarmEnabled) {
|
||||||
|
_scheduleAlarm();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -476,9 +484,6 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (!_loading) {
|
if (!_loading) {
|
||||||
_fetchSunset();
|
_fetchSunset();
|
||||||
if (_alarmEnabled) {
|
|
||||||
_scheduleAlarm();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in new issue
Block a user