我使用image_picker_wew,但此程序包不起作用。单击添加图像后,打开Windows资源管理器给我选择文件,但是提交后什么也没发生,也许我做错了什么?
File _image1;
Future getImg() async {
var tempImg = await ImagePickerWeb.getImage();
if (tempImg != null) {
setState(() {
_image1 = tempImg;
print(tempImg);
});
}
}
小工具
Widget _displayChild1() {
if (_image1 == null) {
return Padding(
padding: const EdgeInsets.fromLTRB(30, 40, 30, 40),
child: new Icon(
Icons.add,
color: Colors.grey,
),
);
} else {
return Image.file(
_image1,
fit: BoxFit.fill,
width: double.infinity,
);
}
}