3 Commits
Author SHA1 Message Date
marco 2c3e52ba53 added spacing at the end of the form and delete button for alarms 2026-07-20 14:52:16 +02:00
marco 62af007799 validate form before saving 2026-07-20 14:40:29 +02:00
marco 8f3afc3bd7 added not empty validator 2026-07-20 14:40:17 +02:00
2 changed files with 50 additions and 33 deletions
+16 -1
View File
@@ -168,7 +168,10 @@ class _TaskEditPageState extends State<TaskEditPage> {
icon: Icon(Icons.location_on), icon: Icon(Icons.location_on),
), ),
for (final (index, alarmRequest) in alarmRequests.indexed) for (final (index, alarmRequest) in alarmRequests.indexed)
AlarmForm( Row(
children: [
Expanded(
child: AlarmForm(
request: alarmRequest, request: alarmRequest,
onChanged: (updated) { onChanged: (updated) {
setState(() { setState(() {
@@ -176,6 +179,16 @@ class _TaskEditPageState extends State<TaskEditPage> {
}); });
}, },
), ),
),
IconButton(
onPressed: () => setState(() {
alarmRequests.removeAt(index);
}),
icon: Icon(Icons.close),
),
],
),
SizedBox(height: 120),
], ],
), ),
], ],
@@ -191,6 +204,7 @@ class _TaskEditPageState extends State<TaskEditPage> {
} }
void onSavePressed() { void onSavePressed() {
if (formKey.currentState!.validate()) {
Navigator.of(context).pop( Navigator.of(context).pop(
CreateTaskRequest( CreateTaskRequest(
title: titleController.text, title: titleController.text,
@@ -218,6 +232,7 @@ class _TaskEditPageState extends State<TaskEditPage> {
), ),
); );
} }
}
void onPopInvoked(bool didPop, Object? result) { void onPopInvoked(bool didPop, Object? result) {
if (!didPop) { if (!didPop) {
@@ -69,7 +69,9 @@ class _FixedTimeAlarmFormState extends State<FixedTimeAlarmForm> {
icon: Icon(Icons.calendar_month), icon: Icon(Icons.calendar_month),
), ),
), ),
validator: dateTimeValidator, validator: (value) {
return notEmptyValidator(value) ?? dateTimeValidator(value);
},
keyboardType: TextInputType.datetime, keyboardType: TextInputType.datetime,
textInputAction: TextInputAction.next, textInputAction: TextInputAction.next,
), ),