Skip to content

Possibility to customize day template when using showDatePicker() #68106

Closed
flutter/packages
#12587

Description

@enricobenedos

Good morning,

actually our team is facing a problem with Flutter calendar widget.
There is no possibility to change the template of calendar days when using showDatePicker().

The idea is to have 1 new function in the showDatePicker() definition that is called when widget is showed in order to have the possibility to define the day template, something like:

final DateTime picked = await showDatePicker(
      context: context,
      locale: const Locale("it", "IT"),
      initialDate: _selectedDate,
      firstDate: DateTime.now(),
      lastDate: DateTime(2101),
      selectableDayPredicate: (date) {
        // If not Sunday or Saturday return day as clicable
        if (date.weekday != 6 && date.weekday != 7) {
          return true;
        }
        return false;
      },
      //New function called during single day widget build
      dayTemplateBuilder: (date) {
        //... my custom logic
        return BoxDecoration(); //Decoration();
      }
    );

With this implementation Flutter users can simply customize this widget for example to highlight days in which there are some appointments.

Thanks

Activity

  1. added
    p: material_uimaterial_ui package in flutter/packages
    frameworkflutter/packages/flutter repository. See also f: labels.
    c: proposalA detailed proposal for a change to Flutter
    c: new featureNothing broken; request for a new capability
    on Oct 15, 2020
  2. HansMuller commented on Oct 15, 2020

    @HansMuller
    Contributor
  3. enricobenedos commented on Sep 28, 2021

    @enricobenedos
    Author

    Hello @HansMuller,
    is there any update about this feature? I say that it has not too much priority.

  4. darrenaustin commented on Oct 4, 2021

    @darrenaustin
    Contributor

    @enricobenedos, sorry we haven't had the chance to really evaluate this. It seems like a reasonable request, but would need some design. Should this builder function only create a decoration for the date, or should it include the text as well? If it is just the decoration, then there might be color contrast issues with the text on whatever background the decoration has. There might also be issues with highlights or other effects when the date is selected. It would also need to handle the highlighting focus for keyboard navigation.

    This is probably not going to be investigated right now, as we have other higher priority tasks. If we get enough feedback about this, we can take another look. Also, if someone if willing to put in the work to open a pull request that adds such a feature we would be more than happy to review it.

  5. awatson32 commented on Sep 26, 2022

    @awatson32

    Was searching for ways to customize the allowable/selectable days in the CalendarDatePicker. Right now, if the date has appointments available, we had feedback that the contrast to that of the non available days is not enough.
    Screen Shot 2022-09-26 at 12 05 05 PM

  6. added
    P3Issues that are less important to the Flutter project
    on Mar 17, 2025
  7. added
    packageflutter/packages repository. See also p: labels.
    and removed
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Aug 17, 2026
  8. Kitamura-Hisao commented on Aug 20, 2026

    @Kitamura-Hisao

    I’m interested in working on this issue.

    I’m considering adding dayBuilder and weekdayBuilder APIs so that individual date cells and weekday headers can be customized while still allowing callers to reuse the default child widget.

    Proposed signatures:

    typedef CalendarDatePickerDayBuilder = Widget Function(
      BuildContext context,
      DateTime day,
      Set<WidgetState> states,
      Widget child,
    );
    
    
    typedef CalendarDatePickerWeekdayBuilder = Widget Function(
      BuildContext context,
      int weekday,
      Widget child,
    );

    The idea is to pass the default child to the builder, allowing callers to customize the presentation without having to recreate the default date or weekday content.

    Would this direction be acceptable?
    Also, should weekday customization be included in the same change, or handled separately?

  9. github-actions commented on Nov 5, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  10. locked as resolved and limited conversation to collaborators on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterp: material_uimaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.team-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions