Articles in this section
Category / Section

How to autofit the calendar to screen height in the Flutter Calendar

1 min read

In the Flutter Event Calendar, you can autofit the calendar time intervals to screen height by using the timeIntervalHeight property value as -1 of the TimeSlotViewSettings.

import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart';
 
void main() => runApp(AutoFitCalendar());
 
class AutoFitCalendar extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        debugShowCheckedModeBanner: false,
        home: Scaffold(
            body: SafeArea(
                child: SfCalendar(
          view: CalendarView.day,
          allowedViews: <CalendarView>[
            CalendarView.day,
            CalendarView.week,
            CalendarView.workWeek
          ],
          timeSlotViewSettings: TimeSlotViewSettings(timeIntervalHeight: -1),
        ))));
  }
}

View sample in GitHub

          Day view

day view

 

           Week view

week view

 

     Work week view

work week view

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied