[英]How to show image from network in flutter BoxDecoration?
[英]In Flutter show image form gallery or from network in same view
我从图库中选择图像然后将其上传到服务器上,然后在成功上传后我点击一个 API 从服务器检索相同的图像并希望在同一个 ImageView 中显示该图像我正在使用Image.file加载单击的图像和Image.network显示网络图像,但我想要一件事来加载图像
试试这个,只需设置一个boolen isProfileImageIsURL ,如果它是真的显示 NetworkImage 小部件其他 FileImage
isProfileImageIsURL ? NetworkImage(profileImageURL) : FileImage(_profilePictureFile);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.