Lostsaka
Lostsaka

Reputation: 198

Flutter auto_route CustomRoute doesn't work with iOS default gesture to go back

I'm using auto_route for navigation in my app that focuses on iOS and android. I generally use the default AutoRoute class for my pages and have the following override for android transition animations in my AppRouter:

@override
RouteType get defaultRouteType {
  if (Platform.isIOS) {
    return RouteType.adaptive();
  }
  return RouteType.custom(
    transitionsBuilder: TransitionsBuilders.slideLeftWithFade,
    durationInMilliseconds: 300,
    reverseDurationInMilliseconds: 300,
  );
}

Nevertheless, in iOS specifically, CustomRoute doesn't work well. I want to implement a custom transition for specific pages like so:

CustomRoute(
  page: HomeRoute.page,
  path: Routes.home,
  transitionsBuilder: TransitionsBuilders.fadeIn,
  durationInMilliseconds: 300,
),

And while the transition works when pushing/popping, I completely lose the native iOS ability to swipe from left edge of screen, that would normally pop the page, along with the default iOS animation transition (previous page is gradually faded in while swiping).

AdaptiveRoute doesn't have a transitionsBuilder, so I can't use that either.

Is there any way to get that back, while having the custom transition?

Upvotes: 2

Views: 58

Answers (0)

Related Questions