GCheckboxField class

Checkbox tile that participates in form validation.

The usual reason to need validation on a checkbox is a "must accept the terms" gate, which a bare Checkbox cannot express:

GCheckboxField(
  name: 'terms',
  title: const Text('I accept the terms'),
  validator: (value) => value == true ? null : 'You must accept the terms',
);
Inheritance
Available extensions

Constructors

GCheckboxField({Key? key, String? name, bool? initialValue = false, required Widget title, Widget? subtitle, Widget? secondary, ValueChanged<bool>? onChanged, FormFieldValidator<bool>? validator, AutovalidateMode? autovalidateMode, FormFieldSetter<bool>? onSaved, bool enabled = true, ListTileControlAffinity controlAffinity = ListTileControlAffinity.leading, EdgeInsetsGeometry? contentPadding, Color? activeColor})
Creates a validating checkbox tile.

Properties

autovalidateMode → AutovalidateMode
Used to enable/disable this form field auto validation and update its error text.
finalinherited
builder → FormFieldBuilder<bool>
Function that returns the widget representing this form field.
finalinherited
centered → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in a Center widget.
no setter
enabled → bool
Whether the form is able to receive user input.
finalinherited
errorBuilder → FormFieldErrorBuilder?
Function that returns the widget representing the error to display.
finalinherited
forceErrorText → String?
An optional property that forces the FormFieldState into an error state by directly setting the FormFieldState.errorText property without running the validator function.
finalinherited
hashCode → int
The hash code for this object.
no setterinherited
initialValue → bool?
An optional value to initialize the form field to, or null otherwise.
finalinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onReset → VoidCallback?
An optional method to call when the form field is reset via FormFieldState.reset.
finalinherited
onSaved → FormFieldSetter<bool>?
An optional method to call with the final value when the form is saved via FormState.save.
finalinherited
restorationId → String?
Restoration ID to save and restore the state of the form field.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
safeArea → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in a SafeArea.
no setter
sliverBox → Widget

Available on Widget, provided by the WidgetX extension

Adapts this box widget for use inside a CustomScrollView.
no setter
validator → FormFieldValidator<bool>?
An optional method that validates an input. Returns an error string to display if the input is invalid, or null otherwise.
finalinherited

Methods

absorbPointer({bool absorbing = true}) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in an AbsorbPointer.
aligned([AlignmentGeometry alignment = Alignment.center]) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in an Align.
aspectRatio(double ratio) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in an AspectRatio.
background(Color color) → Widget

Available on Widget, provided by the WidgetX extension

Paints color behind this widget.
clipped([BorderRadius? radius]) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in a ClipRRect widget with rounded corners.
constrained({double minWidth = 0.0, double maxWidth = double.infinity, double minHeight = 0.0, double maxHeight = double.infinity}) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in a ConstrainedBox.
createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → FormFieldState<bool>
Creates the mutable state for this widget at a given location in the tree.
inherited
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
decorated(Decoration decoration) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in a DecoratedBox.
expanded([int flex = 1]) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in an Expanded widget with flex.
fitted([BoxFit fit = BoxFit.contain]) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in a FittedBox widget with fit.
flexible([int flex = 1, FlexFit fit = FlexFit.loose]) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in a Flexible widget with flex and fit.
hero(Object tag) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in a Hero.
ignorePointer({bool ignoring = true}) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in an IgnorePointer.
inkWell({VoidCallback? onTap, VoidCallback? onLongPress, BorderRadius? borderRadius}) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in an InkWell, which paints a ripple. Prefer this over onTap inside a Material surface.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onTap(VoidCallback onTap) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in a GestureDetector with onTap callback.
opacity(double value) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in an Opacity.
paddingAll(double value) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in a Padding widget with uniform padding.
paddingOnly({double left = 0.0, double top = 0.0, double right = 0.0, double bottom = 0.0}) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in a Padding widget with specific edge padding.
paddingSymmetric({double horizontal = 0.0, double vertical = 0.0}) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in a Padding widget with symmetric padding.
positioned({double? left, double? top, double? right, double? bottom, double? width, double? height}) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in a Positioned, for use inside a Stack.
rotated(int quarterTurns) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in a RotatedBox of quarterTurns.
scaled(double scale) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in a Transform.scale.
sized({double? width, double? height}) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in a SizedBox with the given dimensions.
squared(double side) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in a square SizedBox of side.
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
tooltip(String message) → Widget

Available on Widget, provided by the WidgetX extension

Wraps this widget in a Tooltip.
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → 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
visible(bool isVisible, {Widget replacement = const SizedBox.shrink()}) → Widget

Available on Widget, provided by the WidgetX extension

Shows this widget when isVisible, otherwise replacement.

Operators

operator ==(Object other) → bool
The equality operator.
inherited