0

I wanna hide (or change the position) today button in SfCalendar in Flutter, but I couldn't find any way to hide the button, here is my code:

 Widget buildDayViewCalendar(
    bool writePermission,
    Club? currentClub,
    DateTime selectedDate,
  ) {
    int courtLength = currentClub == null ? 0 : currentClub.courts.length;

return MouseRegionWidget(
  controller: _controller,
  child: SfCalendar(
    headerDateFormat: 'MMM d, yyyy',
    headerHeight: 230,
    viewHeaderHeight: 0,
    initialSelectedDate: selectedDate,
    initialDisplayDate: selectedDate,
    view: CalendarView.day,
    controller: _controller,
    timeSlotViewSettings: TimeSlotViewSettings(
      timeInterval: const Duration(minutes: 30),
      timeFormat: 'h:mm',
      numberOfDaysInView: min(5, courtLength),
    ),
    dataSource: _getReservationByClubId(),
    showDatePickerButton: true,
    showNavigationArrow: false,
    allowViewNavigation: true,
    allowDragAndDrop: true,
    onTap: writePermission ? _onTap : null,
    specialRegions: DateUtil().getTimeRegions(currentClub),
  ),
);
  }
Abbas Jafari
  • 1,492
  • 2
  • 16
  • 28
  • 1
    Its already discussed here but no accepted answer: https://stackoverflow.com/questions/72747464/flutter-sfcalender-hide-today-button – Muhammad Saqlain Apr 01 '23 at 09:41
  • 1
    Be aware that the SyncFusion products in the Dart/Flutter pub are *not* open source. They are released under a commercial license that may subject you or your organization to a financial liability, and might affect downstream re-users of your code. – Randal Schwartz Apr 01 '23 at 09:53

3 Answers3

1

There is no option for this issue, if you use this code showDatePickerButton: false,, you will not be able to open date picker.

Abbas Jafari
  • 1,492
  • 2
  • 16
  • 28
0

Try with these properties. This should hide the button, but have to trade off with the day selection option.

 showDatePickerButton: false,
 showNavigationArrow: true,
 allowViewNavigation: true,
 allowDragAndDrop: true,
0

You can achieve your requirement by setting the “showDatePickerButton” as false in the Flutter Calendar. Refer to the below link for more details about the showDatePickerButton property in the calendar,

https://pub.dev/documentation/syncfusion_flutter_calendar/latest/calendar/SfCalendar/showDatePickerButton.html

We hope that helps! Let us know if you have any other queries.