我有一个包含一些项目的 ListView,但我的问题是 ListView 内的项目将扩展到整个屏幕宽度,我尝试使用 SizedBox 和 Container 但它对我不起作用。这是我的代码:
body: ListView.builder(
itemCount: 10,
itemBuilder: (ctx, index) {
return SizedBox(
width: 10,
height: 10,
child: Card(
color: btnColor,
child: Text(
"Helo",
// loremIpsum,
style: TextStyle(color: Colors.black.withOpacity(0.6)),
),
),
);
},
),
Run Code Online (Sandbox Code Playgroud) 我知道如何检查图像的宽度和高度:
import 'dart:io';
File image = new File('image.png'); // Or any other way to get a File instance.
var decodedImage = await decodeImageFromList(image.readAsBytesSync());
print(decodedImage.width);
print(decodedImage.height)
Run Code Online (Sandbox Code Playgroud)
但是我想检查图像大小,例如 100kb、200kb 或类似的大小,有什么办法吗,请帮助我。