main, change toast phrasing to be consistent.
This commit is contained in:
1 parent
65ce0f8135
commit
7f908a7fab
1 file changed
+17
-17
+17
-17
@@ -13,9 +13,9 @@ import 'dart:convert';
|
||||
|
||||
/// TBD:
|
||||
/// v0.3.0
|
||||
/// - Add sunrise section and change app name to Sunshine Alarm?
|
||||
/// - Change sunset grabber to checkbox and retrieve it each alarm or open.
|
||||
/// v1.0.0
|
||||
/// - Follow system theme rather than using a custom theme.
|
||||
/// - Add sunrise section and change app name to Sunshine Alarm?
|
||||
/// :TBD
|
||||
|
||||
void main() async {
|
||||
@@ -133,14 +133,14 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
try {
|
||||
bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
|
||||
if (!serviceEnabled) {
|
||||
_showSnack('Location services are disabled.');
|
||||
_showSnack('Location Services Disabled');
|
||||
return;
|
||||
}
|
||||
LocationPermission permission = await Geolocator.checkPermission();
|
||||
if (permission == LocationPermission.denied) {
|
||||
permission = await Geolocator.requestPermission();
|
||||
if (permission == LocationPermission.denied) {
|
||||
_showSnack('Location permission denied.');
|
||||
_showSnack('Location Permission Denied');
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -152,9 +152,9 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
_lngController.text = position.longitude.toString();
|
||||
});
|
||||
await _savePrefs();
|
||||
_showSnack('Location updated.');
|
||||
_showSnack('Location Updated.');
|
||||
} catch (e) {
|
||||
_showSnack('GPS error: $e');
|
||||
_showSnack('GPS Error: $e');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
final lat = double.tryParse(_latController.text);
|
||||
final lng = double.tryParse(_lngController.text);
|
||||
if (lat == null || lng == null) {
|
||||
_showSnack('Enter valid latitude and longitude first.');
|
||||
_showSnack('Enter Valid Latitude & Longitude');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -180,12 +180,12 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
final timePart = sunsetStr.split('T')[1];
|
||||
setState(() => _sunsetController.text = timePart);
|
||||
await _savePrefs();
|
||||
_showSnack('Sunset: $timePart');
|
||||
_showSnack('Sunset Time Retrieved: $timePart');
|
||||
} else {
|
||||
_showSnack('API error: ${response.statusCode}');
|
||||
_showSnack('API Error: ${response.statusCode}');
|
||||
}
|
||||
} catch (e) {
|
||||
_showSnack('Network error: $e');
|
||||
_showSnack('Network Error: $e');
|
||||
} finally {
|
||||
setState(() => _loading = false);
|
||||
}
|
||||
@@ -205,7 +205,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
// Ensure that Android has the correct alarm permissions.
|
||||
final canSchedule = await android?.canScheduleExactNotifications();
|
||||
if (canSchedule != true) {
|
||||
_showSnack('Permissions not yet granted, requesting...');
|
||||
_showSnack('Permissions Need Granted, Requesting...');
|
||||
await android?.requestExactAlarmsPermission();
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
alarmTime = alarmTime.subtract(Duration(minutes: _minutesBefore));
|
||||
|
||||
if (alarmTime.isBefore(now)) {
|
||||
_showSnack('Alarm time is in the past. Will fire tomorrow.');
|
||||
_showSnack('Alarm Time In Past - Will Start Tomorrow');
|
||||
alarmTime = alarmTime.add(const Duration(days: 1));
|
||||
}
|
||||
|
||||
@@ -242,13 +242,13 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
);
|
||||
_notifications.show(
|
||||
id: _alarmId,
|
||||
title: 'Sunset in ${_minutesBefore} min',
|
||||
body: 'The sun sets at $sunsetText. Time to get ready!',
|
||||
title: 'Sunset in ${_minutesBefore} min!',
|
||||
body: 'The sun sets at $sunsetText.',
|
||||
notificationDetails: const NotificationDetails(linux: linuxDetails),
|
||||
);
|
||||
});
|
||||
_showSnack(
|
||||
'Alarm set for ${alarmTime.hour.toString().padLeft(2, '0')}:${alarmTime.minute.toString().padLeft(2, '0')} (app must stay open)',
|
||||
'Alarm Enabled @ ${alarmTime.hour.toString().padLeft(2, '0')}:${alarmTime.minute.toString().padLeft(2, '0')} (App Must Stay Open!)',
|
||||
);
|
||||
} else if (Platform.isAndroid) {
|
||||
/*** Notifcation Method - Works *** /
|
||||
@@ -300,7 +300,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
// End Alarm Method ***/
|
||||
_showSnack('Alarm Scheduled @ ${alarmTime}');
|
||||
} else {
|
||||
_showSnack('Platform not detected, unsure how to show alarm.');
|
||||
_showSnack('Platform Not Detected - Contact Developer');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -462,7 +462,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: const Icon(Icons.cloud_done_outlined),
|
||||
tooltip: 'Fetch Sunset Time from Open-Meteo',
|
||||
tooltip: 'Fetch Open-Meteo Sunset Data',
|
||||
onPressed: () {
|
||||
if (!_loading) {
|
||||
_fetchSunset();
|
||||
|
||||
Reference in new issue
Block a user