如何在Flutter中创建轮廓过滤器芯片

时间:2018-11-21 12:01:34

标签: flutter

我正在尝试在Flutter中创建概述的过滤器芯片。

我可以使用以下代码创建标准的过滤器芯片,但是如图所示,我看不到访问概述版本的方法。

是否可以修改标准芯片以提供轮廓版本?

FilterChip(
   label: Text("text"), 
   onSelected: (bool value) {print("selected");},
),

Material Design Filter Chips

2 个答案:

答案 0 :(得分:3)

我现在正在工作。这是代码:

FilterChip(
    label: Text("text"), 
    backgroundColor: Colors.transparent,
    shape: StadiumBorder(side: BorderSide()),
    onSelected: (bool value) {print("selected");},
),

This post也帮助我发现了StadiumBorder。

答案 1 :(得分:0)

你可以通过这种方式实现

  Chip(
      shape: RoundedRectangleBorder(
        side: BorderSide(color: colorThird, width: 1),
        borderRadius: BorderRadius.circular(10),
      ),
      backgroundColor: colorSecondary,
      deleteIcon: Icon(
        Icons.close,
        color: Colors.white,
        size: 15,
      ),
      label: Text(searchController.recentSearchesList[index], style: TextStyle(color: Colors.white),),
      deleteButtonTooltipMessage: 'erase',
      onDeleted: () {
        print(index);
      },

    );

enter image description here