flutter_gesture_hit_intercept 0.0.1 copy "flutter_gesture_hit_intercept: ^0.0.1" to clipboard
flutter_gesture_hit_intercept: ^0.0.1 copied to clipboard

Flutter 实现命中拦截, 用于解决手势冲突, 阻止其它小部件获取手势事件

pub package

flutter_gesture_hit_intercept #

Flutter 实现命中拦截, 用于解决手势冲突, 阻止其它小部件获取手势事件

使用场景: 比如在ListView中, 有一个tile想要获取手势事件, 同时又想要ListView阻止滚动, 这时候就可以使用这个库.

screenshot

安装 #

安装最新版本. pub package.

快速开始 #

导入对应的包, 使用 GestureHitInterceptScope 小部件包裹 ListView, 然后在需要拦截手势的RenderBox上使用 GestureHitInterceptScope.of(context)?.interceptHitBox = this 方法即可.

@override
Widget build(BuildContext context) {
  return MaterialApp(
    home: Scaffold(
      body: GestureHitInterceptScope(
        child: ListView(
          physics: const AlwaysScrollableScrollPhysics(
            parent: BouncingScrollPhysics(),
          ),
          children: [
            const GestureTestWidget(), //测试小部件
            buildItem(context),
            ...
          ],
        ),
      ),
    ),
  );
}

license #

MIT License

Copyright (c) 2024 angcyo

2
likes
150
points
24
downloads
screenshot

Publisher

verified publisherangcyo.com

Weekly Downloads

Flutter 实现命中拦截, 用于解决手势冲突, 阻止其它小部件获取手势事件

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_gesture_hit_intercept