Skip to content

DatePicker header overflow fix#31327

Closed
filipwin wants to merge 1 commit intoflutter:masterfrom
filipwin:29736-date-picker-header-overflow
Closed

DatePicker header overflow fix#31327
filipwin wants to merge 1 commit intoflutter:masterfrom
filipwin:29736-date-picker-header-overflow

Conversation

@filipwin
Copy link

Description

In this PR I removed constant, hardcoded DatePicker header height. Leaving Container with no specified height enables it to wrap its content and prevent clipping/overflowing.

How it looked:
Screenshot 2019-04-19 at 23 32 21

How it looks now:
Screenshot 2019-04-19 at 23 34 06

Related Issues

#29736
#28778
#29681

@goderbauer goderbauer added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Apr 22, 2019
}

const double _kDatePickerHeaderPortraitHeight = 100.0;
const double _kDatePickerHeaderLandscapeWidth = 168.0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we leaving this one?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither in tickets nor in my tests I found any issues with displaying this picker in the landscape mode, so I didn't touch this value. However, the problem with overflowing won't appear in that case, as the header text is wrapped to second line if it doesn't have enough space. And that's why (I think so, but didn't check it yet) it will need concrete width to avoid stretching this header to fit whole text.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you'll see this problem if you set the text scale factor a bit higher, even in landscape.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with this PR if it really does fix things for portrait even if we leave landscape with a potential problem though. Perfect doesn't have to be the enemy of the good here :)

@dnfield
Copy link
Contributor

dnfield commented Apr 24, 2019

This needs tests. I'm also pretty surprised this didn't break any existing tests.

/cc @darrenaustin who is working on layout stuff for Date Picker.

/cc @willlarche who was getting us some guidance on this control as it's currently broken when text scale is off or when large fonts are used.

@dnfield
Copy link
Contributor

dnfield commented Apr 24, 2019

Does this still look right with a smaller font (the case where it's not currently overflowing)?

@filipwin
Copy link
Author

Does this still look right with a smaller font (the case where it's not currently overflowing)?

I checked it on a couple of devices with different ratios/resolutions/densities & languages and didn't encounter any noticeable difference. I guess it shouldn't break anything, as it will wrap around the actual content, so there might be a couple of pixels difference at most.

This needs tests.

Well, I'm not very experienced with tests yet and I was convinced that changing widget height isn't something actually testable. But if it is, then I'll have a look at this.

@dnfield
Copy link
Contributor

dnfield commented Apr 24, 2019

You should be able to run some tests that change the font scale and verify that it works.

Something like this: https://github.com/flutter/flutter/pull/29734/files#diff-421a3407c743099e7c05ef094015f095

But try it with text scale factors larger than 1.5 as well.

@darrenaustin
Copy link
Contributor

Thanks for your work on this. There were several other layout problems we needed to fix in addition to this one, so I put them all in a single PR #31514 which removes the hard coded constraints on the layouts.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants