Documentation Index
Fetch the complete documentation index at: https://docs.stac.dev/llms.txt
Use this file to discover all available pages before exploring further.
The Stac Form allows you to build a Flutter form widget using JSON.
To know more about the form widget in Flutter, refer to the official documentation.
Properties
| Property | Type | Description |
|---|
| autovalidateMode | StacAutovalidateMode | The mode to control auto validation. |
| child | StacWidget | The widget to display inside the form. |
Example
StacForm(
autovalidateMode: StacAutovalidateMode.always,
child: StacColumn(
children: [
StacTextFormField(
id: 'username',
decoration: StacInputDecoration(labelText: 'Username'),
),
StacTextFormField(
id: 'password',
decoration: StacInputDecoration(labelText: 'Password'),
),
StacFilledButton(
child: StacText(data: 'Submit'),
onPressed: StacFormValidateAction(
isValid: StacNetworkRequestAction(
url: 'https://dummyjson.com/auth/login',
method: Method.post,
contentType: 'application/json',
body: {
'username': StacGetFormValueAction(id: 'username'),
'password': StacGetFormValueAction(id: 'password'),
},
),
),
),
],
),
)
{
"type": "form",
"autovalidateMode": "always",
"child": {
"type": "column",
"children": [
{
"type": "textFormField",
"id": "username",
"decoration": {
"labelText": "Username"
}
},
{
"type": "textFormField",
"id": "password",
"decoration": {
"labelText": "Password"
}
},
{
"type": "filledButton",
"child": {
"type": "text",
"data": "Submit"
},
"onPressed": {
"actionType": "validateForm",
"isValid": {
"actionType": "networkRequest",
"url": "https://dummyjson.com/auth/login",
"method": "post",
"contentType": "application/json",
"body": {
"username": {
"actionType": "getFormValue",
"id": "username"
},
"password": {
"actionType": "getFormValue",
"id": "password"
}
}
}
}
}
]
}
}