Skip to content

Adding week type to the CupertinoDatePicker #171332

@koukibadr

Description

@koukibadr

Use case

Currently, the CupertinoDatePicker widget displays all calendar days by default, allowing users to select any date presented.
While developers can implement logic on the application side to validate or filter selected dates, there's no native mechanism within the widget itself to disable or block specific dates from being presented as selectable options to the user.

This limitation presents a challenge for common application scenarios where users should only be able to interact with a predefined subset of dates. For instance, an appointment booking application needs to guide users to available slots, such as only weekdays or specific dates not marked as holidays or fully booked.

Without native support for disabling dates, developers must display all days, potentially leading to a poor user experience, or implement complex, error-prone filtering logic on the application side to prevent selection of unavailable dates.

Proposal

To address this, I propose introducing a new parameter, weekType, to the CupertinoDatePicker widget.
This parameter would offer a declarative way to control the set of selectable days displayed in the picker, with options such as WeekType.workDays (Monday-Friday), WeekType.weekends (Saturday-Sunday), WeekType.fullWeek (all days), or WeekType.custom. For the WeekType.custom option, developers would provide a List representing the DateTime.weekday values that should be visible and selectable.

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 Flutterf: cupertinoflutter/packages/flutter/cupertino repositoryf: date/time pickerDate or time picker widgetsframeworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionteam-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