如何解决在生成视频列表并为其创建缩略图时,会导致导航到此页面时出现延迟如何在颤动中无延迟地生成缩略图
这是我生成视频列表的构建器函数,它调用 _getimage 函数来生成缩略图。
FutureBuilder(
future: _getImage(videoList[index]),// on removal of thil line it works smooth
builder: (context,AsyncSnapshot snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.hasData) {
return Hero(
tag: videoList[index],child: Image.file(
File(snapshot.data),fit: BoxFit.cover,),);
} else {
return const Center(
child: CircularProgressIndicator(),);
}
} else {
return const Center(
child: CircularProgressIndicator(),);
}
}
),
这是我生成缩略图的_getimage函数
Future<String> _getImage(videoPathUrl) async {
final thumb = Thumbnails.getThumbnail(
thumbnailFolder: folder_path,videoFile: videoPathUrl,imageType:
ThumbFormat.PNG,//this image will store in created folderpath
quality: 10);
return thumb;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。