Pill constructor

const Pill({
  1. Key? key,
  2. required dynamic label,
  3. dynamic value,
  4. Widget? leading,
  5. Widget? trailing,
  6. String? summary,
  7. ValueChanged<String>? onValueChanged,
  8. PillStyle? style,
  9. bool editable = true,
  10. bool expandable = false,
  11. bool selected = false,
  12. bool showCheckIcon = false,
  13. VoidCallback? onTap,
})

Creates a Pill widget.

The label parameter is required and can be a String or a Widget. If value is null, the pill will display only the label. The value parameter can be a String, a Widget, or null. The leading widget is rendered before the label inside the pill. The trailing widget is rendered after the value (or label) inside the pill.

Implementation

const Pill({
  super.key,
  required this.label,
  this.value,
  this.leading,
  this.trailing,
  this.summary,
  this.onValueChanged,
  this.style,
  this.editable = true,
  this.expandable = false,
  this.selected = false,
  this.showCheckIcon = false,
  this.onTap,
})  : assert(
        label is String || label is Widget,
        'label must be a String or Widget',
      ),
      assert(
        value == null || value is String || value is Widget,
        'value must be a String, Widget, or null',
      );