跳至主要內容

ChipTheme ChipThemeData

xiaoye小于 1 分钟

ChipTheme

用于Chip类组件样式,比如ChipInputChipChoiceChipFilterChipActionChip等。

用法如下:

ChipTheme(
  data: ChipThemeData.fromDefaults(
      primaryColor: Colors.red,
      secondaryColor: Colors.blue,
      labelStyle: TextStyle()),
  child: RawChip(
    label: Text('老孟'),
  ),
)
image-20200528151835164
image-20200528151835164

ChipThemeData

ChipTheme 中就是设置ChipThemeData的各种属性,查看其构造函数:

const ChipThemeData({
   this.backgroundColor, //背景颜色
  this.deleteIconColor, //删除图标颜色
   this.disabledColor,// 禁用背景颜色
   this.selectedColor,//选中颜色
   this.secondarySelectedColor,
  this.shadowColor,//阴影颜色
  this.selectedShadowColor,//选中阴影颜色
  this.showCheckmark,//是否显示“前置对勾”图标
  this.checkmarkColor,//“前置对勾”图标颜色
   this.labelPadding,//label内边距
   this.padding,//内边距
   this.shape,//形状
   this.labelStyle,//label文本样式
   this.secondaryLabelStyle,
   this.brightness,//主题的亮度
  this.elevation,//阴影值
  this.pressElevation,//按压时的阴影值
}) 

这些属性看起名字就知道其作用了。