refactored timetable
This commit is contained in:
@@ -15,17 +15,28 @@ import 'custom_event_colors.dart';
|
||||
|
||||
class CustomEventEditDialog extends StatefulWidget {
|
||||
final CustomTimetableEvent? existingEvent;
|
||||
final DateTime? initialStart;
|
||||
final DateTime? initialEnd;
|
||||
|
||||
const CustomEventEditDialog({this.existingEvent, super.key});
|
||||
const CustomEventEditDialog({
|
||||
this.existingEvent,
|
||||
this.initialStart,
|
||||
this.initialEnd,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
State<CustomEventEditDialog> createState() => _CustomEventEditDialogState();
|
||||
}
|
||||
|
||||
class _CustomEventEditDialogState extends State<CustomEventEditDialog> {
|
||||
late DateTime _date = widget.existingEvent?.startDate ?? DateTime.now();
|
||||
late TimeOfDay _startTime = widget.existingEvent?.startDate.toTimeOfDay() ?? const TimeOfDay(hour: 8, minute: 0);
|
||||
late TimeOfDay _endTime = widget.existingEvent?.endDate.toTimeOfDay() ?? const TimeOfDay(hour: 9, minute: 30);
|
||||
late DateTime _date = widget.existingEvent?.startDate ?? widget.initialStart ?? DateTime.now();
|
||||
late TimeOfDay _startTime = widget.existingEvent?.startDate.toTimeOfDay() ??
|
||||
widget.initialStart?.toTimeOfDay() ??
|
||||
const TimeOfDay(hour: 8, minute: 0);
|
||||
late TimeOfDay _endTime = widget.existingEvent?.endDate.toTimeOfDay() ??
|
||||
widget.initialEnd?.toTimeOfDay() ??
|
||||
const TimeOfDay(hour: 9, minute: 30);
|
||||
late final TextEditingController _name = TextEditingController(text: widget.existingEvent?.title);
|
||||
late final TextEditingController _description = TextEditingController(text: widget.existingEvent?.description);
|
||||
late String _rrule = widget.existingEvent?.rrule ?? '';
|
||||
@@ -167,13 +178,20 @@ class _CustomEventEditDialogState extends State<CustomEventEditDialog> {
|
||||
const Divider(),
|
||||
RRuleGenerator(
|
||||
config: RRuleGeneratorConfig(
|
||||
headerEnabled: true,
|
||||
weekdayBackgroundColor: Theme.of(context).colorScheme.secondary,
|
||||
weekdaySelectedBackgroundColor: Theme.of(context).primaryColor,
|
||||
weekdayColor: Colors.black,
|
||||
selectDayStyle: RRuleSelectDayStyle(
|
||||
dayStyle: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
dayTextStyle: const TextStyle(color: Colors.black),
|
||||
selectedDayStyle: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Theme.of(context).primaryColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
initialRRule: _rrule,
|
||||
textDelegate: const GermanRRuleTextDelegate(),
|
||||
locale: RRuleLocale.de_DE,
|
||||
onChange: (newValue) {
|
||||
log('Rule: $newValue');
|
||||
setState(() => _rrule = newValue);
|
||||
|
||||
Reference in New Issue
Block a user