它只显示最近的照片。我也想要相机选项。
这是我的代码。
Future<void> loadAssets(StateSetter setModalState) async {
print("On pressed");
List<Asset> resultList = List<Asset>();
String error = 'No Error Dectected';
try {
resultList = await MultiImagePicker.pickImages(
maxImages: 2,
enableCamera: true,
selectedAssets: image,
materialOptions: MaterialOptions(
actionBarColor: "#abcdef",
actionBarTitle: "Example App",
allViewTitle: "All Photos",
useDetailsView: false,
selectCircleStrokeColor: "#000000",
),
);
} on Exception catch (e) {
error = e.toString();
}
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) return;
setModalState(() {
image = resultList;
print("Set state");
if(image.length>0){
showUploadButton = false;
}else{
showUploadButton = true;
}
// _error = error;
//print(_error);
});
}
我不知道为什么会这样。我已经删除了该应用程序并重新安装。还清理了android studio。但是它仍然只显示最近的照片
最佳答案
写在info.plist中
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app does not require access to the microphone.</string>
<key>NSCameraUsageDescription</key>
<string>This app requires access to the camera.</string>
关于android - Flutter multi_image_picker相机选项未在iOS中显示。当我已经启用摄像头并将权限写入info.plist中时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64347247/