The-ring-io / flutter_staggered_animations

Easily add staggered animations to your ListView, GridView, Column and Row children.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Animations not playing after Navigator.pop

obrens opened this issue · comments

On ScreenA I have some animations. When I pop out of ScreenB, back into ScreenA, the animations don't replay in spite of the screen rebuilding.

  1. I open ScreenA and the animations play.
  2. I click a button on ScreenA to go to SrceenB:
Navigator.of(context).push(MaterialPageRoute(builder: (context) => ScreenB()))
.then((value) {setState((){});});
  1. On ScreenB I click a button to return to ScreenA:
    Navigator.pop(context)
  2. setState gets called as expected and ScreenA is rebuilt, but the animations don't replay.

I'm testing on Android.
Note that this is how Flutter animations generally behave. The controller has to be manually restarted after Navigator.pop. My issue is that I don't have a way of restarting animations built using this package.

Is there any way of getting it to work the way I want it to work?

On ScreenA I have some animations. When I pop out of ScreenB, back into ScreenA, the animations don't replay in spite of the screen rebuilding.

  1. I open ScreenA and the animations play.
  2. I click a button on ScreenA to go to SrceenB:
Navigator.of(context).push(MaterialPageRoute(builder: (context) => ScreenB()))
.then((value) {setState((){});});
  1. On ScreenB I click a button to return to ScreenA:
    Navigator.pop(context)
  2. setState gets called as expected and ScreenA is rebuilt, but the animations don't replay.

I'm testing on Android.
Note that this is how Flutter animations generally behave. The controller has to be manually restarted after Navigator.pop. My issue is that I don't have a way of restarting animations built using this package.

Is there any way of getting it to work the way I want it to work?

I have that same issue. Did you find any solution?

Same issue

On ScreenA I have some animations. When I pop out of ScreenB, back into ScreenA, the animations don't replay in spite of the screen rebuilding.

  1. I open ScreenA and the animations play.
  2. I click a button on ScreenA to go to SrceenB:
Navigator.of(context).push(MaterialPageRoute(builder: (context) => ScreenB()))
.then((value) {setState((){});});
  1. On ScreenB I click a button to return to ScreenA:
    Navigator.pop(context)
  2. setState gets called as expected and ScreenA is rebuilt, but the animations don't replay.

I'm testing on Android.
Note that this is how Flutter animations generally behave. The controller has to be manually restarted after Navigator.pop. My issue is that I don't have a way of restarting animations built using this package.
Is there any way of getting it to work the way I want it to work?

I have that same issue. Did you find any solution?

maby you can add a key to AnimationLimiter
like

AnimationLimiter(
                    key: ValueKey(data.length),   //here
                    child: ListView()
)

it means that when your list size changed, the widget will rebuild

Same issue

look at my comment blow, hope I can help you

On ScreenA I have some animations. When I pop out of ScreenB, back into ScreenA, the animations don't replay in spite of the screen rebuilding.

  1. I open ScreenA and the animations play.
  2. I click a button on ScreenA to go to SrceenB:
Navigator.of(context).push(MaterialPageRoute(builder: (context) => ScreenB()))
.then((value) {setState((){});});
  1. On ScreenB I click a button to return to ScreenA:
    Navigator.pop(context)
  2. setState gets called as expected and ScreenA is rebuilt, but the animations don't replay.

I'm testing on Android.
Note that this is how Flutter animations generally behave. The controller has to be manually restarted after Navigator.pop. My issue is that I don't have a way of restarting animations built using this package.
Is there any way of getting it to work the way I want it to work?

I have that same issue. Did you find any solution?

maby you can add a key to AnimationLimiter
like

AnimationLimiter(
                    key: ValueKey(data.length),   //here
                    child: ListView()
)

it means that when your list size changed, the widget will rebuild

What about when the list size is the same?