flutter icon indicating copy to clipboard operation
flutter copied to clipboard

Add `InlineSpan.updateAttributes`

Open LongCatIsLooong opened this issue 1 year ago • 2 comments
trafficstars

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.buildTextSpan returns a TextSpan, it's difficult to update the returned span to add new styles without a update method.
  • maybe: Linkify

Use cases outside the framework

  • Updating an existing InlineSpan with new styles, especially when you only have the InlineSpan representation.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

LongCatIsLooong avatar Aug 23 '24 17:08 LongCatIsLooong

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?

goderbauer avatar Aug 26 '24 19:08 goderbauer

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).

LongCatIsLooong avatar Aug 27 '24 22:08 LongCatIsLooong

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).

LongCatIsLooong avatar Dec 17 '24 23:12 LongCatIsLooong

(Triage) Confirmed with @LongCatIsLooong this is still on their radar

Piinks avatar Feb 26 '25 00:02 Piinks

Hello from triage again! Is this still something you'd like to work on?

Piinks avatar Apr 30 '25 22:04 Piinks

Greetings from stale PR triage (again)! 👋 Should we close this PR?

Piinks avatar Sep 15 '25 21:09 Piinks