CheckboxSuperFormField<T> class
Base class for creating checkboxes that extends SuperFormField.
This widget's state automatically registers field for name so there is no need for manual registration.
Specify rules to add validation for this field. Errors will not be displayed automatically. Consider putting SuperFormErrorText below the field.
Checkboxes are operating on List. If the list constains the value checkbox is considered as checked. Initial value if provided must be a list.
The field will automatically clear values that no longer have corresponding options.
CheckboxSuperFormField.listTile(
name: "consent",
options: const [
CheckboxOption("tc", Text("I agree to the Terms and Conditions")),
CheckboxOption("marketing",Text("I would like to receive marketing...")),
CheckboxOption("offers", Text("I would like to receive emails about...")),
],
rules: [
ContainsRule(
const MapEntry("tc", true),
"In order to proceed you must agree to our Terms and Conditions",
)
],
);
See also:
- RadioSuperFormField, which is radio version of this widget
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- SuperFormField
- CheckboxSuperFormField
Constructors
-
CheckboxSuperFormField({Key? key, required CheckboxBuilder<
T> builder, required String name, required List<CheckboxOption< options, List<T> >SuperFormFieldRule> ? rules, void onChanged(T value, bool checked)?, bool? enabled}) -
Creates a CheckboxSuperFormField that delegates its build to a
builder
while providing helpful CheckboxState abstraction. -
CheckboxSuperFormField.listTile({Key? key, required String name, required List<
CheckboxOption< options, List<T> >SuperFormFieldRule> ? rules, Color? activeColor, Color? checkColor, Color? tileColor, Widget subtitle(CheckboxOption<T> state)?, bool isThreeLine = false, bool? dense, Widget? secondary, bool selected(CheckboxOption<T> option)?, ListTileControlAffinity controlAffinity = ListTileControlAffinity.platform, bool autofocus = false, EdgeInsetsGeometry? contentPadding, ShapeBorder? shape, Color? selectedTileColor, void onChanged(T value, bool checked)?, bool? enabled}) - Creates a Column of connected CheckboxListTiles which represent the options.
Properties
- builder → SuperFormFieldBuilder
-
finalinherited
- enabled → bool?
-
If false, the field will be displayed as disabled.
final
- focusNode → FocusNode?
-
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- name → String
-
Name of the field
finalinherited
- noFormFallback → Widget
-
Fallback widget for a case where SuperForm ancestor is unavailable
finalinherited
-
options
→ List<
CheckboxOption< T> > -
List of available options
final
-
rules
→ List<
SuperFormFieldRule> -
Field validation rules
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _CheckboxSuperFormFieldState< T> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of
DiagnosticsNode
objects describing this node's children.inherited -
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited