Skip to content

Commit

Permalink
feat: show today's events by default
Browse files Browse the repository at this point in the history
  • Loading branch information
rainaarya committed Dec 5, 2023
1 parent 79f10e5 commit 6c329f1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/app/views/screens/schedule/schedule.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<MySchedulesScreen> createState() => _MySchedulesScreenState();
}

class _MySchedulesScreenState extends State<MySchedulesScreen> {
DateTime _initialSelectedDate = DateTime.now();

@override
Widget build(BuildContext context) {
return Scaffold(
Expand All @@ -31,6 +34,8 @@ class _MySchedulesScreenState extends State<MySchedulesScreen> {
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 ||
Expand All @@ -52,7 +57,13 @@ class _MySchedulesScreenState extends State<MySchedulesScreen> {
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),
),
Expand Down

0 comments on commit 6c329f1

Please sign in to comment.