1

right now the back button in ios is by swiping from left to right I want to change it to right to left. how can I do that?

Ardeshir ojan
  • 1,914
  • 1
  • 13
  • 36

3 Answers3

1

I am guessing you want to create a right to left(RTL) application for example for arabic. Flutter supports the switch to RTL. Refer to the following:

right-to-left (RTL) in flutter

iOS back gesture for RTL Languages

J.K.
  • 236
  • 3
  • 5
0

the other answer will work but it is hard to make it work and if you don't know swift it would be really tough.

the easier way to do this is to change its locale back to English (consider that your app language is rtl like Farsi or Arabic)

MaterialApp(
        debugShowCheckedModeBanner: false,
        supportedLocales: [
          Locale("en", "US"),
        ],
        locale: Locale("en", "US"),

then change your page Directionality to rtl using Directionality widget. like this

Directionality(
  textDirection: TextDirection.rtl,
  child: Scaffold(

this will fix it

Ardeshir ojan
  • 1,914
  • 1
  • 13
  • 36
0

Check this package: https://pub.dev/packages/swipe_effect

SwipeEffect(
      direction: TextDirection.rtl, 
      color: Colors.green.withAlpha(70),
      verticalTolerance: 1.0,
      startDeltaPx: 30,
      callbackDeltaRatio: 0.25,
      callback: () {
        // Navigator.pop(context);
      },
      child: ...,
    );