beamer icon indicating copy to clipboard operation
beamer copied to clipboard

popToNamed missing transition

Open bernaferrari opened this issue 3 years ago • 2 comments

Click on 'beam deep' (it will move from '/' to '/a') Click on 'go to b' (it will pop from /a to /b) --- NO TRANSITION HERE Click on 'go to /' (it will pop from /b to /) --- OK.

deep_location.zip

bernaferrari avatar Jul 27 '21 19:07 bernaferrari

Really looking forward to this one :)

graphicbeacon avatar Sep 01 '21 14:09 graphicbeacon

It seems that our ReverseTransitionDelegate could use some improvements.

To remind ourselves: we cannot really pop from /b to /a because they are both page stacks of 2 pages, differing in the top page. ReverseTransitionDelegate is used by popToNamed to make it look like a pop.

You can use the base beaming function update instead of popToNamed, where you can specify a transitionDelegate. This way we can play around with it. Clearly, ReverseTransitionDelegate behaves better in this use case than DefaultTransitionDelegate, but it's not what you want.

 Beamer.of(context).update(
  configuration: const RouteInformation(location: '/b'),
  beamParameters: const BeamParameters(
    transitionDelegate: ReverseTransitionDelegate(),
  ),
);

P.S. code for transition delegate is not the prettiest in the world :slightly_smiling_face: I mainly made it by tinkering with NoAnimationTransitionDelegate from https://api.flutter.dev/flutter/widgets/TransitionDelegate-class.html

slovnicki avatar Dec 03 '21 02:12 slovnicki