简体   繁体   中英

How to make custom transition and keep the ios swipe back

I made a customRoute that extends MaterialPageRoute, and I override the buildTransitions to do different transition in different situation

class MyCustomRoute<T> extends MaterialPageRoute<T> {
  final Widget Function(
          BuildContext, Animation<double>, Animation<double>, Widget)
      transitionsBuilder;
  MyCustomRoute(
      {WidgetBuilder builder, RouteSettings settings, this.transitionsBuilder})
      : super(builder: builder, settings: settings);

  @override
  Widget buildTransitions(BuildContext context, Animation<double> animation,
      Animation<double> secondaryAnimation, Widget child) {
    return transitionsBuilder(context, animation, secondaryAnimation, child);
  }
}

it works fine but the swipe back feature in ios is gone, I want to know how to make custom transition and keep the ios swipe back

I found a solution at here, hope this will help someone https://juejin.im/post/5d3ea81af265da03f04ca5d9#heading-4

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM