Skip to content

Layout paragraph using the appropriate width based on its textWidthBasis#62657

Merged
LongCatIsLooong merged 1 commit intoflutter:masterfrom
LongCatIsLooong:longestLine-width
Aug 4, 2020
Merged

Layout paragraph using the appropriate width based on its textWidthBasis#62657
LongCatIsLooong merged 1 commit intoflutter:masterfrom
LongCatIsLooong:longestLine-width

Conversation

@LongCatIsLooong
Copy link
Copy Markdown
Contributor

@LongCatIsLooong LongCatIsLooong commented Jul 31, 2020

Description

When a TextPainter.textWidthBasis is longestLine, the TextPainter should layout its paraph using the width of its longest line from the 1st layout pass.

Related Issues

Fixes #62550

Tests

I added the following tests:

'textWidthBasis.longestLine confines the width of the paragraph '
'when given loose constraints'

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 read the Tree Hygiene wiki page, which explains my responsibilities.
  • 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

Did any tests fail when you ran them? Please read Handling breaking changes.

  • No, no existing tests failed, so this is not a breaking change.

@flutter-dashboard flutter-dashboard bot added the framework flutter/packages/flutter repository. See also f: labels. label Jul 31, 2020
Copy link
Copy Markdown
Contributor

@GaryQian GaryQian left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Copy Markdown
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Thanks, I probably created this bug when I introduced TextWidthBasis.

newWidth = _applyFloatingPointHack(_paragraph.longestLine);
break;
case TextWidthBasis.parent:
newWidth = maxIntrinsicWidth;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this need to be clamped like it was before?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it gets clamped after the switch.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah I see, thanks.

@LongCatIsLooong LongCatIsLooong merged commit 3bc3ea5 into flutter:master Aug 4, 2020
@LongCatIsLooong LongCatIsLooong deleted the longestLine-width branch August 4, 2020 19:43
Pragya007 pushed a commit to Pragya007/flutter that referenced this pull request Aug 11, 2020
mingwandroid pushed a commit to mingwandroid/flutter that referenced this pull request Sep 6, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

With RTL, the RichText content moves but the widget does not

4 participants