-
-
Notifications
You must be signed in to change notification settings - Fork 465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question/Proposal] NavigationBody and state preservation #95
Comments
use |
And it won't provide any animations (unless you do so) |
And would it be possible to reuse any of the animations in the package? |
@takifouhal Thanks! Regarding this issue, do whatever you want. If you consider this kind of feature useful, leave it open; if not, please close it. Thanks for your time guys. |
As I'm happy using |
Reopening as a valid request! |
hi, how do i use transition in |
Wrap your int index = 0;
AnimatedSwitcher(
transitionBuilder: (child, animation) {
return DrillInPageTransition(child: child, animation: animation);
},
child: IndexedStack(
key: ValueKey<int>(index),
currentIndex: 0,
children: [...],
),
) |
I also had the same problem and Pageview works absolutely fine. Although I have not been able to find a way to preserve state when the app switches PaneDisplayMode. Is there any fix for that ? |
I could check how |
Sure, Thanks for the excellent work you are doing. |
class MyViewPageState extends State with AutomaticKeepAliveClientMixin{ @OverRide |
As I said in the issue description, I tried this solution without success but, TBH, since I moved to the solution with |
I was able to keep the state on the example app using Basically, the pages can't be built (call ()) on the I could even keep the scroll position by using a There, I created a new class called So, basically, to make the state persist, you need to do the following: final List<Widget> pages = [
const PageOne(),
const PageTwo(),
];
NavigationView(
...
bodies: pages,
), |
Sounds great! I'll take a look because this will let me use page transitions easily... Giving the fact that we have a working solution, you can close this issue if you're happy too. |
@bdlukaa Hi! Could you give me more details about #95 (comment)? |
@MasterHiei what if you create your provider above your |
@bdlukaa It's not bad:+1: |
I'm using
NavigationView
, aNavigationPane
with menu entries and aNavigationBody
.Looking into the source code, it looks that every time I change the main
index
the associatedchildren[index]
is rebuilt from scratch. But, in my case, I wish there were some kind of state preservation.I've added
AutomaticKeepAliveClientMixin
to every children but every time I change the page using the menu the previous state is lost.Is there a known way to preserve state when switching between menu options? If not, I think it would be great to add this option to
NavigationBody
.At the moment I think I am going to try to use a
PageView
, where I do have experience maintaining the state between changes.Here it is a sample code:
The text was updated successfully, but these errors were encountered: