dart format
This commit is contained in:
@@ -27,7 +27,8 @@ class Timetable extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _TimetableState extends State<Timetable> {
|
||||
final GlobalKey<CustomWorkWeekCalendarState> _calendarKey = GlobalKey<CustomWorkWeekCalendarState>();
|
||||
final GlobalKey<CustomWorkWeekCalendarState> _calendarKey =
|
||||
GlobalKey<CustomWorkWeekCalendarState>();
|
||||
|
||||
List<Appointment>? _cachedAppointments;
|
||||
int? _lastDataVersion;
|
||||
@@ -53,7 +54,10 @@ class _TimetableState extends State<Timetable> {
|
||||
}
|
||||
|
||||
List<Appointment> _appointments(TimetableState state) {
|
||||
final timetableSettings = context.watch<SettingsCubit>().val().timetableSettings;
|
||||
final timetableSettings = context
|
||||
.watch<SettingsCubit>()
|
||||
.val()
|
||||
.timetableSettings;
|
||||
if (_cachedAppointments != null &&
|
||||
_lastDataVersion == state.dataVersion &&
|
||||
identical(_lastTimetableSettings, timetableSettings)) {
|
||||
@@ -81,7 +85,11 @@ class _TimetableState extends State<Timetable> {
|
||||
bool _isOnInitialWeek(TimetableState state) {
|
||||
final target = _initialDisplayDate();
|
||||
final targetMonday = target.subtract(Duration(days: target.weekday - 1));
|
||||
final mondayOnly = DateTime(targetMonday.year, targetMonday.month, targetMonday.day);
|
||||
final mondayOnly = DateTime(
|
||||
targetMonday.year,
|
||||
targetMonday.month,
|
||||
targetMonday.day,
|
||||
);
|
||||
return state.startDate == mondayOnly;
|
||||
}
|
||||
|
||||
@@ -105,7 +113,10 @@ class _TimetableState extends State<Timetable> {
|
||||
itemBuilder: (_) => const [
|
||||
PopupMenuItem(
|
||||
value: _CalendarAction.addEvent,
|
||||
child: ListTile(title: Text('Kalendereintrag hinzufügen'), leading: Icon(Icons.add)),
|
||||
child: ListTile(
|
||||
title: Text('Kalendereintrag hinzufügen'),
|
||||
leading: Icon(Icons.add),
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: _CalendarAction.viewEvents,
|
||||
@@ -142,9 +153,14 @@ class _TimetableState extends State<Timetable> {
|
||||
appointments: appointments,
|
||||
timeRegions: regions,
|
||||
initialDate: _initialDisplayDate(),
|
||||
minDate: DateTime.now().subtract(const Duration(days: 14)).nextWeekday(DateTime.sunday),
|
||||
maxDate: DateTime.now().add(const Duration(days: 7)).nextWeekday(DateTime.saturday),
|
||||
onAppointmentTap: (apt) => AppointmentDetailsDispatcher.show(context, bloc, apt),
|
||||
minDate: DateTime.now()
|
||||
.subtract(const Duration(days: 14))
|
||||
.nextWeekday(DateTime.sunday),
|
||||
maxDate: DateTime.now()
|
||||
.add(const Duration(days: 7))
|
||||
.nextWeekday(DateTime.saturday),
|
||||
onAppointmentTap: (apt) =>
|
||||
AppointmentDetailsDispatcher.show(context, bloc, apt),
|
||||
onWeekChanged: (start, end) => bloc.changeWeek(start, end),
|
||||
isCrossedOut: _isCrossedOut,
|
||||
onCreateEvent: _onCreateEventAt,
|
||||
@@ -154,7 +170,8 @@ class _TimetableState extends State<Timetable> {
|
||||
void _onCreateEventAt(DateTime start, DateTime end) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => CustomEventEditDialog(initialStart: start, initialEnd: end),
|
||||
builder: (_) =>
|
||||
CustomEventEditDialog(initialStart: start, initialEnd: end),
|
||||
barrierDismissible: false,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user