Button.toggle constructor

Button.toggle({
  1. Key? key,
  2. required bool checked,
  3. required ValueChanged<bool> onChanged,
  4. Widget? child,
  5. ToggleButtonThemeData? style,
  6. FocusNode? focusNode,
  7. bool autofocus = false,
  8. String? semanticLabel,
})

Creates a button that can be on or of. Uses a ToggleButton under the hood

Implementation

Button.toggle({
  Key? key,
  required bool checked,
  required ValueChanged<bool> onChanged,
  Widget? child,
  ToggleButtonThemeData? style,
  this.focusNode,
  this.autofocus = false,
  this.semanticLabel,
})  : child = ToggleButton(
        checked: checked,
        onChanged: onChanged,
        child: child,
        focusNode: focusNode,
        semanticLabel: semanticLabel,
        style: style,
      ),
      style = null,
      onPressed = null,
      onLongPress = null,
      type = _ButtonType.toggle,
      builder = null,
      super(key: key);