From aed58f56dcf03338eac44e33a8a198201d7dae7d Mon Sep 17 00:00:00 2001 From: Hyperling Date: Mon, 28 Sep 2026 07:06:43 -0700 Subject: [PATCH] main, add optional timepicker for sunset. --- lib/main.dart | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 734447d..bda138b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -16,8 +16,6 @@ import 'dart:convert'; /// - Add sunrise section and change app name to Sunshine Alarm? /// v1.0.0 /// - 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 void main() async { @@ -408,6 +406,26 @@ class _HomeScreenState extends State { labelText: 'Sunset Time (HH:MM)', border: OutlineInputBorder(), 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) { final val = _validateTime(v);