36 lines
1.1 KiB
Dart
36 lines
1.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:syncfusion_flutter_calendar/calendar.dart';
|
|
|
|
import '../../../../api/marianumconnect/queries/timetable_get_element_week/timetable_element_type.dart';
|
|
import '../../../../state/app/modules/timetable/bloc/timetable_state.dart';
|
|
import '../data/arbitrary_appointment.dart';
|
|
import 'custom_event_sheet.dart';
|
|
import 'lesson_sheet.dart';
|
|
|
|
class AppointmentDetailsDispatcher {
|
|
static void show(
|
|
BuildContext context,
|
|
TimetableState? state,
|
|
Appointment appointment, {
|
|
bool canEditSubjectColor = false,
|
|
bool teacherPlan = false,
|
|
void Function(TimetableElementRef element)? onOpenElement,
|
|
}) {
|
|
final id = appointment.id;
|
|
if (id is! ArbitraryAppointment) return;
|
|
|
|
id.when(
|
|
lesson: (entry) => LessonSheet.show(
|
|
context,
|
|
state,
|
|
appointment,
|
|
entry,
|
|
canEditSubjectColor: canEditSubjectColor,
|
|
teacherPlan: teacherPlan,
|
|
onOpenElement: onOpenElement,
|
|
),
|
|
custom: (event) => CustomEventSheet.show(context, event),
|
|
);
|
|
}
|
|
}
|