android_gesture_exclusion 0.1.0 copy "android_gesture_exclusion: ^0.1.0" to clipboard
android_gesture_exclusion: ^0.1.0 copied to clipboard

Flutter plugin to exclude android gesture navigation.

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,
  );
}
// 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]);

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(),
  );
}

Issues #

Please file any issues, bugs or feature request as an issue on our GitHub page.

3
likes
0
pub points
77%
popularity

Publisher

unverified uploader

Flutter plugin to exclude android gesture navigation.

Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (license)

Dependencies

android_gesture_exclusion_platform_interface, flutter, visibility_detector

More

Packages that depend on android_gesture_exclusion