Skip to main content
The Stac Chip allows you to build a Flutter Chip widget using JSON. To know more about the Chip widget in Flutter, refer to the official documentation.

Properties

PropertyTypeDescription
avatarStacWidgetThe widget to display prior to the chip’s label.
labelStacWidgetThe primary content of the chip.
labelStyleStacTextStyleThe style to use for the label.
labelPaddingStacEdgeInsetsThe padding around the label.
deleteIconStacWidgetThe widget to display as the chip’s delete icon.
onDeletedStacActionThe callback that is called when the delete icon is tapped.
deleteIconColorStacColorThe color of the delete icon.
deleteButtonTooltipMessageStringThe message to display in the tooltip for the delete icon.
sideStacBorderSideThe border to display around the chip.
shapeStacRoundedRectangleBorderThe shape of the chip’s border.
clipBehaviorStacClipThe clip behavior of the chip. Defaults to Clip.none.
autofocusboolWhether this chip should focus itself if nothing else is already focused. Defaults to false.
colorStacColorThe color of the chip.
backgroundColorStacColorThe background color of the chip.
paddingStacEdgeInsetsThe padding around the chip.
visualDensityStacVisualDensityThe visual density of the chip.
materialTapTargetSizeStacMaterialTapTargetSizeConfigures the minimum size of the tap target.
elevationdoubleThe elevation of the chip.
shadowColorStacColorThe color of the chip’s shadow.
surfaceTintColorStacColorThe color of the chip’s surface tint.
iconThemeStacIconThemeDataThe theme for icons in the chip.
avatarBoxConstraintsStacBoxConstraintsThe constraints for the avatar.
deleteIconBoxConstraintsStacBoxConstraintsThe constraints for the delete icon.

Example

StacChip(
  avatar: StacCircleAvatar(
    backgroundColor: StacColors.red,
    child: StacText(data: 'A'),
  ),
  label: StacText(data: 'Chip Label'),
  labelStyle: StacTextStyle(color: StacColors.black, fontSize: 14),
  labelPadding: StacEdgeInsets(left: 8, top: 4, right: 8, bottom: 4),
  deleteIcon: StacIcon(icon: 'delete'),
  deleteIconColor: StacColors.red,
  deleteButtonTooltipMessage: 'Delete',
  side: StacBorderSide(color: StacColors.black, width: 1.0),
  shape: StacRoundedRectangleBorder(borderRadius: 8.0),
  clipBehavior: StacClip.antiAlias,
  autofocus: false,
  color: StacColors.white,
  backgroundColor: '#EEEEEE',
  padding: StacEdgeInsets(left: 8, top: 4, right: 8, bottom: 4),
  visualDensity: StacVisualDensity(horizontal: 0.0, vertical: 0.0),
  materialTapTargetSize: StacMaterialTapTargetSize.padded,
  elevation: 2.0,
  shadowColor: StacColors.black,
  surfaceTintColor: StacColors.white,
  iconTheme: StacIconThemeData(color: StacColors.black, size: 24.0),
  avatarBoxConstraints: StacBoxConstraints(minWidth: 24.0, minHeight: 24.0),
  deleteIconBoxConstraints: StacBoxConstraints(minWidth: 24.0, minHeight: 24.0),
)