Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply minimumDate & maximumDate constraints in CupertinoDatePicker date mode #44149

Merged

Conversation

@LongCatIsLooong
Copy link
Contributor

LongCatIsLooong commented Nov 4, 2019

Description

  • Fixed the "grey out invalid years/months/days" logic. The implementation may have minor fidelity issues (as in, the timing of updating all 3 pickers may be different from the native date picker). Will check back once I get a new laptop.
  • Apply minimumDate & maximumDate constraints in date mode. i.e., when scrolled to an invalid date, the CupertinoDatePicker will attempt to scroll to a valid date, which could be either the given minimumDate, the given maximumDate, or the last day of the currently selected month in the currently selected year.

Related Issues

Fixes #24820

Tests

I added the following tests:

  • picker automatically scrolls away from invalid date, and onDateTimeChanged doesn't report these dates
  • initial date honors minimumDate & maximumDate

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (Please read Handling breaking changes). Replace this with a link to the e-mail where you asked for input on this proposed change.
  • No, this is not a breaking change.
WIP
@LongCatIsLooong LongCatIsLooong force-pushed the LongCatIsLooong:date-picker-constraints branch from 848c409 to 5d44789 Nov 4, 2019
Copy link
Contributor

justinmc left a comment

LGTM 👍

@@ -129,20 +130,20 @@ enum CupertinoDatePickerMode {
/// The AM/PM designation is shown only if [CupertinoDatePicker] does not use 24h format.
/// Column order is subject to internationalization.
///
/// Example: [4 | 14 | PM].
/// Example: ` 4 | 14 | PM `.

This comment has been minimized.

Copy link
@justinmc

justinmc Nov 5, 2019

Contributor

Good catch.

@LongCatIsLooong LongCatIsLooong merged commit a9fc9e5 into flutter:master Nov 5, 2019
63 checks passed
63 checks passed
WIP Ready for review
Details
analyze-linux Task Summary
Details
analyze-linux
Details
build_tests-linux Task Summary
Details
build_tests-linux
Details
cla/google All necessary CLAs are signed
customer_testing-linux Task Summary
Details
customer_testing-linux
Details
customer_testing-macos Task Summary
Details
customer_testing-macos
Details
customer_testing-windows Task Summary
Details
customer_testing-windows
Details
deploy_gallery-linux Task Summary
Details
deploy_gallery-linux
Details
deploy_gallery-macos Task Summary
Details
deploy_gallery-macos
Details
docs-linux Task Summary
Details
docs-linux
Details
firebase_test_lab_tests-linux Task Summary
Details
firebase_test_lab_tests-linux
Details
flutter-build
Details
framework_tests-libraries-linux Task Summary
Details
framework_tests-libraries-linux
Details
framework_tests-libraries-macos Task Summary
Details
framework_tests-libraries-macos
Details
framework_tests-libraries-windows Task Summary
Details
framework_tests-libraries-windows
Details
framework_tests-misc-linux Task Summary
Details
framework_tests-misc-linux
Details
framework_tests-misc-macos Task Summary
Details
framework_tests-misc-macos
Details
framework_tests-misc-windows Task Summary
Details
framework_tests-misc-windows
Details
framework_tests-widgets-linux Task Summary
Details
framework_tests-widgets-linux
Details
framework_tests-widgets-macos Task Summary
Details
framework_tests-widgets-macos
Details
framework_tests-widgets-windows Task Summary
Details
framework_tests-widgets-windows
Details
hostonly_devicelab_tests-0-linux Task Summary
Details
hostonly_devicelab_tests-0-linux
Details
hostonly_devicelab_tests-1-linux Task Summary
Details
hostonly_devicelab_tests-1-linux
Details
hostonly_devicelab_tests-2-linux Task Summary
Details
hostonly_devicelab_tests-2-linux
Details
hostonly_devicelab_tests-3_last-linux Task Summary
Details
hostonly_devicelab_tests-3_last-linux
Details
web_tests-0-linux Task Summary
Details
web_tests-0-linux
Details
web_tests-1-linux Task Summary
Details
web_tests-1-linux
Details
web_tests-2-linux Task Summary
Details
web_tests-2-linux
Details
web_tests-3-linux Task Summary
Details
web_tests-3-linux
Details
web_tests-4-linux Task Summary
Details
web_tests-4-linux
Details
web_tests-5-linux Task Summary
Details
web_tests-5-linux
Details
web_tests-6-linux Task Summary
Details
web_tests-6-linux
Details
web_tests-7_last-linux Task Summary
Details
web_tests-7_last-linux
Details
@LongCatIsLooong LongCatIsLooong deleted the LongCatIsLooong:date-picker-constraints branch Nov 5, 2019
sahandevs added a commit to sahandevs/flutter that referenced this pull request Nov 15, 2019
sahandevs added a commit to sahandevs/flutter that referenced this pull request Nov 15, 2019
sahandevs added a commit to sahandevs/flutter that referenced this pull request Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.