Skip to main content

TextField

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

Properties​

PropertyTypeDescription
decorationStacInputDecoration?The decoration to show around the text field.
initialValueStringThe initial value to be set in the text field.
keyboardTypeStacTextInputType?The type of keyboard to use for editing the text.
textInputActionTextInputAction?The action button to use for the keyboard.
textCapitalizationTextCapitalizationHow the text should be capitalized.
styleStacTextStyle?The style to use for the text being edited.
textAlignTextAlignHow the text should be aligned horizontally.
textAlignVerticalStacTextAlignVertical?How the text should be aligned vertically.
textDirectionTextDirection?The direction in which the text flows.
readOnlyboolWhether the text field is read-only.
showCursorbool?Whether to show the cursor.
expandsboolWhether the text field should expand to fill its parent.
autofocusboolWhether the text field should focus itself if nothing else is already focused.
obscuringCharacterStringThe character to use when obscuring text.
maxLinesint?The maximum number of lines for the text to span.
minLinesint?The minimum number of lines for the text to span.
maxLengthint?The maximum number of characters to allow in the text field.
obscureTextboolWhether to hide the text being edited.
enableSuggestionsboolWhether to show input suggestions as the user types.
enabledbool?Whether the text field is enabled.
cursorWidthdoubleThe width of the cursor.
cursorHeightdouble?The height of the cursor.
cursorColorString?The color of the cursor.
hintTextString?The hint text to display when the text field is empty.
inputFormattersList<StacInputFormatter>The list of input formatters to apply to the text field.

Example JSON​

{
"type": "textField",
"initialValue": "Enter text here",
"decoration": {
"hintText": "Enter your name"
},
"style": {
"color": "#000000",
"fontSize": 16.0
},
"textAlign": "center",
"obscureText": false,
"maxLength": 50
}