We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to customize agenda view height based on the Flutter Calendar widget height

Platform: Flutter |
Control: SfCalendar |
Published Date: February 20, 2020 |
Last Revised Date: May 5, 2021

In the Flutter Event Calendar, you can customize the agenda view height using the `agendaViewHeight` property of `MonthViewSettings` in the calendar widget.

STEP 1: Inside the state, initialize the default values.

final CalendarController _controller=CalendarController();
double _height=0.0;

STEP 2: Use the `MediaQuery` widget to get the height of the device. You can customize the agenda view height based on the height value from the `PopupMenuItem`.

appBar: AppBar(
  actions: <Widget>[
      icon: Icon(Icons.settings),
      itemBuilder: (BuildContext context) {
        return size.map((String choice) {
          return PopupMenuItem<String>(
            value: choice,
            child: Text('$choice',),
      onSelected: (String value) {
        setState(() {
          if (value == '50') {
            _height = MediaQuery.of(context).size.height/2;
          } else if (value == '40') {
            _height = MediaQuery.of(context).size.height/3;
          } else if (value == '30') {
            _height = MediaQuery.of(context).size.height/4;
          } else if (value == '20') {
            _height = MediaQuery.of(context).size.height/5;

STEP 3: Select the height value from the `PopupMenuItem` and assign the height value to the `agendaViewHeight` of `MonthViewSettings` of the calendar widget.

body: Column(
  children: <Widget>[
      child: SfCalendar(
        view: CalendarView.month,
        controller: _controller,
        dataSource: getCalendarDataSource(),
        MonthViewSettings(showAgenda: true, agendaViewHeight: _height),

 View sample in Github






You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile