StacForm class
A Stac model representing a form scope used to coordinate input fields and actions.
This widget establishes a StacFormScope at runtime so input widgets can
register and retrieve values (e.g., via the getFormValue action), and so
actions like validation can be performed consistently across fields.
{@tool snippet} Dart Example:
StacForm(
autovalidateMode: StacAutovalidateMode.onUserInteraction,
child: StacColumn(children: [
StacTextFormField(id: 'username'),
StacTextFormField(id: 'password'),
]),
)
{@end-tool}
{@tool snippet} JSON Example:
{
"type": "form",
"autovalidateMode": "always",
"child": {
"type": "column",
"children": [
{ "type": "textFormField", "id": "username" },
{ "type": "textFormField", "id": "password" }
]
}
}
{@end-tool}
See also:
- Flutter's Form documentation
- Inheritance
-
- Object
- StacElement
- StacWidget
- StacForm
- Available extensions
- Annotations
-
- @JsonSerializable.new()
Constructors
- StacForm({StacAutovalidateMode? autovalidateMode, StacWidget? child})
-
Creates a StacForm.
const
-
StacForm.fromJson(Map<
String, dynamic> json) -
Creates a StacForm from a JSON map.
factory
Properties
- autovalidateMode → StacAutovalidateMode?
-
The mode to control auto validation of fields within the form.
final
- child → StacWidget?
-
The widget subtree to display inside the form scope.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
jsonData
→ Map<
String, dynamic> ? -
Raw JSON data for this widget
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- type → String
-
Widget type identifier.
no setteroverride
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parse(
BuildContext context) → Widget? -
Available on StacWidget?, provided by the StacWidgetParser extension
-
parsePreferredSizeWidget(
BuildContext context) → PreferredSizeWidget? -
Available on StacWidget?, provided by the StacWidgetParser extension
-
toJson(
) → Map< String, dynamic> -
Converts this StacForm instance to a JSON map.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited