claude refactor
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../../api/mhsl/customTimetableEvent/customTimetableEvent.dart';
|
||||
import '../../../../state/app/modules/timetable/bloc/timetable_bloc.dart';
|
||||
import '../../../../widget/confirmDialog.dart';
|
||||
|
||||
Completer<void> showDeleteCustomEventDialog(BuildContext context, CustomTimetableEvent event) {
|
||||
final completer = Completer<void>();
|
||||
final bloc = context.read<TimetableBloc>();
|
||||
ConfirmDialog(
|
||||
title: 'Termin löschen',
|
||||
content: 'Der ${event.rrule.isEmpty ? "Termin" : "Serientermin"} wird unwiederruflich gelöscht.',
|
||||
confirmButton: 'Löschen',
|
||||
onConfirm: () {
|
||||
bloc.removeCustomEvent(event.id).then(completer.complete).onError((Object error, StackTrace stack) {
|
||||
completer.completeError(error, stack);
|
||||
});
|
||||
},
|
||||
).asDialog(context);
|
||||
return completer;
|
||||
}
|
||||
Reference in New Issue
Block a user