Skip to content

Conversation

@huanghui1998hhh
Copy link
Contributor

I want to build a widget that adds some extra functionality when the inner text overflow. So the problem occurred, I can't find an elegant way to determine if the text is overflowing.
So i expose didExceedMaxLines from RenderParagraph, I think it can make sense. Have there some advice?

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@text-exemption-reviewers" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@google-cla
Copy link

google-cla bot commented Dec 12, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@github-actions github-actions bot added the framework flutter/packages/flutter repository. See also f: labels. label Dec 12, 2023
@LongCatIsLooong
Copy link
Contributor

Could you add a test to verify the method works?

@huanghui1998hhh
Copy link
Contributor Author

I added the test. But have a question to ask for some advice, i just want to expose a property, is applying for exemption better?

Copy link
Contributor

@LongCatIsLooong LongCatIsLooong left a comment

Choose a reason for hiding this comment

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

LGTM

@LongCatIsLooong
Copy link
Contributor

I added the test. But have a question to ask for some advice, i just want to expose a property, is applying for exemption better?

Pull requests that add new code usually aren't eligible for test exemptions, as long as they introduce testable logic. In this case the test may not do much but it seems to be pretty straightforward to write. Thanks for adding one!

@huanghui1998hhh
Copy link
Contributor Author

I added the test. But have a question to ask for some advice, i just want to expose a property, is applying for exemption better?

Pull requests that add new code usually aren't eligible for test exemptions, as long as they introduce testable logic. In this case the test may not do much but it seems to be pretty straightforward to write. Thanks for adding one!

I understand, thank you~

Comment on lines +1037 to +1041
Copy link
Member

Choose a reason for hiding this comment

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

Consider copying the comment from TextPainter.didExceedMaxLines?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe that's enough. Indicate its source and rough explanation.

@huanghui1998hhh huanghui1998hhh force-pushed the expose_didExceedMaxLines branch from 7ef0bf6 to 9edfe61 Compare December 21, 2023 05:10
test('limited by ellipsis', () {
final RenderParagraph paragraph = createRenderParagraph(overflow: TextOverflow.ellipsis);
layout(paragraph, constraints: const BoxConstraints(maxWidth: 100.0));
expect(paragraph.didExceedMaxLines, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this right? maxLines is null in this test, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Due to this, TextPainter.didExceedMaxLines

If [maxLines] is null, this is true if [ellipsis] is not the empty string and there was a line that overflowed the maxWidth argument passed to [layout]; otherwise it is false.

So that's right.

In previous commit, i add some comment for this. Then inspired by @AlexV525 , i think it's TextPainter.didExceedMaxLines's behavior, maybe doesn't need to be repeated here.

@AlexV525 AlexV525 added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 28, 2023
@auto-submit auto-submit bot merged commit b0b0e42 into flutter:master Dec 28, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 28, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 28, 2023
CoderDake pushed a commit to CoderDake/flutter that referenced this pull request Dec 28, 2023
I want to build a widget that adds some extra functionality when the inner text overflow. So the problem occurred, I can't find an elegant way to determine if the text is overflowing. 
So i expose `didExceedMaxLines` from `RenderParagraph`, I think it can make sense. Have there some advice?
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 29, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 29, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 30, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 30, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 31, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 2, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 2, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 2, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 2, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 2, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 3, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 4, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 5, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants