Form
A behavioral boundary that coordinates descendant FormField widgets.
Learn more: Forms & validation
Import: package:fleury/fleury.dart, or package:fleury/fleury_core.dart in browser code.
Form( controller: form, onSubmit: saveProject, child: Column(children: [ FormField( validator: () => name.text.isEmpty ? 'Enter a name.' : null, child: TextInput(controller: name), ), Button(text: 'Save', onPressed: form.submit), ]),)Details
Section titled “Details”Form owns no values and imposes no panel, wizard, or field layout. Values
stay in ordinary application state and validators close over that state.
Constructors
Section titled “Constructors”Form()
Section titled “Form()”Creates a behavioral form boundary around child.
| Parameter | Type | Default | Description |
|---|---|---|---|
controller: | FormController? | — | Optional externally-owned command surface. More |
semanticLabel: | String? | — | Accessible name for this form when the surrounding heading is not enough. |
onSubmit: | FutureOr<void> Function() | required | Called after every mounted, enabled field validates successfully. More |
child: | Widget | required | The application-defined form layout. |
controller: When omitted,Formcreates one that descendants can read withof.onSubmit: An error it throws or returns goes to whoever submitted: a caller that awaitsFormController.submitreceives it. One that doesn’t, such as a button or the form’s semantic submit action, leaves it uncaught, andrunAppreports it and keeps the app running.
Source
Section titled “Source”Form is defined in packages/fleury/lib/src/catalog/form.dart.
Category: Forms · All widgets