diff --git a/lib/main.dart b/lib/main.dart index 9a45e73..8bd76ef 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -20,6 +20,8 @@ import 'package:flutter/services.dart' show rootBundle; /// TBD: /// - Add other languages (Spanish, Croatian) /// v1.1.0 +/// - Move the switchtile back to its own row so that it handles titles better. +/// v1.2.0 /// - Change sunset grabber to checkbox and retrieve it each alarm or open. /// v2.0.0 /// - Add sunrise section and change app name to Sunshine Alarm? @@ -270,11 +272,10 @@ class _HomeScreenState extends State { ); } else if (Platform.isAndroid) { // Get the Notifications permission: - final android = - _notifications - .resolvePlatformSpecificImplementation< - AndroidFlutterLocalNotificationsPlugin - >(); + final android = _notifications + .resolvePlatformSpecificImplementation< + AndroidFlutterLocalNotificationsPlugin + >(); await android?.requestNotificationsPermission(); // Ensure that Android has the correct alarm permissions. @@ -492,10 +493,9 @@ class _HomeScreenState extends State { '${picked.hour.toString().padLeft(2, '0')}:' '${picked.minute.toString().padLeft(2, '0')}'; setState( - () => - _sunsetErrorText = _validateTime( - _sunsetController.text, - ), + () => _sunsetErrorText = _validateTime( + _sunsetController.text, + ), ); if (_alarmEnabled) { _scheduleAlarm(); @@ -523,14 +523,13 @@ class _HomeScreenState extends State { ), const SizedBox(width: 8), IconButton.filledTonal( - icon: - _loading - ? const SizedBox( - width: 20, - height: 20, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.cloud_done_outlined), + icon: _loading + ? const SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : const Icon(Icons.cloud_done_outlined), tooltip: 'Fetch Open-Meteo Sunset Data', onPressed: () { if (!_loading) { @@ -553,7 +552,7 @@ class _HomeScreenState extends State { children: [ if (!_alarmEnabled) Expanded( - flex: _validTime ? 6 : 4, + flex: 1, // _validTime ? 3 : 2, child: TextField( controller: _minutesController, keyboardType: TextInputType.number, @@ -587,24 +586,24 @@ class _HomeScreenState extends State { // --- Toggle --- Expanded( - flex: _validTime ? 7 : 5, + flex: 1, //_validTime ? 2 : 5, child: SwitchListTile( title: Center( child: Text( _validTime ? _alarmEnabled - ? "Sunset Alarm Enabled" - : "Enable" - : "Disabled", + ? "Sunset Alarm Enabled" + : "" //"Enable" + : "", // "Disabled", ), ), subtitle: Center( child: Text( _validTime ? _alarmEnabled - ? "${_minutesBefore} Minute${_plural} Before @ $_alarmDisplayTime" - : "Sunset Alarm" - : "Enter Time", + ? "${_minutesBefore} Minute${_plural} Before @ $_alarmDisplayTime" + : "" //"Sunset Alarm" + : "", //"Enter Valid Time", ), ), value: _validTime ? _alarmEnabled : false, @@ -640,11 +639,10 @@ final _plugin = FlutterLocalNotificationsPlugin(); Future requestPermissions() async { if (Platform.isAndroid) { - final android = - _plugin - .resolvePlatformSpecificImplementation< - AndroidFlutterLocalNotificationsPlugin - >(); + final android = _plugin + .resolvePlatformSpecificImplementation< + AndroidFlutterLocalNotificationsPlugin + >(); // Android 13+ — standard notification permission (shows a dialog) await android?.requestNotificationsPermission(); @@ -654,8 +652,7 @@ Future requestPermissions() async { } } -final android = - _plugin - .resolvePlatformSpecificImplementation< - AndroidFlutterLocalNotificationsPlugin - >(); +final android = _plugin + .resolvePlatformSpecificImplementation< + AndroidFlutterLocalNotificationsPlugin + >();