Ardeshir ojan
Ardeshir ojan

Reputation: 2419

How to change IOS swipe back flutter?

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?

Upvotes: 1

Views: 769

Answers (3)

Shadi Danhash
Shadi Danhash

Reputation: 1

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: ...,
    );

Upvotes: 0

Ardeshir ojan
Ardeshir ojan

Reputation: 2419

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

Upvotes: 0

J.K.
J.K.

Reputation: 303

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

Upvotes: 1

Related Questions