Améliorations UI
This commit is contained in:
@ -94,9 +94,11 @@ class _CalendarPageState extends State<CalendarPage> {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
: const Center(
|
: Center(
|
||||||
child:
|
child: _selectedDay != null
|
||||||
Text('Sélectionnez un événement pour voir les détails'),
|
? Text('Aucun événement ne démarre à cette date')
|
||||||
|
: const Text(
|
||||||
|
'Sélectionnez un événement pour voir les détails'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -126,6 +128,12 @@ class _CalendarPageState extends State<CalendarPage> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (_selectedEvent == null && _selectedDay != null)
|
||||||
|
Expanded(
|
||||||
|
child: Center(
|
||||||
|
child: Text('Aucun événement ne démarre à cette date'),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -156,9 +164,21 @@ class _CalendarPageState extends State<CalendarPage> {
|
|||||||
calendarFormat: _calendarFormat,
|
calendarFormat: _calendarFormat,
|
||||||
events: eventProvider.events,
|
events: eventProvider.events,
|
||||||
onDaySelected: (selectedDay, focusedDay) {
|
onDaySelected: (selectedDay, focusedDay) {
|
||||||
|
final eventsForDay = eventProvider.events
|
||||||
|
.where((event) =>
|
||||||
|
event.startDateTime.year == selectedDay.year &&
|
||||||
|
event.startDateTime.month == selectedDay.month &&
|
||||||
|
event.startDateTime.day == selectedDay.day)
|
||||||
|
.toList()
|
||||||
|
..sort((a, b) => a.startDateTime.compareTo(b.startDateTime));
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectedDay = selectedDay;
|
_selectedDay = selectedDay;
|
||||||
_focusedDay = focusedDay;
|
_focusedDay = focusedDay;
|
||||||
|
if (eventsForDay.isNotEmpty) {
|
||||||
|
_selectedEvent = eventsForDay.first;
|
||||||
|
} else {
|
||||||
|
_selectedEvent = null;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onFormatChanged: (format) {
|
onFormatChanged: (format) {
|
||||||
|
Reference in New Issue
Block a user