-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Use case
Providing textWidthBasis: TextWidthBasis.longestLine to a Text widget ensures that the widget's width will fit the width of its text when the text is wrapped, rather than filling leftover width in the parent. However, if the inherited width constraint increases (eg, if its parent's width increases), TextWidthBasis.longestLine prevents the text from unwrapping even though the text no longer exceeds its width constraint.
This can be especially noticeable for mobile device when switching the device orientation from portrait to landscape. Text that needed to wrap in portrait mode remains wrapped in landscape even with significantly more available width and significantly less available height.
Proposal
If this is an unintended consequence of TextWidthBasis.longestLine, then maybe it requires a bugfix. Otherwise, it would be great if we had a third option - something like TextWidthBasis.expandingLongestLine - that constraints the width of the Text widget to the longest line but still determines line wrapping from the width constraint inherited by the parent.