Skip to content

Deduplicate SmartText and SmartSelectableText #50

Description

@developerjamiu

smart_text.dart and smart_selectable_text.dart are near-identical. Ignoring the Text versus SelectableText difference, roughly 200 lines are duplicated, including all six span-building branches and the tap handler.

// TODO: Merge the SmartText and SmartSelectableText widgets at smart_text.dart:9 already records this.

The duplication is why the four ignored parameters diverged between the two widgets, and it means every roadmap change (config map, new types, recognizer disposal, caching) has to be made twice, correctly, in both files.

Fix: extract span building into one shared function or a shared base State, leaving each widget with its constructor and its choice of Text or SelectableText.

Worth doing before the type expansion rather than after.

Found during the v0.4.0 codebase audit.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestplatform: dartAffects the shared Dart layer

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions