Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spkersten/flutter_transparent_pointer
https://github.com/spkersten/flutter_transparent_pointer
flutter gestures hittesting
Last synced: about 7 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/spkersten/flutter_transparent_pointer
- Owner: spkersten
- License: mit
- Created: 2020-12-23T11:41:00.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-12T14:27:28.000Z (7 months ago)
- Last Synced: 2024-04-12T22:16:35.055Z (7 months ago)
- Topics: flutter, gestures, hittesting
- Language: Dart
- Homepage: https://pub.dev/packages/transparent_pointer
- Size: 9.77 KB
- Stars: 17
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# transparent_pointer
TransparentPointer is a widget that is invisible for its parent to hit testing,
but still allows its subtree to receive pointer events. This is useful to allow
a gesture detector that is visually behind another widget to still receive pointer
events, while at the same time allowing that other widget to receive those events
as well.## Example
In this example, a drag can be started anywhere in the widget, including on
top of the text button, even though the button is visually in front of the
background gesture detector. At the same time, the button is tappable.```dart
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Stack(
children: [
GestureDetector(
behavior: HitTestBehavior.opaque,
onVerticalDragStart: (_) => print("Background drag started"),
),
Positioned(
top: 60,
left: 60,
height: 60,
width: 60,
child: TransparentPointer(
child: TextButton(
child: Text("Tap me"),
onPressed: () => print("You tapped me"),
),
),
),
],
);
}
}
```