0

I'm writing a flutter app (which uses gesturedetectors), and want to change the swipe area or disable the top level swiping on a watch where it drags the watch face over the app (Also would appreciate any other solutions, ie in Java that I could use).

The app drag/swipes a map (like Google Maps), and works fine on a phone. On a watch however, the left to right swipe drags the app away to let the watch face come over.

This drag area seems to take over 50% of the watch screen when dragging, which means you can't drag the map, it just pulls a watch face over (so you can only use the right hand side of the app with your finger to drag). I note on Google Maps, it only takes about 10% of the left screen as a drag area to swipe the watch face, which feels fine.

I have tried

Future<bool> _willPopCallback() async {
  print("PoppedCallback");
  return false; //also tried true
}

home: new WillPopScope(
        onWillPop: _willPopCallback,
  child: ....

as part of the MaterialApp setting, but this doesn't seem to trigger any callback at any time, so I'm guessing that event is different to this one ?

Does anyone have any ideas, ideally how to change the area of the default Wear swipe (so works like Goole Maps), or if necessary disable it (as you can still exit with pressing the buttons).

Ian
  • 13,724
  • 4
  • 52
  • 75

1 Answers1

1

From the Wear OS dev docs, here's how you disable swipe-to-dismiss:

you can extend the default theme (in a style resource) and set the android:windowSwipeToDismiss attribute to false:

<resources>
  <style name="AppTheme" parent="@android:style/Theme.DeviceDefault">
    <item name="android:windowSwipeToDismiss">false</item>
  </style>
</resources>

Note that it's also recommended that on first run, your activity instruct the user to press the hardware power button to exit.

Sterling
  • 6,365
  • 2
  • 32
  • 40