StacChip class

A Stac model representing Flutter's Chip widget.

Displays a compact element with an optional avatar, label, and delete icon. Supports styling via colors, padding, shape, and density.

{@tool snippet} Dart Example:

StacChip(
  label: StacText(data: 'Chip'),
  avatar: StacIcon(icon: 'person'),
  deleteIcon: StacIcon(icon: 'close'),
  deleteIconColor: StacColors.red,
  color: StacColors.white,
  backgroundColor: StacColors.blue,
  padding: StacEdgeInsets.all(8.0),
  elevation: 2.0,
)

{@end-tool}

{@tool snippet} JSON Example:

{
  "type": "chip",
  "label": { "type": "text", "data": "Chip" },
  "avatar": { "type": "icon", "icon": "person" },
  "deleteIcon": { "type": "icon", "icon": "close" },
  "deleteIconColor": "#F44336",
  "color": "#FFFFFF",
  "backgroundColor": "#2196F3",
  "padding": { "all": 8.0 },
  "elevation": 2.0
}

{@end-tool}

See also:

  • Flutter's Chip documentation (https://api.flutter.dev/flutter/material/Chip-class.html)
Inheritance
Annotations
  • @JsonSerializable(explicitToJson: true)

Constructors

StacChip.new({StacWidget? avatar, required StacWidget label, StacTextStyle? labelStyle, StacEdgeInsets? labelPadding, StacWidget? deleteIcon, StacAction? onDeleted, String? deleteIconColor, String? deleteButtonTooltipMessage, StacBorderSide? side, StacShapeBorder? shape, StacClip? clipBehavior, bool? autofocus, String? color, String? backgroundColor, StacEdgeInsets? padding, StacVisualDensity? visualDensity, StacMaterialTapTargetSize? materialTapTargetSize, double? elevation, String? shadowColor, String? surfaceTintColor, StacBoxConstraints? avatarBoxConstraints, StacBoxConstraints? deleteIconBoxConstraints})
Creates a StacChip.
const
StacChip.fromJson(Map<String, dynamic> json)
Creates a StacChip from a JSON map.
factory

Properties

autofocus bool?
Whether this widget should focus itself if nothing else is focused.
final
avatar StacWidget?
Optional leading avatar widget.
final
avatarBoxConstraints StacBoxConstraints?
Constraints for the avatar widget.
final
backgroundColor String?
Background color of the chip.
final
clipBehavior StacClip?
How to clip the content.
final
color String?
Foreground color for the chip's content.
final
deleteButtonTooltipMessage String?
Tooltip for the delete button.
final
deleteIcon StacWidget?
Optional delete icon widget.
final
deleteIconBoxConstraints StacBoxConstraints?
Constraints for the delete icon widget.
final
deleteIconColor String?
Color for the delete icon.
final
elevation double?
Elevation of the chip.
final
hashCode int
The hash code for this object.
no setterinherited
jsonData Map<String, dynamic>?
Raw JSON data for this widget
finalinherited
label StacWidget
The primary label widget.
final
labelPadding StacEdgeInsets?
Padding around the label.
final
labelStyle StacTextStyle?
Text style for the label.
final
materialTapTargetSize StacMaterialTapTargetSize?
Tap target size configuration.
final
onDeleted StacAction?
Action to perform when the chip's delete button is pressed.
final
padding StacEdgeInsets?
Inner padding for the chip's content.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shadowColor String?
Shadow color for the chip.
final
shape StacShapeBorder?
Shape of the chip.
final
side StacBorderSide?
Border side of the chip.
final
surfaceTintColor String?
Surface tint color for the chip.
final
type String
Widget type identifier.
no setteroverride
visualDensity StacVisualDensity?
Visual density configuration.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts this StacChip instance to a JSON map.
override
toString() String
A string representation of this object.
inherited

Operators

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