Form constructor
const
Form({
- Key? key,
- required Widget child,
- FormSubmitCallback? onSubmit,
- FormController? controller,
Creates a Form widget.
The child parameter is required and should contain the form fields
and UI elements that participate in the form. The controller and
onSubmit parameters are optional but commonly used for form management.
Parameters:
child(Widget, required): The widget subtree containing form fieldsonSubmit(FormSubmitCallback?, optional): Callback for form submissioncontroller(FormController?, optional): External form state controller
Example:
Form(
onSubmit: (values) => print('Submitted: $values'),
child: Column(
children: [
TextInput(key: FormKey('email'), label: 'Email'),
Button(child: Text('Submit')),
],
),
);
Implementation
const Form({super.key, required this.child, this.onSubmit, this.controller});