Category / Section
How to customize the appointment height in schedule view of the Flutter Calendar
1 min read
In the Flutter Event Calendar, you can customize the height of the appointment in schedule view using appointmentItemHeight property of the ScheduleViewSettings.
By using hideEmptyScheduleWeek property of the ScheduleViewSettings, you can hide the week doesn’t have appointments.
child: SfCalendar( view: CalendarView.schedule, dataSource: getCalendarDataSource(), scheduleViewSettings: ScheduleViewSettings( appointmentItemHeight: 70, hideEmptyScheduleWeek: true), )))); _DataSource getCalendarDataSource() { final List<Appointment> appointments = <Appointment>[]; appointments.add(Appointment( startTime: DateTime.now().add(const Duration(hours: 4, days: -1)), endTime: DateTime.now().add(const Duration(hours: 5, days: -1)), subject: 'Release Meeting', color: Colors.lightBlueAccent, )); appointments.add(Appointment( startTime: DateTime.now().add(const Duration(hours: 2, days: -2)), endTime: DateTime.now().add(const Duration(hours: 4, days: -2)), subject: 'Performance check', color: Colors.amber, )); appointments.add(Appointment( startTime: DateTime.now().add(const Duration(hours: 6, days: -3)), endTime: DateTime.now().add(const Duration(hours: 7, days: -3)), subject: 'Support', color: Colors.green, )); appointments.add(Appointment( startTime: DateTime.now().add(const Duration(hours: 6, days: 2)), endTime: DateTime.now().add(const Duration(hours: 7, days: 2)), subject: 'Retrospective', color: Colors.purple, )); return _DataSource(appointments); }