Flutter之Chip组件

/**
 * 碎片,一般是用作标签
    const Chip({
    Key key,
    this.avatar,//标签左侧Widget,一般为小图标
    @required this.label,//标签
    this.labelStyle,
    this.labelPadding,
    this.deleteIcon,//删除图标
    this.onDeleted,//删除回调,为空时不显示删除图标
    this.deleteIconColor,//删除图标的颜
    this.deleteButtonTooltipMessage,//删除按钮的tip文字
    this.shape,//形状.默认两端是半圆形
    this.clipBehavior = Clip.none
    this.backgroundColor,//背景颜色
    this.padding,
    this.materialTapTargetSize,//设置为MaterialTapTargetSize.shrinkWrap时,clip距顶部距离为0;设置为MaterialTapTargetSize.padded时距顶部有一个距离
    })
 */
body: Chip(
          label: Text("chip组件", style: TextStyle(fontSize: 15.0,
              color: Color(0xff333333),
              fontStyle: FontStyle.italic),),
          labelPadding: EdgeInsets.only(left: 3.0),
          avatar: Icon(Icons.home, color: Color(0xff00ff00),),
          onDeleted: () {},
          deleteIcon: Icon(Icons.delete),
          deleteIconColor: Color(0xffff0000),
          deleteButtonTooltipMessage: "手下留情",
          backgroundColor: Color(0xfff1f1f1),

          shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(5.0)
          ),

          materialTapTargetSize: MaterialTapTargetSize.padded,
        ),

码云地址:https://gitee.com/xgljh/Flutter.git

你可能感兴趣的:(Flutter之Chip组件)