Inkwell not showing ripple when used with Container decoration

后端 未结 5 1755
情歌与酒
情歌与酒 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:58

    Update in 2019:

    You should use Ink widget inside Material, instead of Container. It takes decoration parameter as well:

    Material(
          child: Ink(
            decoration: BoxDecoration(
              // ...
            ),
            child: InkWell(
              onTap: () {},
              child: child, // other widget
            ),
          ),
    );
    

提交回复
热议问题