flutter
flutter copied to clipboard
Add `InlineSpan.updateAttributes`
Use cases in the framework:
- Service integrations in the framework such as https://github.com/flutter/flutter/blob/ad268e2f89fcfdbb58d15172b9c38a2aa4ce2acd/packages/flutter/lib/src/widgets/spell_check.dart#L312-L414, and https://github.com/flutter/flutter/issues/150068. Since
TextEditingController.buildTextSpanreturns aTextSpan, it's difficult to update the returned span to add new styles without aupdatemethod. - maybe: Linkify
Use cases outside the framework
- Updating an existing
InlineSpanwith new styles, especially when you only have theInlineSpanrepresentation.
Pre-launch Checklist
- [ ] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [ ] I read the Tree Hygiene wiki page, which explains my responsibilities.
- [ ] I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
- [ ] I signed the CLA.
- [ ] I listed at least one issue that this PR fixes in the description above.
- [ ] I updated/added relevant documentation (doc comments with
///). - [ ] I added new tests to check the change I am making, or this PR is test-exempt.
- [ ] I followed the breaking change policy and added Data Driven Fixes where supported.
- [ ] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel on Discord.
Could you add a little more context (e.g. to the PR description or via a linked issue) what you envision this new updateAttributes API to be used for? Are we going to use this in the framework? What will we implement with this? Are regular flutter apps supposed to use it? Why would they do that?
Removed the Either type and switched to using a sentinel value (I wish Either was part of dart:core so we can have syntax sugar that allows us to avoid the explicit use of the Left constructor, so we can fix the "copyWith can't set a property to null" problem, among other things).
Still evaluating some alternatives as I would like to expose more lower level text layout apis, and at the same time some hacks in the PR made the API less appealing (e.g., the removal problem).
(Triage) Confirmed with @LongCatIsLooong this is still on their radar
Hello from triage again! Is this still something you'd like to work on?
Greetings from stale PR triage (again)! 👋 Should we close this PR?