Skip to content

Add SelectableText widget#35

Open
flakerimi wants to merge 1 commit intoShaftUI:mainfrom
flakerimi:feat/selectable-text
Open

Add SelectableText widget#35
flakerimi wants to merge 1 commit intoShaftUI:mainfrom
flakerimi:feat/selectable-text

Conversation

@flakerimi
Copy link
Copy Markdown

@flakerimi flakerimi commented Mar 16, 2026

Summary

  • Adds SelectableText widget to ShaftKit — a read-only text widget that supports user selection and copy
  • Built on top of EditableText with readOnly: true, hidden cursor, and text selection gesture support
  • Includes a Playground demo page with examples: basic usage, styled text, multiline, custom selection color, and comparison with regular Text

Details

SelectableText mirrors Flutter's SelectableText — it wraps EditableText configured as read-only with selection enabled. Supports:

  • style, textAlign, textDirection, maxLines
  • selectionColor for custom highlight color
  • onSelectionChanged callback
  • focusNode for focus management
  • Inherits from DefaultTextStyle

Test plan

  • Build compiles without errors
  • Playground page renders and text is selectable via click-and-drag
  • Styled and multiline variants work correctly
  • Custom selection color applies
  • Regular Text remains non-selectable for comparison

A read-only text widget that supports user selection and copy,
built on top of EditableText with readOnly mode. Includes a
playground page demonstrating basic usage, styling, multiline,
and custom selection colors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant