You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AutomaticKeepAliveClientMixin does not work in DefaultTabController With 3 tabs #25807
When moving from tab 1->2->3 or reverse, it only calls initState() on each Page once as intended.
When moving from tab 1 -> 3, it calls initState on tab 1 and 2 again.
When moving from tab 3 -> 1, it initStates again for tab 2 and 3.
AutomaticKeepAliveClientMixin doesn't seem to work when moving across tabs that are not next to each other.
Logs
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.0.0, on Mac OS X 10.14 18A391, locale en-SG)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
[✓] Android Studio (version 3.2)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.30.1)
[✓] Connected device (1 available)
• No issues found!
I have a PR that is on the way to fixing this: #24821
What needs to happen is that each page needs to be given a unique Key. This is because internally, the TabView switches around the order of its children temporarily.
@zoechi I'd love to get my PR into a fit state to land. I need a conversation with someone from the Flutter team to agree the right way forward on this though. I'm happy to put in the time to get this bug fixed (it's been cropping up in a number of issues expressing related but distinct symptoms). I've had no engagement on the PR though. How can we move this forward?
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
zoechi commentedon Dec 27, 2018
Complete runnable example
guoChopper commentedon Dec 28, 2018
zoechi commentedon Dec 28, 2018
SteveAlexander commentedon Dec 28, 2018
I have a PR that is on the way to fixing this: #24821
What needs to happen is that each page needs to be given a unique Key. This is because internally, the TabView switches around the order of its children temporarily.
@zoechi I'd love to get my PR into a fit state to land. I need a conversation with someone from the Flutter team to agree the right way forward on this though. I'm happy to put in the time to get this bug fixed (it's been cropping up in a number of issues expressing related but distinct symptoms). I've had no engagement on the PR though. How can we move this forward?
zoechi commentedon Dec 28, 2018
@goderbauer perhaps?
gtupak commentedon Feb 22, 2019
I am facing the same problem with
BottomNavigationBarand others have that issue too. Is it related in any way, or does anyone have a fix?divan commentedon Mar 7, 2019
Using
PageViewhelps as a workaround (found solution here)gtupak commentedon Mar 7, 2019
Thanks, I'll try and get back to you
gtupak commentedon Mar 8, 2019
I tried the
PageViewapproach but it didn't work. However, theIndexStacktrick did it for me! :) Thankswithinoneyear commentedon Mar 9, 2019
IndexedStack works for me too. But anybody knows why it needs to be wrapped in such a widget? or can we make it work without IndexedStack?
chunhtai commentedon Apr 23, 2019
change reverted, will reland once issue is fixed
jazzbpn commentedon Jun 21, 2020
Is it possible to update the widget that is preserved using AutomaticKeepAliveClientMixin in Flutter?
Rutbamir commentedon Jul 29, 2020
Thank you so much. It worked for me!
github-actions commentedon Aug 14, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.