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 get visible dates details from the Flutter Calendar

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

In Flutter Event calendar, you can get the details of visible dates using the onViewChanged callback of the flutter calendar widget.

Step 1

In initState(), initialize the default values.

String? _startDate, _endDate;
Color? _headerColor, _viewHeaderColor, _calendarColor;
void initState() {
  _startDate = '';
  _endDate = '';


Step 2

Trigger the onViewChanged callback of the calendar widget and get the visible dates details through the viewChangedDetails.

  child: SfCalendar(
    ViewHeaderStyle(backgroundColor: _viewHeaderColor),
    allowedViews: [
    backgroundColor: _calendarColor,
    view: CalendarView.week,
    monthViewSettings: MonthViewSettings(showAgenda: true),
    dataSource: getCalendarDataSource(),
    onViewChanged: viewChanged,
void viewChanged(ViewChangedDetails viewChangedDetails) {
  _startDate = DateFormat('dd, MMMM yyyy')
  _endDate = DateFormat('dd, MMMM yyyy')
      .visibleDates[viewChangedDetails.visibleDates.length - 1])
  SchedulerBinding.instance!.addPostFrameCallback((duration) {
    setState(() {});


View sample in Github

Flutter calendar visible dates


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