android_gesture_exclusion

Creator: coderz1093

Last updated:

0 purchases

android_gesture_exclusion Image
android_gesture_exclusion Images

Languages

Categories

Add to Cart

Description:

android gesture exclusion

android_gesture_exclusion #
This plugin wraps
the
Android's View#getSystemGestureExclusionRects()
API to avoid conflict between Gesture Navigation supported in Android 10 (API level 29) and later
and the existing UI swipe gestures from either the left or the right edge of the screen. This plugin
works only on Android.
How to use #
Using instance #
// Set GlobalKey to get the Rect of the Widget.
final GlobalKey globalKey = GlobalKey();

@override
Widget build(BuildContext context) {
return SampleWidget(
key: globalKey,
);
}
copied to clipboard
// You can get the Rect of the Widget to set from GlobalKey.
final context = sliderKey.currentContext;
final box = context.findRenderObject() as RenderBox;
final position = box.localToGlobal(Offset.zero);

final ratio = MediaQuery
.of(context)
.devicePixelRatio;
final left = position.dx * ratio;
final top = position.dy * ratio;
final right = left + box.size.width * ratio;
final bottom = top + box.size.height * ratio;
final rect = Rect.fromLTRB(left, top, right, bottom);

// You can create instance and set some rects wants to exclude gesture navigation.
final androidGestureExclusion = AndroidGestureExclusion.instance;
androidGestureExclusion.setRects
([rect
]
);
copied to clipboard
Using Widget #
@override
Widget build(BuildContext context) {
// Simply wrap the Widget in the area you wish to exclude GestureNavigation.
// You can also set horizontal and vertical margins.
return AndroidGestureExclusionContainer(
verticalExclusionMargin: 20,
child: SampleWidget(),
);
}
copied to clipboard
Issues #
Please file any issues, bugs or feature request as an issue on
our GitHub page.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.