小编dda*_*ang的帖子

SimpleDialog 中的项目

我创建了 SimpleDialog 和许多由数据列表生成的 SimpleDialogOptions,是否可以检测到 SimpleDialogOption 的索引?如果没有,我正在尝试在对话框中使用列表,但它只是显示一个空对话框,那么我如何在对话框中使用列表?

flutter flutter-layout

2
推荐指数
1
解决办法
2653
查看次数

压缩图像时 UI 冻结

我正在尝试压缩来自相机或图库的图像,但我尝试在这个问题Flutter & Firebase: Compression before upload image中回答

但是 UI 被冻结了,请问你们有什么解决方案吗?为什么图像插件会遇到这个问题?

更新:

compressImage(imageFile).then((File file) {
   imageFile = file;
});

Future<File> compressImage(File imageFile) async {
   return compute(decodeImage, imageFile);
}

File decodeImage(File imageFile) {
   Im.Image image = Im.decodeImage(imageFile.readAsBytesSync());
   Im.Image smallerImage = Im.copyResize(
       image, 150); // choose the size here, it will maintain aspect ratio
   return new File('123.jpg')
     ..writeAsBytesSync(Im.encodeJpg(smallerImage, quality: 85));
}
Run Code Online (Sandbox Code Playgroud)

我在此代码中遇到“未处理的异常”

flutter flutter-layout

1
推荐指数
1
解决办法
1636
查看次数

标签 统计

flutter ×2

flutter-layout ×2