Skip to main content
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
decorationStacInputDecorationThe decoration to show around the text field.
initialValueStringThe initial value to be set in the text field.
keyboardTypeStacTextInputTypeThe type of keyboard to use for editing the text.
textInputActionStacTextInputActionThe action button to use for the keyboard.
textCapitalizationStacTextCapitalizationHow the text should be capitalized.
styleStacTextStyleThe style to use for the text being edited.
textAlignStacTextAlignHow the text should be aligned horizontally.
textAlignVerticalStacTextAlignVerticalHow the text should be aligned vertically.
textDirectionStacTextDirectionThe direction in which the text flows.
readOnlyboolWhether the text field is read-only.
showCursorboolWhether 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.
maxLinesintThe maximum number of lines for the text to span.
minLinesintThe minimum number of lines for the text to span.
maxLengthintThe 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.
enabledboolWhether the text field is enabled.
cursorWidthdoubleThe width of the cursor.
cursorHeightdoubleThe height of the cursor.
cursorColorStacColorThe color of the cursor.
hintTextStringThe hint text to display when the text field is empty.
inputFormattersList<StacInputFormatter>The list of input formatters to apply to the text field.

Example

StacTextField(
  initialValue: 'Enter text here',
  decoration: StacInputDecoration(hintText: 'Enter your name'),
  style: StacTextStyle(color: StacColors.black, fontSize: 16.0),
  textAlign: StacTextAlign.center,
  obscureText: false,
  maxLength: 50,
)