Closed z759341385 closed 4 years ago
环境
我运行了大佬的demo项目,进入了NestedScrollView页面,进入SecondTabView文件 ,然后在下图25行处print字符串
现象
滑动TabBarView里的列表时 整个页面会重新build,控制台输出结果如下
期望
我自己的项目里 TabBarView内有很多图片 这会导致每次滑动图片都会重绘 体验不是很好,不知大佬是否有方法优化
` :~ blurfir$ flutter doctor -v [✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.14.5 18F132, locale zh-Hans-CN) • Flutter version 1.12.13+hotfix.8 at /Users/blurfir/flutter • Framework revision 0b8abb4724 (3 months ago), 2020-02-11 11:44:36 -0800 • Engine revision e1e6ced81d • Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) • Android SDK at /Users/blurfir/Library/Android/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 29.0.2 • ANDROID_HOME = /Users/blurfir/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405) • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.3.1, Build version 11C504 • CocoaPods version 1.8.4
[✓] Android Studio (version 3.5) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 42.1.1 • Dart plugin version 191.8593 • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] VS Code (version 1.44.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.9.1
[✓] Connected device (1 available) • iPhone 8 • D026A059-3954-4013-87EC-43659B1C69B9 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator) `
不管在哪里,滚动,图片都会重绘,跟build不build没有关系。
列表图片 1.减少图片大小 2.使用缓存
@zmtzawqlp 好的我再试试 但是我在flutter的NestedScrollView里 Print就不会一直输出诶
减少图片大小 .使用缓存之后图片不会重新加载了
环境
我运行了大佬的demo项目,进入了NestedScrollView页面,进入SecondTabView文件 ,然后在下图25行处print字符串
现象
滑动TabBarView里的列表时 整个页面会重新build,控制台输出结果如下
期望
我自己的项目里 TabBarView内有很多图片 这会导致每次滑动图片都会重绘 体验不是很好,不知大佬是否有方法优化
` :~ blurfir$ flutter doctor -v [✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.14.5 18F132, locale zh-Hans-CN) • Flutter version 1.12.13+hotfix.8 at /Users/blurfir/flutter • Framework revision 0b8abb4724 (3 months ago), 2020-02-11 11:44:36 -0800 • Engine revision e1e6ced81d • Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) • Android SDK at /Users/blurfir/Library/Android/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 29.0.2 • ANDROID_HOME = /Users/blurfir/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405) • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.3.1, Build version 11C504 • CocoaPods version 1.8.4
[✓] Android Studio (version 3.5) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 42.1.1 • Dart plugin version 191.8593 • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] VS Code (version 1.44.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.9.1
[✓] Connected device (1 available) • iPhone 8 • D026A059-3954-4013-87EC-43659B1C69B9 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator) `