ChoiceChip constructor

const ChoiceChip({
  1. Key? key,
  2. Widget? avatar,
  3. required Widget label,
  4. TextStyle? labelStyle,
  5. EdgeInsetsGeometry? labelPadding,
  6. ValueChanged<bool>? onSelected,
  7. double? pressElevation,
  8. required bool selected,
  9. Color? selectedColor,
  10. Color? disabledColor,
  11. String? tooltip,
  12. BorderSide? side,
  13. OutlinedBorder? shape,
  14. Clip clipBehavior = Clip.none,
  15. FocusNode? focusNode,
  16. bool autofocus = false,
  17. MaterialStateProperty<Color?>? color,
  18. Color? backgroundColor,
  19. EdgeInsetsGeometry? padding,
  20. VisualDensity? visualDensity,
  21. MaterialTapTargetSize? materialTapTargetSize,
  22. double? elevation,
  23. Color? shadowColor,
  24. Color? surfaceTintColor,
  25. IconThemeData? iconTheme,
  26. Color? selectedShadowColor,
  27. bool? showCheckmark,
  28. Color? checkmarkColor,
  29. ShapeBorder avatarBorder = const CircleBorder(),
  30. BoxConstraints? avatarBoxConstraints,
  31. ChipAnimationStyle? chipAnimationStyle,
})

Create a chip that acts like a radio button.

The label, selected, autofocus, and clipBehavior arguments must not be null. When onSelected is null, the ChoiceChip will be disabled. The pressElevation and elevation must be null or non-negative. Typically, pressElevation is greater than elevation.

Implementation

const ChoiceChip({
  super.key,
  this.avatar,
  required this.label,
  this.labelStyle,
  this.labelPadding,
  this.onSelected,
  this.pressElevation,
  required this.selected,
  this.selectedColor,
  this.disabledColor,
  this.tooltip,
  this.side,
  this.shape,
  this.clipBehavior = Clip.none,
  this.focusNode,
  this.autofocus = false,
  this.color,
  this.backgroundColor,
  this.padding,
  this.visualDensity,
  this.materialTapTargetSize,
  this.elevation,
  this.shadowColor,
  this.surfaceTintColor,
  this.iconTheme,
  this.selectedShadowColor,
  this.showCheckmark,
  this.checkmarkColor,
  this.avatarBorder = const CircleBorder(),
  this.avatarBoxConstraints,
  this.chipAnimationStyle,
}) : assert(pressElevation == null || pressElevation >= 0.0),
     assert(elevation == null || elevation >= 0.0),
     _chipVariant = _ChipVariant.flat;