|
@@ -1,5 +1,6 @@
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:image_cropper/image_cropper.dart';
|
|
|
+import 'package:shared/utils/device_utils.dart';
|
|
|
import 'package:wechat_assets_picker/wechat_assets_picker.dart';
|
|
|
import 'package:widgets/dialog/album_default_select_dialog.dart';
|
|
|
|
|
@@ -38,13 +39,29 @@ class ImagePickerUtils {
|
|
|
DialogEngine.show(
|
|
|
position: DialogPosition.bottom,
|
|
|
widget: AlbumDefaultSelectDialog(cameraAction: () {
|
|
|
- //相机的选项
|
|
|
- PermissionEngine().requestCameraPermission(() {
|
|
|
- //调用相机引擎读取图片
|
|
|
- _selectFormCamera(context, (filePath) {
|
|
|
- complete(filePath);
|
|
|
- }, isCropped: isCropped, aspect: aspect);
|
|
|
- });
|
|
|
+
|
|
|
+ if (DeviceUtils.isIOS) {
|
|
|
+ //IOS 申请两个权限,先申请 photo 权限,然后再拍照
|
|
|
+ PermissionEngine().requestPhotosPermission(() {
|
|
|
+ //相机权限
|
|
|
+ PermissionEngine().requestCameraPermission(() {
|
|
|
+ //调用相机引擎读取图片
|
|
|
+ _selectFormCamera(context, (filePath) {
|
|
|
+ complete(filePath);
|
|
|
+ }, isCropped: isCropped, aspect: aspect);
|
|
|
+ });
|
|
|
+
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+ //相机权限
|
|
|
+ PermissionEngine().requestCameraPermission(() {
|
|
|
+ //调用相机引擎读取图片
|
|
|
+ _selectFormCamera(context, (filePath) {
|
|
|
+ complete(filePath);
|
|
|
+ }, isCropped: isCropped, aspect: aspect);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
}, albumAction: () {
|
|
|
//相册的选项
|
|
|
PermissionEngine().requestPhotosPermission(() {
|