Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

PhotoViewGalleryPageOptions _buildItem(BuildContext context, int index) {
 final item = (widget.bloc.state as AssetPhotoInfo).images[index].thumbDataWithSize(width, height).;
 return PhotoViewGalleryPageOptions(
     imageProvider: MemoryImage(item),
     minScale: PhotoViewComputedScale.contained * 1,
     maxScale: PhotoViewComputedScale.covered * 2,
 ); }

代码中item是从相册获取的图片,这个图片是异步获取的,所以得到的值是future<Uint8List>,该类型如果放在memoryImage中会报错,试了多种方法依然无果,futureBuilder由于返回的是widget,也不适用


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
417 views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...