cameraPicker static method
Future<AssetEntity?>
cameraPicker(
- BuildContext context, {
- bool isAllowRecording = false,
- bool isOnlyAllowRecording = false,
- bool enableAudio = false,
- Duration maximumRecordingDuration = const Duration(seconds: 15),
- 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;
}