cameraPicker method Null safety

Future<AssetEntity?> cameraPicker(
  1. BuildContext context,
  2. {bool isAllowRecording = false,
  3. bool isOnlyAllowRecording = false,
  4. bool enableAudio = false,
  5. Duration maximumRecordingDuration = const Duration(seconds: 15),
  6. ResolutionPreset resolutionPreset = ResolutionPreset.high}
)

拍照/视频

isAllowRecording 选择器是否可以录像 isOnlyAllowRecording 选择器是否可以录像 enableAudio 选择器录像时是否需要录制声音 maximumRecordingDuration 录制视频最长时长 resolutionPreset 相机的分辨率预设

Implementation

static Future<AssetEntity?> cameraPicker(BuildContext context,
    {bool isAllowRecording = false,
    bool isOnlyAllowRecording = false,
    bool enableAudio = false,
    Duration maximumRecordingDuration = const Duration(seconds: 15),
    ResolutionPreset resolutionPreset = ResolutionPreset.high}) async {
  /// 拉起相机

  final AssetEntity? entity = await CameraPicker.pickFromCamera(context,
      enableRecording: isAllowRecording,
      onlyEnableRecording: isOnlyAllowRecording,
      enableAudio: enableAudio,
      maximumRecordingDuration: maximumRecordingDuration,
      resolutionPreset: resolutionPreset);
  return entity;
}