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 the agenda item height in the Flutter Calendar

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 item height using the `agendaItemHeight` property of the `MonthViewSettings` in the calendar widget.

Step 1:

Inside the state initialize the default values for calendar view, item height.

List<String> _size = <String>['60', '50', '40', '30'];
double _itemHeight = 0.0;

Step 2:

Select the item height value from the `PopupMenuItem` and customize the agenda item height using this height value.

appBar: AppBar(
  actions: <Widget>[
    PopupMenuButton<String>(
      icon: Icon(Icons.settings),
      itemBuilder: (BuildContext context) {
        return _size.map((String choice) {
          return PopupMenuItem<String>(
            value: choice,
            child: Text(
              '$choice',
            ),
          );
        }).toList();
      },
      onSelected: (String value) {
        setState(() {
          if (value == '60') {
            _itemHeight = 60;
          } else if (value == '50') {
            _itemHeight = 50;
          } else if (value == '40') {
            _itemHeight = 40;
          } else if (value == '30') {
            _itemHeight = 30;
          } else if (value == '20') {
            _itemHeight = 20;
          }
        });
      },
    ),
  ],
),

 

Step 3:

Assign the item height value to the `agendaItemHeight` property of the `MonthViewSettings` in the calendar widget.

appBar: AppBar(
  actions: <Widget>[
    PopupMenuButton<String>(
      icon: Icon(Icons.settings),
      itemBuilder: (BuildContext context) {
        return _size.map((String choice) {
          return PopupMenuItem<String>(
            value: choice,
            child: Text(
              '$choice',
            ),
          );
        }).toList();
      },
      onSelected: (String value) {
        setState(() {
          if (value == '60') {
            _itemHeight = 60;
          } else if (value == '50') {
            _itemHeight = 50;
          } else if (value == '40') {
            _itemHeight = 40;
          } else if (value == '30') {
            _itemHeight = 30;
          } else if (value == '20') {
            _itemHeight = 20;
          }
        });
      },
    ),
  ],
),

View sample in GitHub

UG link: https://help.syncfusion.com/flutter/calendar/month-view#agenda-item-height

agenda view item height

agenda view item height

agenda view item height

 

ADD COMMENT
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