Flutter FilterChip头像所选样式 [英] Flutter FilterChip Avatar Selected Style

查看:460
本文介绍了Flutter FilterChip头像所选样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将FilterChipCircleAvatar用于化身,但是所选状态有一个令人讨厌的矩形,我似乎找不到任何引用.如何删除它?

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?

代码:

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

结果:

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

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

FilterChip文档.

推荐答案

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

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

来自该中型帖子 https://medium. com/@boldijar.paul/circle-image-view-in-flutter-965963c46cf5

这篇关于Flutter FilterChip头像所选样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆