auto_route_library icon indicating copy to clipboard operation
auto_route_library copied to clipboard

CustomAutoRouter ignores reverseDurationInMilliseconds

Open khainke opened this issue 3 years ago • 7 comments

As i understand it, reverseDurationInMilliseconds should effect the animation duration on a "pop" / "back" interaction on the page. Im using it as follows (i essentially want to disable any animation):

@CustomAutoRouter(
  replaceInRouteName: 'Page,Route',
  transitionsBuilder: TransitionsBuilders.fadeIn,
  durationInMilliseconds: 0,
  reverseDurationInMilliseconds: 0,
  routes: <AutoRoute>[
    AutoRoute(
      page: HomePageWrapper,
      path: '/',
      initial: true,
      children: [
        AutoRoute(path: '', page: HomePage),
        AutoRoute(path: 'list', page: ListPage),
        AutoRoute(
          path: 'settings',
          page: SettingsPageWrapper,
          children: [
            RedirectRoute(path: '', redirectTo: 'user'),
            AutoRoute(path: 'user', page: UserSettingsPage),
            AutoRoute(path: 'server', page: ServerSettingsPage),
          ],
        ),
      ],
    ),
    AutoRoute(page: LoginPage, path: '/login'),
  ],
)
class $AppRouter {}

But when i run it in Chrome any "forward" animation is instant, but the reverse animation still persist for a while, looks like the reverseDurationInMilliseconds property is ignored, even though transitionsBuilder is given. Even every positive value does not seem to have any effect. Am I missing something, or how can i disable animations on a "back" / "previous page" transition?

khainke avatar Jul 01 '21 23:07 khainke

@khainke if you don't want any transitions just leave the transitions builder empty in CustomRoute

Milad-Akarie avatar Aug 06 '21 13:08 Milad-Akarie

Happens for me as well. The issue still stands. Users of this library might want an entry animation, but an instant pop.

Many thanks btw, my life is much easier with auto_route

harkairt avatar Aug 23 '21 19:08 harkairt

@khainke if you don't want any transitions just leave the transitions builder empty in CustomRoute

This will not change the default reverse transition... (at least for web, back button/navigation in browser will still fade to the last route).

(i tried both specifying null and not specifying the transitionsBuilder parameter)

khainke avatar Aug 23 '21 19:08 khainke

Can confirm this in 3.2.2.

Even the simplest configuration has a delay on pop. This makes it unusable in Flutter Web...

@CustomAutoRouter(
  replaceInRouteName: 'Page,Route',
  routes: <AutoRoute>[
    AutoRoute(page: FirstPage, initial: true),
    AutoRoute(page: SecondPage),
  ],
)

Tienisto avatar Jan 25 '22 23:01 Tienisto

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions

github-actions[bot] avatar Jul 01 '22 08:07 github-actions[bot]

if there was no recent changes, then this is still an open issue. (this is a bump, so this issue stays open.)

khainke avatar Jul 01 '22 14:07 khainke

Pretty sure I'm still witnessing this on latest.

eXifreXi avatar Aug 27 '22 12:08 eXifreXi

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions

github-actions[bot] avatar Oct 27 '22 08:10 github-actions[bot]

pretty sure, this is still an issue ...

khainke avatar Oct 27 '22 22:10 khainke

If you want to disable animations you can use customRoute with transitionBuilder:

CustomRoute<void>(
  page: YourPage,
  transitionsBuilder: TransitionsBuilders.noTransition,
)

MohamadTheWarrior avatar Nov 01 '22 07:11 MohamadTheWarrior