diff --git a/lib/view/pages/timetable/custonTimetableColors.dart b/lib/view/pages/timetable/customTimetableColors.dart similarity index 75% rename from lib/view/pages/timetable/custonTimetableColors.dart rename to lib/view/pages/timetable/customTimetableColors.dart index bd21695..060bf0c 100644 --- a/lib/view/pages/timetable/custonTimetableColors.dart +++ b/lib/view/pages/timetable/customTimetableColors.dart @@ -1,7 +1,8 @@ import 'package:flutter/material.dart'; -import 'package:marianum_mobile/theming/darkAppTheme.dart'; -enum CustomTimetableColors{ +import '../../../theming/darkAppTheme.dart'; + +enum CustomTimetableColors { orange, red, green, @@ -9,6 +10,8 @@ enum CustomTimetableColors{ } class TimetableColors { + static const CustomTimetableColors defaultColor = CustomTimetableColors.orange; + static ColorModeDisplay getDisplayOptions(CustomTimetableColors color) { switch(color) { case CustomTimetableColors.green: @@ -26,8 +29,8 @@ class TimetableColors { } } - static Color getColorFromString(String color){ - return getDisplayOptions(CustomTimetableColors.values.firstWhere((element) => element.name == color, orElse: () => CustomTimetableColors.orange)).color; + static Color getColorFromString(String color) { + return getDisplayOptions(CustomTimetableColors.values.firstWhere((element) => element.name == color, orElse: () => TimetableColors.defaultColor)).color; } } diff --git a/lib/view/pages/timetable/customTimetableEventEditDialog.dart b/lib/view/pages/timetable/customTimetableEventEditDialog.dart index 4d925ce..c25fd82 100644 --- a/lib/view/pages/timetable/customTimetableEventEditDialog.dart +++ b/lib/view/pages/timetable/customTimetableEventEditDialog.dart @@ -4,7 +4,6 @@ import 'dart:developer'; import 'package:flutter/material.dart'; import 'package:jiffy/jiffy.dart'; import 'package:marianum_mobile/extensions/dateTime.dart'; -import 'package:marianum_mobile/view/pages/timetable/custonTimetableColors.dart'; import 'package:provider/provider.dart'; import 'package:rrule_generator/rrule_generator.dart'; import 'package:time_range_picker/time_range_picker.dart'; @@ -17,6 +16,7 @@ import '../../../api/mhsl/customTimetableEvent/update/updateCustomTimetableEvent import '../../../model/accountData.dart'; import '../../../model/timetable/timetableProps.dart'; import '../../../widget/infoDialog.dart'; +import 'customTimetableColors.dart'; class CustomTimetableEventEditDialog extends StatefulWidget { final CustomTimetableEvent? existingEvent; @@ -35,7 +35,7 @@ class _AddCustomTimetableEventDialogState extends State element.name == widget.existingEvent?.color, - orElse: () => CustomTimetableColors.orange + orElse: () => TimetableColors.defaultColor ); late bool isEditingExisting = widget.existingEvent != null; diff --git a/lib/view/pages/timetable/timetable.dart b/lib/view/pages/timetable/timetable.dart index 415513f..c7068fb 100644 --- a/lib/view/pages/timetable/timetable.dart +++ b/lib/view/pages/timetable/timetable.dart @@ -3,7 +3,6 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:marianum_mobile/extensions/dateTime.dart'; -import 'package:marianum_mobile/view/pages/timetable/custonTimetableColors.dart'; import 'package:provider/provider.dart'; import 'package:syncfusion_flutter_calendar/calendar.dart'; @@ -18,6 +17,7 @@ import '../../../widget/placeholderView.dart'; import 'appointmenetComponent.dart'; import 'appointmentDetails.dart'; import 'arbitraryAppointment.dart'; +import 'customTimetableColors.dart'; import 'customTimetableEventEditDialog.dart'; import 'timeRegionComponent.dart'; import 'timetableEvents.dart'; @@ -290,7 +290,7 @@ class _TimetableState extends State { location: customEvent.description, subject: customEvent.title, recurrenceRule: customEvent.rrule, - color: TimetableColors.getColorFromString(customEvent.color ?? CustomTimetableColors.orange.name), + color: TimetableColors.getColorFromString(customEvent.color ?? TimetableColors.defaultColor.name), startTimeZone: '', endTimeZone: '', );