WellFormed.app constructor
- List<
Widget> fields, { - bool enabled = true,
- bool hasReset = true,
- String title = '',
- Widget submitChild = const Text('Submit'),
- Widget resetChild = const Text('Reset'),
- Widget? leading,
- VoidCallback? onSub,
- VoidCallback? onReset,
- ButtonStyle? submitStyle,
- ButtonStyle? resetStyle,
- Axis scrollDirection = Axis.vertical,
- GlobalKey<
FormState> ? formKey, - Key? submitKey,
- Key? resetKey,
- Key? key,
A Form within a MaterialApp container.
This configuration is suitable for unit testing or when the whole application boils down to the form itself.
fields
the Form's fields.
enabled
enable/disable flag.
hasReset
if true, the form will have a reset button.
title
the MaterialApp.title value.
submitChild
the child widget of the submission button.
resetChild
the child widget of the reset button.
leading
if set, an extra widget will be placed on the leftmost position
alongside the submission and reset buttons.
scrollDirection
the axis along which the scroll view scrolls.
formKey
the form state key; if omitted, a new key will be generated.
submitKey
the submit button key — it might be useful for unit testing.
resetKey
the reset button key — it might be useful for unit testing.
Implementation
WellFormed.app(
List<Widget> fields, {
bool enabled = true,
bool hasReset = true,
String title = '',
Widget submitChild = const Text('Submit'),
Widget resetChild = const Text('Reset'),
Widget? leading,
VoidCallback? onSub,
VoidCallback? onReset,
ButtonStyle? submitStyle,
ButtonStyle? resetStyle,
Axis scrollDirection = Axis.vertical,
GlobalKey<FormState>? formKey,
Key? submitKey,
Key? resetKey,
Key? key,
}) : _toForm = ((context) {
return MaterialApp(
title: title,
debugShowCheckedModeBanner: false,
home: Scaffold(
body: WellFormed.btn(
fields,
enabled: enabled,
hasReset: hasReset,
formKey: formKey,
submitChild: submitChild,
resetChild: resetChild,
leading: leading,
submitStyle: submitStyle,
resetStyle: resetStyle,
scrollDirection: scrollDirection,
onSub: onSub,
onReset: onReset,
resetKey: resetKey,
submitKey: submitKey,
),
),
);
}),
super(key: key);