InkWell not showing ripple effect

后端 未结 13 744
陌清茗
陌清茗 2020-11-30 01:39

Tapping the container triggers the onTap() handler but does not show any ink splash effect.

class _MyHomePageState extends State

        
13条回答
  •  一向
    一向 (楼主)
    2020-11-30 02:07

    I have found this solution for me. I think it can help you:

    Material(
          color: Theme.of(context).primaryColor,
          child: InkWell(
            splashColor: Theme.of(context).primaryColorLight,
            child: Container(
              height: 100,
            ),
            onTap: () {},
          ),
        )
    

    Color is given to Material widget. It is the default color of your widget. You can adjust color of ripple effect using splashColor property of Inkwell.

提交回复
热议问题