resolved pr comments
This commit is contained in:
parent
e40760a07a
commit
90154880d0
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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<CustomTimetableEventEdit
|
||||
late String _recurringRule = widget.existingEvent?.rrule ?? "";
|
||||
late CustomTimetableColors _customTimetableColor = CustomTimetableColors.values.firstWhere(
|
||||
(element) => element.name == widget.existingEvent?.color,
|
||||
orElse: () => CustomTimetableColors.orange
|
||||
orElse: () => TimetableColors.defaultColor
|
||||
);
|
||||
|
||||
late bool isEditingExisting = widget.existingEvent != null;
|
||||
|
@ -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<Timetable> {
|
||||
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: '',
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user