-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Constrain date picker to max width to avoid bending outwards #120827
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
Constrain date picker to max width to avoid bending outwards #120827
Conversation
|
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. Changes reported for pull request #120827 at sha 7cbc11a0ffb69d31e128dd5853b27715f5890d6a |
7cbc11a to
a4a4806
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Container has an alignment args in its constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the other picker need the same treatmeant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe move the logic to _DatePickerLayoutDelegate so you don't have to copy paste it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved the majority of the logic to _DatePickerLayoutDelegate. 👍
ccaae2d to
e6ff872
Compare
e6ff872 to
d5a2396
Compare
…#120827) Constrain date picker to max width to avoid bending outwards
|
|
||
| // The wheel does not bend outwards at large widths. | ||
| expect( | ||
| distance >= (octoberX - decemberX), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test didn't actually work because of a bug - fixed it here https://github.com/flutter/flutter/pull/121342/files#r1148615910
Addresses #119071. At large widths, the picker will expand outwards in order to fill the space and will lose the look of being a wheel. In order to avoid this, this PR constrains the max width to either our default based off of native, or a width estimated based off of the widths of the columns, if bigger than the default. Similarly, the native date picker wheel does not use up the whole width.
Before:

After:

A native iOS date picker wheel (left) and the new Flutter CupertinoDatePicker unbounded in an app. Both have a width that does not take up the whole available space.

Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.