-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Hi! My post is related to this one.
So
1)If I use AutomaticKeepAliveMixin to keep the inner scrollers (and each of their children built by builder: methods), they are kept alive and when changing between the tabs, there are no lags in animation.
However, any scrolling of one of the inner scrollers also affects others and the individual scroll positions are not obeyed. Even though I use different PageStorageKey() for all of the scrollers, if AutomaticKeepAliveMixin is applied, scroll positions are problematic.
You can see this behavior here
2)If I don't apply AutomaticKeepAliveMixin to the inner scrollers, scroll positions have no issues and work as expected. However, this time, because each of the inner scrollers (and their respective children) is completely rebuilt whenever a tab change occurs.
When there are relatively fewer items inside inner scrollers (like 20-30 items per tab), TabBarView tab change animations are fluid and no issues. However, when after a user scrolls and fills lots of children into inner scrollers, then tab change becomes very laggy. This happens because the inner scrollers build from scratch.
You can see this behavior here
flutter doctor -v
[√] Flutter (Channel stable, 2.0.5, on Microsoft Windows [Version 10.0.18363.1500], locale en-US)
• Flutter version 2.0.5 at C:\src\flutter
• Framework revision adc687823a (2 weeks ago), 2021-04-16 09:40:20 -0700
• Engine revision b09f014e96
• Dart version 2.12.3
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc2)
• Android SDK at C:\Users\Teq\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.0-rc2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] IntelliJ IDEA Ultimate Edition (version 2020.1)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2020.1
• Flutter plugin version 45.1.3
• Dart plugin version 201.7223.43
[√] VS Code, 64-bit edition (version 1.55.2)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.21.0
[√] Connected device (4 available)
• Android SDK built for x86 64 (mobile) • emulator-5554 • android-x64 • Android 10 (API 29) (emulator)
• sdk gphone x86 64 arm64 (mobile) • emulator-5560 • android-x64 • Android 11 (API 30) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.85
• Edge (web) • edge • web-javascript • Microsoft Edge 89.0.774.77
• No issues found!