konClickFast method

Widget konClickFast(
  1. GestureTapCallback onClick, {
  2. int clickSpaceTime = 1000,
  3. HitTestBehavior behavior = HitTestBehavior.translucent,
})

点击扩展 已经 快速点击过滤 默认1000 毫秒

Implementation

Widget konClickFast(
  GestureTapCallback onClick, {
  int clickSpaceTime = 1000,
  HitTestBehavior behavior = HitTestBehavior.translucent,
}) {
  bool isClick = true;
  return GestureDetector(
    behavior: behavior,
    onTap: () {
      if (isClick) {
        isClick = false;
        onClick();
        Future.delayed(Duration(milliseconds: clickSpaceTime), () {
          isClick = true;
        });
      }
    },
    child: this,
  );
}