Skip to main content
Stac SelectableText allows you to build the Flutter SelectableText widget using JSON. To know more about the SelectableText widget in Flutter, refer to the official documentation.

Properties

PropertyTypeDescription
dataStringThe text to display.
childrenList<StacTextSpan>The list of text spans to display.
styleStacTextStyle?The style to apply to the text.
textAlignTextAlign?The alignment of the text.
textDirectionTextDirection?The direction of the text.
textScaleFactordouble?Deprecated. Use textScaler instead.
textScalerdouble?The font scaling strategy to use.
showCursorbool?Whether to show the cursor.
autofocusbool?Whether to autofocus the widget.
minLinesint?The minimum number of lines to display.
maxLinesint?The maximum number of lines to display.
cursorWidthdouble?The width of the cursor.
cursorHeightdouble?The height of the cursor.
cursorRadiusdouble?The radius of the cursor.
cursorColorString?The color of the cursor.
enableInteractiveSelectionbool?Whether to enable interactive selection.
onTapStacAction?The action to perform when the text is tapped.
semanticsLabelString?The semantics label for the text.
textWidthBasisTextWidthBasis?The width basis for the text.
selectionColorString?The color of the text selection.
[!NOTE] textScaleFactor is deprecated. Use textScaler instead. Example migration: textScaler: 1.5 corresponds to TextScaler.linear(1.5).

Example JSON

{
  "type": "selectableText",
  "data": "This is a selectable text",
  "style": {
    "fontSize": 18,
    "fontWeight": "w600"
  },
  "showCursor": true,
  "cursorColor": "#FF0000"
}