Compare commits
3
Commits
e6951b4c25
...
2c3e52ba53
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c3e52ba53 | ||
|
|
62af007799 | ||
|
|
8f3afc3bd7 |
@@ -168,14 +168,27 @@ 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(
|
||||||
request: alarmRequest,
|
children: [
|
||||||
onChanged: (updated) {
|
Expanded(
|
||||||
setState(() {
|
child: AlarmForm(
|
||||||
alarmRequests[index] = updated;
|
request: alarmRequest,
|
||||||
});
|
onChanged: (updated) {
|
||||||
},
|
setState(() {
|
||||||
|
alarmRequests[index] = updated;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () => setState(() {
|
||||||
|
alarmRequests.removeAt(index);
|
||||||
|
}),
|
||||||
|
icon: Icon(Icons.close),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
|
SizedBox(height: 120),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -191,32 +204,34 @@ class _TaskEditPageState extends State<TaskEditPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onSavePressed() {
|
void onSavePressed() {
|
||||||
Navigator.of(context).pop(
|
if (formKey.currentState!.validate()) {
|
||||||
CreateTaskRequest(
|
Navigator.of(context).pop(
|
||||||
title: titleController.text,
|
CreateTaskRequest(
|
||||||
description: descriptionController.text,
|
title: titleController.text,
|
||||||
start: null,
|
description: descriptionController.text,
|
||||||
due: DateTime.tryParse(
|
start: null,
|
||||||
'${dueDateController.text} ${dueTimeController.text}'.trim(),
|
due: DateTime.tryParse(
|
||||||
|
'${dueDateController.text} ${dueTimeController.text}'.trim(),
|
||||||
|
),
|
||||||
|
isCompleted: false,
|
||||||
|
category: categoryController.text,
|
||||||
|
subtasks: [],
|
||||||
|
url: urlController.text,
|
||||||
|
alarms: alarmRequests.map<Alarm>((e) {
|
||||||
|
if (e is CreateFixedTimeAlarmRequest) {
|
||||||
|
return e.toAlarm(generateId());
|
||||||
|
}
|
||||||
|
if (e is CreateRelativeTimeAlarmRequest) {
|
||||||
|
return e.toAlarm(generateId());
|
||||||
|
}
|
||||||
|
if (e is LocationAlarm) {
|
||||||
|
return e.toAlarm(generateId());
|
||||||
|
}
|
||||||
|
throw TypeError();
|
||||||
|
}).toList(),
|
||||||
),
|
),
|
||||||
isCompleted: false,
|
);
|
||||||
category: categoryController.text,
|
}
|
||||||
subtasks: [],
|
|
||||||
url: urlController.text,
|
|
||||||
alarms: alarmRequests.map<Alarm>((e) {
|
|
||||||
if (e is CreateFixedTimeAlarmRequest) {
|
|
||||||
return e.toAlarm(generateId());
|
|
||||||
}
|
|
||||||
if (e is CreateRelativeTimeAlarmRequest) {
|
|
||||||
return e.toAlarm(generateId());
|
|
||||||
}
|
|
||||||
if (e is LocationAlarm) {
|
|
||||||
return e.toAlarm(generateId());
|
|
||||||
}
|
|
||||||
throw TypeError();
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onPopInvoked(bool didPop, Object? result) {
|
void onPopInvoked(bool didPop, Object? result) {
|
||||||
|
|||||||
@@ -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,
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user