Flutter: How to disable onTap for a while in gesture detector?

后端 未结 3 1227
自闭症患者
自闭症患者 2021-02-20 05:24

I have a GestureDetector in a custom stateless view. when onTap triggered I show a snack bar that displays some info. When the user makes multiple clic

3条回答
  •  余生分开走
    2021-02-20 06:04

    Wrap it in an AbsorbPointer

    var shouldAbsorb = true;
    
    AbsorbPointer(
        absorbing: shouldAbsorb,
        child: GestureDetector(
          onTap: () {
            Navigator.of(context).pop();
          },
          child: Container(
            color: Colors.red,
          ),
        ),
      )
    

提交回复
热议问题