main, swap the switch with text rather than disabling, allows giving a better error message.
This commit is contained in:
1 parent
436c96285c
commit
0e481f13cc
1 file changed
+16
-11
+16
-11
@@ -79,8 +79,8 @@ class HomeScreen extends StatefulWidget {
|
||||
class _HomeScreenState extends State<HomeScreen> {
|
||||
final _latController = TextEditingController();
|
||||
final _lngController = TextEditingController();
|
||||
final _sunsetController = TextEditingController();
|
||||
final _minutesController = TextEditingController(text: '30');
|
||||
final _sunsetController = TextEditingController(text: "18:00");
|
||||
final _minutesController = TextEditingController(text: "30");
|
||||
|
||||
final FlutterLocalNotificationsPlugin _notifications =
|
||||
FlutterLocalNotificationsPlugin();
|
||||
@@ -559,18 +559,23 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
|
||||
// --- Toggle ---
|
||||
Expanded(
|
||||
child: SwitchListTile(
|
||||
//title: const Text('Enable Sunset Alarm'),
|
||||
title: Text(_alarmEnabled ? 'Sunset Alarm Enabled' : ""),
|
||||
child:
|
||||
_validTime
|
||||
? SwitchListTile(
|
||||
title: Text(
|
||||
_alarmEnabled ? 'Sunset Alarm Enabled' : "",
|
||||
),
|
||||
subtitle: Text(
|
||||
_alarmEnabled
|
||||
_validTime
|
||||
? _alarmEnabled
|
||||
? '${_minutesBefore} Minute${_plural} Before @ $_alarmDisplayTime'
|
||||
: "",
|
||||
: ""
|
||||
: "Add Time",
|
||||
),
|
||||
value: _validTime ? _alarmEnabled : false,
|
||||
// If _isDataLoaded is false, onChanged is null, disabling the switch
|
||||
onChanged: _validTime ? _toggleAlarm : null,
|
||||
),
|
||||
value: _alarmEnabled,
|
||||
onChanged: _toggleAlarm,
|
||||
)
|
||||
: Center(child: Text("Sunset Time Invalid")),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user