Flutter FilterChip头像所选样式

时间:2018-12-26 08:41:06

标签: flutter material-design material-ui

我正在使用FilterChipCircleAvatar作为头像,但是所选状态有一个令人讨厌的矩形,我似乎找不到任何参考。如何删除它?

代码:

child: FilterChip(
        avatar: CircleAvatar(
          backgroundColor: category.color
        ),
        label: Text(category.name),
        selected: badCategoryIds.contains(category.id),
        onSelected: (bool value) {
          if (value) {
            badCategoryIds.add(category.id);
          }
          else {
            badCategoryIds.remove(category.id);
          }
          categoryChoiceCallback(badCategoryIds);
        },
      )

结果:

enter image description here

我希望它如何显示(摘自material.io文档)

enter image description here

FilterChip documentation

1 个答案:

答案 0 :(得分:1)

您也可以尝试将此解决方案调整为适用于您的Chip Circle的Circle Image

new Container(
  width: 190.0,
  height: 190.0,
  decoration: new BoxDecoration(
      shape: BoxShape.circle,
      image: new DecorationImage(
      fit: BoxFit.fill,
      image: new NetworkImage(
             "https://i.imgur.com/BoN9kdC.png")
             )
)),  

此中等帖子https://medium.com/@boldijar.paul/circle-image-view-in-flutter-965963c46cf5