main, add optional timepicker for sunset.
This commit is contained in:
1 parent
db94f3bea1
commit
aed58f56dc
1 file changed
+20
-2
+20
-2
@@ -16,8 +16,6 @@ import 'dart:convert';
|
|||||||
/// - Add sunrise section and change app name to Sunshine Alarm?
|
/// - Add sunrise section and change app name to Sunshine Alarm?
|
||||||
/// v1.0.0
|
/// v1.0.0
|
||||||
/// - Follow system theme rather than using a custom theme.
|
/// - Follow system theme rather than using a custom theme.
|
||||||
/// v1.0.1
|
|
||||||
/// - Use a timepicker if the user clicks on the sunset/sunrise time.
|
|
||||||
/// :TBD
|
/// :TBD
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
@@ -408,6 +406,26 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
labelText: 'Sunset Time (HH:MM)',
|
labelText: 'Sunset Time (HH:MM)',
|
||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(),
|
||||||
errorText: _sunsetErrorText,
|
errorText: _sunsetErrorText,
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
icon: Icon(Icons.access_time),
|
||||||
|
onPressed: () async {
|
||||||
|
final picked = await showTimePicker(
|
||||||
|
context: context,
|
||||||
|
initialTime: TimeOfDay.now(),
|
||||||
|
);
|
||||||
|
if (picked != null) {
|
||||||
|
_sunsetController.text =
|
||||||
|
'${picked.hour.toString().padLeft(2, '0')}:'
|
||||||
|
'${picked.minute.toString().padLeft(2, '0')}';
|
||||||
|
setState(
|
||||||
|
() =>
|
||||||
|
_sunsetErrorText = _validateTime(
|
||||||
|
_sunsetController.text,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
onChanged: (v) {
|
onChanged: (v) {
|
||||||
final val = _validateTime(v);
|
final val = _validateTime(v);
|
||||||
|
|||||||
Reference in new issue
Block a user