Add multi calendar support and protected web app
This commit is contained in:
@@ -166,6 +166,7 @@ class EventInput {
|
||||
required this.start,
|
||||
required this.date,
|
||||
required this.personId,
|
||||
required this.appCalendarId,
|
||||
required this.note,
|
||||
required this.hasTodos,
|
||||
required this.todos,
|
||||
@@ -175,6 +176,7 @@ class EventInput {
|
||||
final String start;
|
||||
final DateTime date;
|
||||
final String? personId;
|
||||
final String? appCalendarId;
|
||||
final String note;
|
||||
final bool hasTodos;
|
||||
final List<String> todos;
|
||||
@@ -184,11 +186,13 @@ class EventAddDialog extends StatefulWidget {
|
||||
const EventAddDialog({
|
||||
super.key,
|
||||
required this.people,
|
||||
required this.appCalendars,
|
||||
this.event,
|
||||
this.todoSuggestions = const [],
|
||||
});
|
||||
|
||||
final List<Person> people;
|
||||
final List<AppCalendar> appCalendars;
|
||||
final CalendarEvent? event;
|
||||
final List<String> todoSuggestions;
|
||||
|
||||
@@ -205,6 +209,7 @@ class _EventAddDialogState extends State<EventAddDialog> {
|
||||
late bool hasTodos;
|
||||
late List<String> todos;
|
||||
String? personId;
|
||||
String? appCalendarId;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -219,6 +224,7 @@ class _EventAddDialogState extends State<EventAddDialog> {
|
||||
hasTodos = event?.hasTodos ?? false;
|
||||
todos = [...event?.todos ?? const <String>[]];
|
||||
personId = event?.personId == everyonePersonId ? null : event?.personId;
|
||||
appCalendarId = event?.appCalendarId;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -303,6 +309,28 @@ class _EventAddDialogState extends State<EventAddDialog> {
|
||||
],
|
||||
onChanged: (value) => setState(() => personId = value),
|
||||
),
|
||||
if (widget.appCalendars.isNotEmpty) ...[
|
||||
const SizedBox(height: 12),
|
||||
DropdownButtonFormField<String?>(
|
||||
initialValue: appCalendarId,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Melyik napt\u00e1rban legyen?',
|
||||
),
|
||||
items: [
|
||||
const DropdownMenuItem<String?>(
|
||||
value: null,
|
||||
child: Text('F\u0151 csal\u00e1di napt\u00e1r'),
|
||||
),
|
||||
...widget.appCalendars.map(
|
||||
(calendar) => DropdownMenuItem<String?>(
|
||||
value: calendar.id,
|
||||
child: Text(calendar.name),
|
||||
),
|
||||
),
|
||||
],
|
||||
onChanged: (value) => setState(() => appCalendarId = value),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 12),
|
||||
TextField(
|
||||
controller: note,
|
||||
@@ -503,6 +531,7 @@ class _EventAddDialogState extends State<EventAddDialog> {
|
||||
start: start.text,
|
||||
date: eventDate,
|
||||
personId: personId,
|
||||
appCalendarId: appCalendarId,
|
||||
note: note.text,
|
||||
hasTodos: cleanTodos.isNotEmpty,
|
||||
todos: cleanTodos,
|
||||
|
||||
Reference in New Issue
Block a user