kalismeras61 / flutter_page_transition

This is Flutter Page Transition Package
BSD 2-Clause "Simplified" License
475 stars 57 forks source link

Is it ok if the previous screen is still behind the new one after navigating ? #83

Closed AlAmine-dot closed 1 year ago

AlAmine-dot commented 1 year ago

I have been using this package for a pretty long time in order to add dynamic animations to my Screen transitions easily. But recently, working on a more serious project that has to be released soon, I was benchmarking the app to spot some potentiel performances issues. And that's how I noticed the performances of my app were mainly poor because of one specific reason :

  1. I navigate from RootScreen to SearchScreen like so :

image

  1. I add on SearchScreen a .5 opacity so we can see through :

image

  1. I navigate to SearchScreen on my device :

https://github.com/kalismeras61/flutter_page_transition/assets/82777228/d5594361-bff6-451a-9779-8f7e4cf6f4c2

As you can see, the previous page is still rended, which is problematic because when I open the keyboard the other screen's widgets have to adapt themselves, this behavior is very consuming for the phone's CPU.

It's here a very simple case but there are many other places on my app where I have the same problem and when you add them all together, it simply makes my whole app terrible, especially when I open the Map Screen.

So I don't know if this is normal or necessary, would it be possible to change that in order to make the package better ?

But overall this package is still excellent, and I guess i'm going to keep using it for the screens that don't involve this type of issues, but I hope it's fixed, if possible (for example by removing the previous Widget once the animation was performed and putting it back again right before the pop)

kalismeras61 commented 1 year ago

Yes it is okay and normal..

Same issue is here : https://github.com/flutter/flutter/issues/11655

I just add maintainStateData field. If you set it false it won't build

FYI: this might be clear previous routes and state.

Please use version 2.1.0