@@ -43,6 +43,7 @@ class CameraPicker extends StatefulWidget {
43
43
this .enablePinchToZoom = true ,
44
44
this .enablePullToZoomInRecord = true ,
45
45
this .shouldDeletePreviewFile = false ,
46
+ this .shouldAutoPreviewVideo = false ,
46
47
this .maximumRecordingDuration = const Duration (seconds: 15 ),
47
48
this .theme,
48
49
this .resolutionPreset = ResolutionPreset .max,
@@ -113,10 +114,18 @@ class CameraPicker extends StatefulWidget {
113
114
/// 用户是否可以在录制视频时上拉缩放
114
115
final bool enablePullToZoomInRecord;
115
116
117
+ /// {@template wechat_camera_picker.shouldDeletePreviewFile}
116
118
/// Whether the preview file will be delete when pop.
117
119
/// 返回页面时是否删除预览文件
120
+ /// {@endtemplate}
118
121
final bool shouldDeletePreviewFile;
119
122
123
+ /// {@template wechat_camera_picker.shouldAutoPreviewVideo}
124
+ /// Whether the video should be played instantly in the preview.
125
+ /// 在预览时是否直接播放视频
126
+ /// {@endtemplate}
127
+ final bool shouldAutoPreviewVideo;
128
+
120
129
/// The maximum duration of the video recording process.
121
130
/// 录制视频最长时长
122
131
///
@@ -164,6 +173,7 @@ class CameraPicker extends StatefulWidget {
164
173
bool enablePinchToZoom = true ,
165
174
bool enablePullToZoomInRecord = true ,
166
175
bool shouldDeletePreviewFile = false ,
176
+ bool shouldAutoPreviewVideo = false ,
167
177
Duration maximumRecordingDuration = const Duration (seconds: 15 ),
168
178
ThemeData ? theme,
169
179
int cameraQuarterTurns = 0 ,
@@ -194,6 +204,7 @@ class CameraPicker extends StatefulWidget {
194
204
enablePinchToZoom: enablePinchToZoom,
195
205
enablePullToZoomInRecord: enablePullToZoomInRecord,
196
206
shouldDeletePreviewFile: shouldDeletePreviewFile,
207
+ shouldAutoPreviewVideo: shouldAutoPreviewVideo,
197
208
maximumRecordingDuration: maximumRecordingDuration,
198
209
theme: theme,
199
210
cameraQuarterTurns: cameraQuarterTurns,
@@ -386,6 +397,8 @@ class CameraPickerState extends State<CameraPicker>
386
397
387
398
bool get shouldDeletePreviewFile => widget.shouldDeletePreviewFile;
388
399
400
+ bool get shouldAutoPreviewVideo => widget.shouldAutoPreviewVideo;
401
+
389
402
Duration ? get maximumRecordingDuration => widget.maximumRecordingDuration;
390
403
391
404
/// Whether the recording restricted to a specific duration.
@@ -769,6 +782,7 @@ class CameraPickerState extends State<CameraPicker>
769
782
previewXFile: _file,
770
783
theme: theme,
771
784
shouldDeletePreviewFile: shouldDeletePreviewFile,
785
+ shouldAutoPreviewVideo: shouldAutoPreviewVideo,
772
786
onEntitySaving: widget.onEntitySaving,
773
787
);
774
788
if (entity != null ) {
@@ -862,6 +876,7 @@ class CameraPickerState extends State<CameraPicker>
862
876
previewXFile: file,
863
877
theme: theme,
864
878
shouldDeletePreviewFile: shouldDeletePreviewFile,
879
+ shouldAutoPreviewVideo: shouldAutoPreviewVideo,
865
880
);
866
881
if (entity != null ) {
867
882
Navigator .of (context).pop (entity);
0 commit comments