xCheckbok method

Widget xCheckbok (
  1. {bool value,
  2. Color activeColor,
  3. Color checkColor,
  4. bool tristate,
  5. MaterialTapTargetSize materialTapTargetSize,
  6. Color focusColor,
  7. Color hoverColor,
  8. FocusNode focusNode,
  9. bool autofocus = false,
  10. double width = 18.0,
  11. Key key}
)

Called when the value of the checkbox should change.

The checkbox passes the new value to the callback but does not actually change state until the parent widget rebuilds the checkbox with the new value.

If this callback is null, the checkbox will be displayed as disabled and will not respond to input gestures.

When the checkbox is tapped, if tristate is false (the default) then the onChanged callback will be applied to !value. If tristate is true this callback cycle from false to true to null.

The callback provided to onChanged should update the state of the parent StatefulWidget using the State.setState method, so that the parent gets rebuilt; for example:

Checkbox(
  value: _throwShotAway,
  onChanged: (bool newValue) {
    setState(() {
      _throwShotAway = newValue;
    });
  },
)

Implementation

Widget xCheckbok({
  /// Whether this checkbox is checked.
  ///
  /// This property must not be null.
  final bool value,

  /// The color to use when this checkbox is checked.
  ///
  /// Defaults to [ThemeData.toggleableActiveColor].
  final Color activeColor,

  /// The color to use for the check icon when this checkbox is checked.
  ///
  /// Defaults to Color(0xFFFFFFFF)
  final Color checkColor,

  /// If true the checkbox's [value] can be true, false, or null.
  ///
  /// Checkbox displays a dash when its value is null.
  ///
  /// When a tri-state checkbox ([tristate] is true) is tapped, its [onChanged]
  /// callback will be applied to true if the current value is false, to null if
  /// value is true, and to false if value is null (i.e. it cycles through false
  /// => true => null => false when tapped).
  ///
  /// If tristate is false (the default), [value] must not be null.
  final bool tristate,

  /// Configures the minimum size of the tap target.
  ///
  /// Defaults to [ThemeData.materialTapTargetSize].
  ///
  /// See also:
  ///
  ///  * [MaterialTapTargetSize], for a description of how this affects tap targets.
  final MaterialTapTargetSize materialTapTargetSize,

  /// The color for the checkbox's [Material] when it has the input focus.
  final Color focusColor,

  /// The color for the checkbox's [Material] when a pointer is hovering over it.
  final Color hoverColor,

  /// {@macro flutter.widgets.Focus.focusNode}
  final FocusNode focusNode,

  /// {@macro flutter.widgets.Focus.autofocus}
  final bool autofocus = false,

  /// The width of a checkbox widget.
  double width = 18.0,
  final Key key,
}) {
  return Checkbox(
    value: value,
    onChanged: this,
    activeColor: activeColor,
    autofocus: autofocus,
    checkColor: checkColor,
    focusColor: focusColor,
    focusNode: focusNode,
    hoverColor: hoverColor,
    key: key,
    materialTapTargetSize: materialTapTargetSize,
    tristate: tristate,
  );
}