showPickers method

void showPickers({
  1. required PickersArguments arguments,
  2. required PickersLangs langArguments,
  3. required PickersPermission permission,
  4. required OnPickerSelectorCall selectorCall,
  5. PickMode mode = PickMode.all,
  6. String? action,
})

图片、视频选择器 arguments 图片选择器参数 langArguments 多语言配置参数 permissions 审核拍照、图片、存储权限 Android调用权限值: AndroidPermission.readExternalStorage AndroidPermission.writeExternalStorage AndroidPermission.camera iOS调用权限值: mode 选择模式 全部 照片 视频

Implementation

void showPickers(
    {required PickersArguments arguments,
    required PickersLangs langArguments,
    required PickersPermission permission,
    required OnPickerSelectorCall selectorCall,
    PickMode mode = PickMode.all,
    String? action}) {
  this._langs = langArguments;
  this._arguments = arguments;
  var prompt = _getPickerPrompt(permission: permission, mode: mode);
  var permissions = _getPickerPermissions(permission: permission, mode: mode);

  /// 这里的权限申请只处理打开选择器页面权限,
  /// 选择器内部操作若需要需在native层再次申请
  PermissionUtils.instance.apply(
      prompt: prompt,
      permissions: permissions,
      permissionCall: (granted) {
        if (action.isNotEmptyString) {
          MmkvUtils.instance.putBool(action!, value: granted, part: MMkvPart.state);
        }
        if (granted) {
          _pickersSelector(mode: mode, permission: permission, selectorCall: selectorCall);
        } else {
          selectorCall([]);
        }
      });
}