diff --git a/lib/app/views/screens/schedule/schedule.dart b/lib/app/views/screens/schedule/schedule.dart index 2aea149..95e9e5d 100644 --- a/lib/app/views/screens/schedule/schedule.dart +++ b/lib/app/views/screens/schedule/schedule.dart @@ -10,11 +10,14 @@ import 'meeting_details_page.dart'; class MySchedulesScreen extends StatefulWidget { const MySchedulesScreen({super.key, required this.title}); final String title; + @override State createState() => _MySchedulesScreenState(); } class _MySchedulesScreenState extends State { + DateTime _initialSelectedDate = DateTime.now(); + @override Widget build(BuildContext context) { return Scaffold( @@ -31,6 +34,8 @@ class _MySchedulesScreenState extends State { return SfCalendar( view: CalendarView.month, dataSource: MeetingServiceRepository(snapshot.data!), + initialSelectedDate: _initialSelectedDate, + initialDisplayDate: _initialSelectedDate, monthViewSettings: const MonthViewSettings(showAgenda: true), onTap: (CalendarTapDetails details) { if (details.targetElement == CalendarElement.appointment || @@ -52,7 +57,13 @@ class _MySchedulesScreenState extends State { await Navigator.push( context, MaterialPageRoute( - builder: (context) => const ScheduleMeetingScreen())); + builder: (context) => const ScheduleMeetingScreen() + ) + ); + setState(() { + // Update the calendar to reflect new meetings + _initialSelectedDate = DateTime.now(); + }); }, child: const Icon(Icons.add), ),