-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Tight Paragraph Width #30988
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
Tight Paragraph Width #30988
Conversation
7388ae2 to
524ee15
Compare
|
This will have to wait for the corresponding engine PR to go in before its tests can pass (flutter/engine#8530). |
cde425f to
889578a
Compare
889578a to
835b529
Compare
|
It might be best to change the naming for the sake of consistency. Stacks have a fit parameter whose value is StackFit (enum). Since this feature is for Text: maybe Text.fit and TextFit, where TextFit is either expand or tight. |
|
I do think that the word |
|
@GaryQian How about TextFitWidth and Text.fitWidth? |
|
Maybe TextWidthFit sounds a bit more natural? I'm not totally convinced on the |
|
is this related/the same issue? #15300 |
|
Yes, #15300 seems to be the same issue. Adding to the desc. Hixie called it "longestLine" which also seems to make sense... |
|
OK, I propose that we call the enum |
f3764d8 to
51e8b4a
Compare
51e8b4a to
0c8e994
Compare
|
This is ready for a final review. // The current behavior, unchanged.
// A short single line is wrapped tightly.
// Multiple lines cause the text to take the full width of its parent.
Text(
string,
textWidthBasis: TextWidthBasis.parent, //default
)// For a single line, the behavior is the same! Tightly wrapped.
// For multiple lines, the width is only the width of the longest line.
Text(
string,
textWidthBasis: TextWidthBasis.longestLine,
) |
|
The tests are failing because they think Do I need to wait for something else? |
|
Sometimes the luci engine buildbots haven't caught up yet, i'd check https://ci.chromium.org/p/flutter/builders/luci.flutter.prod/Linux%20Host%20Engine Although it does look like everything is caught up. It is also strange that everything else worked, but those specific ones failed as if the engine build was bad, many of the other tests should have failed too |
|
@dnfield After merging in your addition of |
|
It looks like it ran from the output. Are we sure 6280d42 is the right engine hash? |
|
Yeah that hash should be fine. The engine commit I need is flutter/engine@3493dcf, which looks to be about 5 days older than 6280d42. |
|
I'm going to go ahead and merge this and see what happens. If anything fails then I'll immediately revert. |
|
SGTM. |

Closes #26585, #15300
Depends on flutter/engine#8530
Paragraph currently sets its width to be the maximum space allowed for it when it wraps beyond one line. This creates extra empty space when you want to draw something with a tight container:
This PR will enable the drawing of a paragraph with a width only as wide as it needs to be to contain wrapping text tightly.