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

Properties

StacInputDecoration

decoration supports Flutter input decoration fields such as labelText, hintText, prefixIcon, suffixIcon, borders, fill colors, and floatingLabelBehavior.

Input Formatters

Use inputFormatters to restrict or transform user input. The supported formatter type values are allow, deny, and mask.

Validator Rules

Use validatorRules to validate user input. Each entry is a StacFormFieldValidator with a rule, an optional message shown when validation fails, and an optional options map for parameterized rules. Validators are powered by the flutter_validators package.
flutter_validators treats an empty string as invalid (e.g. isEmail('') is false), so any field with validatorRules is effectively required — an empty value fails validation. There is no built-in “validate only when filled” option. For an optional field, omit validatorRules; if you need conditional validation, handle the blank-input check in your app before applying the rules.
No-argument rules: isAlpha, isAlphanumeric, isAscii, isBase32, isBase58, isBoolean, isCreditCard, isDate, isDecimal, isEmail, isFQDN, isHexColor, isHexadecimal, isInt, isIP, isJson, isJWT, isLatLong, isLowercase, isMACAddress, isMD5, isMongoId, isNumeric, isOctal, isPhone, isPort, isSemVer, isSlug, isUppercase, isURL, isUUID. Parameterized rules (read arguments from options): The matches rule matches the pattern anywhere in the value, so anchor it with ^...$ for a full-string match. The compare rule is useful for confirm-password fields. Remember that every rule fails on empty input, so a field carrying any of these rules is treated as required.

Example