-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[flutter_markdown] Use Text.rich to replace RichText in Flutter Markdown #6062
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
Conversation
With this commit, a client can use SelectionArea to handle selected text. When setting `selectable` to false, the Markdown widget renders Text, which can be wrapped in SelectionArea for client-defined behavior (i.e., the Markdown widget no longer consumes the selection event). When setting `selectable` to true, the Markdown widget handles the selection behavior, as before this change. This is related to issue #107073 and issue #113530.
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 "@test-exemption-reviewer" 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. |
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. |
With this commit, a client can use SelectionArea to handle selected text. When setting `selectable` to false, the Markdown widget renders Text, which can be wrapped in SelectionArea for client-defined behavior (i.e., the Markdown widget no longer consumes the selection event). When setting `selectable` to true, the Markdown widget handles the selection behavior, as before this change. This is related to issue #107073 and issue #113530.
Hi, I've now modified all the affected tests and have all checks passed. Could you please merge the PR? |
PTAL @stuartmorgan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this PR, a client can use SelectionArea to handle selected text in Markdown.
[...]
This is related to issue #107073 and issue #113530.
Does it fix 107173? If so, please update the description to say so explicitly.
- I added new tests to check the change I am making, or this PR is test-exempt.
Where is the new test that validates that the change described in the PR is actually working (and does not regress in the future)? I just see boilerplate changes to existing tests.
Thanks for the review, PTAL @stuartmorgan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor changelog nits, but otherwise looks good.
@@ -1,3 +1,7 @@ | |||
## 0.6.19 | |||
|
|||
* Uses `Text.rich` to replace `RichText` so the widget can work with `SelectionArea` when `selectable` set to false. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: is set to false
@@ -1,3 +1,7 @@ | |||
## 0.6.19 | |||
|
|||
* Uses `Text.rich` to replace `RichText` so the widget can work with `SelectionArea` when `selectable` set to false. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Replaces RichText
with Text.rich
@peixinli In the future, please use the autosubmit label; manual merges bypass checks and load balancing, and are strongly discouraged in Flutter. |
Sorry about that. Will do next time! Let me know if you think we need to revert. |
No need for a revert, just something to minimize in the future. |
flutter/packages@9385bbb...a864254 2024-02-14 matanlurey@users.noreply.github.com Allow deprecated members from the Dart SDK/Flutter Framework to roll in (flutter/packages#6111) 2024-02-14 43054281+camsim99@users.noreply.github.com [google_maps_flutter][iOS 12] Skip `testTakeSnapshot` (flutter/packages#6120) 2024-02-13 stuartmorgan@google.com [ci] Allow dependencies on local_auth_ios (flutter/packages#6116) 2024-02-13 40719830+Alex-Usmanov@users.noreply.github.com [url_launcher] Add `InAppBrowserConfiguration` parameter in implementations (flutter/packages#5759) 2024-02-13 16229121+leiatfly@users.noreply.github.com [flutter_markdown] Use Text.rich to replace RichText in Flutter Markdown (flutter/packages#6062) 2024-02-13 97943118+GavrielRosendorn74@users.noreply.github.com [google_maps_flutter][iOS 17] takeSnapshot FIX (flutter/packages#5823) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
With this PR, a client can use 'onSelectionChanged' to handle selected text in Markdown. This provides another way to fix issue [#107073](flutter/flutter#107073), along with the prior solution in [PR/6062](#6062)
With this PR, a client can use SelectionArea to handle selected text in Markdown.
When setting
selectable
to false, the Markdown widget renders Text, which can be wrapped in SelectionArea for client-defined behavior (i.e., the Markdown widget no longer consumes the selection event).When setting
selectable
to true, the Markdown widget handles the selection behavior, as before this change.This fixes issue #107073 and is related to issue #113530.
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.