Inkwell not showing ripple when used with Container decoration

后端 未结 5 1752
情歌与酒
情歌与酒 2021-01-31 18:35

I want to add a ripple on an item, it is working fine until I add a gradient on the item using BoxDecoration.

Widget build(BuildContext context) {
          


        
5条回答
  •  执笔经年
    2021-01-31 18:57

    If anyone came here looking to do use an inkwell with a circle decoration (like I did), I used the accepted answer to come up with this.

    Material(
      child: Ink(
          width: 150,
          height: 150,
          decoration: BoxDecoration(
            shape: BoxShape.circle,
            color: Colors.grey[350],
            border: Border.all(
              color: Colors.red,
              width: 4.0,
            ),
          ),
          child: InkWell(
            customBorder: const CircleBorder(),
            onTap: onTap,
            child: const Icon(Icons.add, size: 48, color: Colors.white),
          ),
        ));
    

提交回复
热议问题