在行内使用时,扩展小部件无法在Inkwell中使用

问题描述 投票:0回答:1

我有以下代码片段

child: Row(
        mainAxisSize: MainAxisSize.max,
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: widget.items
            .map((item) => InkWell(
                  child: Expanded(child: buildIconItem(item)),
                  onTap: ()=>(),
                ))
            .toList(),
      );


This is my IconItem
Widget buildIconItem(IconButtonItem item) {
    Color color = item.disabled
        ? Colors.grey.shade400
        : item.selected
            ? Theme.of(context).accentColor
            : Theme.of(context).textTheme.caption.color;
    TextStyle textStyle = TextStyle(color: color);
    return Column(
      mainAxisSize: MainAxisSize.max,
      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
      children: <Widget>[
        ImageIcon(item.iconImage.image, size: 35, color: color),
        SizedBox(
          height: 6,
        ),
        Text(item.imageTitle, style: textStyle),
        SizedBox(
          height: 6,
        ),
        Visibility(child: Text(item.subTitle, style: textStyle),
          visible: item.subTitle != null,),
      ],
    );
  }

我希望每个项目都可以扩展,并且在一项到另一项之间的涟漪效应之间,应该没有剩余任何不显示涟漪效应的空间。

现在,由于spaceEvenly标志,用户界面之间似乎有一个间隙,并且该间隙不会从墨水瓶中获得波纹效果。所以我想扩展每个项目。

flutter flutter-layout
1个回答
1
投票

扩展项位于InkWell内部,因为InkWell的父级可以解决此问题,所以交换了扩展项。

© www.soinside.com 2019 - 2024. All rights reserved.