#26 Listview of custom timetable events
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:bottom_sheet/bottom_sheet.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -135,6 +137,26 @@ class AppointmentDetails {
|
||||
);
|
||||
}
|
||||
|
||||
static Completer deleteCustomEvent(BuildContext context, CustomTimetableEvent appointment) {
|
||||
Completer future = Completer();
|
||||
ConfirmDialog(
|
||||
title: "Termin löschen",
|
||||
content: "Der ${appointment.rrule.isEmpty ? "Termin" : "Serientermin"} wird unwiederruflich gelöscht.",
|
||||
confirmButton: "Löschen",
|
||||
onConfirm: () {
|
||||
RemoveCustomTimetableEvent(
|
||||
RemoveCustomTimetableEventParams(
|
||||
appointment.id
|
||||
)
|
||||
).run().then((value) {
|
||||
Provider.of<TimetableProps>(context, listen: false).run(renew: true);
|
||||
future.complete();
|
||||
});
|
||||
},
|
||||
).asDialog(context);
|
||||
return future;
|
||||
}
|
||||
|
||||
static void _custom(BuildContext context, TimetableProps webuntisData, CustomTimetableEvent appointment) {
|
||||
_bottomSheet(
|
||||
context,
|
||||
@ -169,21 +191,7 @@ class AppointmentDetails {
|
||||
),
|
||||
TextButton.icon(
|
||||
onPressed: () {
|
||||
ConfirmDialog(
|
||||
title: "Termin löschen",
|
||||
content: "Der ${appointment.rrule.isEmpty ? "Termin" : "Serientermin"} wird unwiederruflich gelöscht.",
|
||||
confirmButton: "Löschen",
|
||||
onConfirm: () {
|
||||
RemoveCustomTimetableEvent(
|
||||
RemoveCustomTimetableEventParams(
|
||||
appointment.id
|
||||
)
|
||||
).run().then((value) {
|
||||
Navigator.of(context).pop();
|
||||
Provider.of<TimetableProps>(context, listen: false).run(renew: true);
|
||||
});
|
||||
},
|
||||
).asDialog(context);
|
||||
deleteCustomEvent(context, appointment).future.then((value) => Navigator.of(context).pop());
|
||||
},
|
||||
label: const Text("Löschen"),
|
||||
icon: const Icon(Icons.delete_outline),
|
||||
@ -214,7 +222,7 @@ class AppointmentDetails {
|
||||
ListTile(
|
||||
leading: const CenteredLeading(Icon(Icons.rule)),
|
||||
title: const Text("RRule"),
|
||||
subtitle: Text(appointment.rrule),
|
||||
subtitle: Text(appointment.rrule.isEmpty ? "Keine" : appointment.rrule),
|
||||
)
|
||||
),
|
||||
DebugTile(context).jsonData(appointment.toJson()),
|
||||
|
Reference in New Issue
Block a user