Skip to main content

TextButton

The Stac Text Button allows you to build a Flutter text button widget using JSON. To know more about the text button widget in Flutter, refer to the official documentation.

Properties​

PropertyTypeDescription
onPressedMap<String, dynamic>?The callback that is called when the button is tapped.
onLongPressMap<String, dynamic>?The callback that is called when the button is long-pressed.
onHoverMap<String, dynamic>?The callback that is called when the button is hovered over.
onFocusChangeMap<String, dynamic>?The callback that is called when the button's focus changes.
styleStacButtonStyle?The style to apply to the button.
autofocusboolWhether the button should be focused when the page is loaded. Defaults to false.
clipBehaviorClipDetermines how the content should be clipped. Defaults to Clip.none.
iconAlignmentIconAlignmentDetermines the alignment of the icon within the widgets. Defaults to IconAlignment.start.
isSemanticButtonboolDetermine whether this subtree represents a button. Defaults to true.
childMap<String, dynamic>The widget to display inside the button.

Example JSON​

{
"type": "textButton",
"onPressed": {},
"onLongPress": {},
"onHover": {},
"onFocusChange": {},
"style": {
"backgroundColor": "#FFC107",
"foregroundColor": "#000000"
},
"autofocus": false,
"clipBehavior": "none",
"child": {
"type": "text",
"data": "Click Me!"
}
}