我正在使用影像包來裁剪具有 3 個不同坐標的影像,但裁剪影像的結果顯示相同。
finalCroppedImage.isNotEmpty
? finalCroppedImage.map((Image) { //Instance of image from Image package
print(Image.height); //here i have different values for the images
print(Image.width);
File imageFinal = File(mainImage!.path);
File(mainImage!.path).writeAsBytesSync(encodePng(Image)); // I'm trying to decode it to display in the container
return Container(
height: 300,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fitWidth,
image: FileImage(File(mainImage!.path)))),
);
}).toList()
: [Text('Empty')],
uj5u.com熱心網友回復:
您對所有影像使用相同的名稱,請將您的代碼更改為:
finalCroppedImage.isNotEmpty
? finalCroppedImage.map((image) { //Instance of image from Image package
print(image.height); //here i have different values for the images
print(image.width);
File imageFinal = File(image!.path);
File(imageFinal!.path).writeAsBytesSync(encodePng(image)); // I'm trying to decode it to display in the container
return Container(
height: 300,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fitWidth,
image: FileImage(File(imageFinal!.path)))),
);
}).toList()
: [Text('Empty')],
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/487757.html
上一篇:如何知道螢屏是在前面還是在后面
下一篇:在Dart中直接使用列舉建構式
