Flutter FilterChip Avatar Selected Style

时光总嘲笑我的痴心妄想 提交于 2019-12-10 13:19:22

问题


I'm using FilterChip with a CircleAvatar for avatar, but the selected state has a nasty rectangle that I can't seem to find any reference for. How do I remove it?

Code:

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);
        },
      )

Result:

How I want it to appear (taken from material.io documentation):

FilterChip documentation.


回答1:


You can try to adapt this solution for a Circle Image for your Chip Circle as well

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")
             )
)),  

from this Medium Post https://medium.com/@boldijar.paul/circle-image-view-in-flutter-965963c46cf5



来源:https://stackoverflow.com/questions/53929540/flutter-filterchip-avatar-selected-style

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!