-
-
Notifications
You must be signed in to change notification settings - Fork 504
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
在图片滑动的时候,是否能提供图片预加载功能 #24
Comments
什么叫图片滑动。。 |
比如 example中的 PhotoViewDemo,在图片左右切换时,预先加载下一张图片 |
你可以pageChanged时候,做如下操作,这样就相当于提前在内存中加载 onPageChanged: (int index) {
if (index > currentIndex) {
var nextOne = index + 1;
if (nextOne < widget.pics.length) {
var provider = ExtendedNetworkImageProvider(
widget.pics[nextOne].picUrl);
provider.resolve(createLocalImageConfiguration(context));
}
}
currentIndex = index;
rebuildIndex.add(index);
}, |
好的,谢谢 |
https://api.flutter.dev/flutter/widgets/precacheImage.html 使用这个方法应该更好。原理是一样的 |
Closed
参考代码来了 ` if (0 <= index && index < images.length) {
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: