@@ -36,6 +36,7 @@ class CameraPicker extends StatefulWidget {
36
36
this .theme,
37
37
this .resolutionPreset = ResolutionPreset .max,
38
38
this .cameraQuarterTurns = 0 ,
39
+ this .foregroundBuilder,
39
40
CameraPickerTextDelegate textDelegate,
40
41
}) : assert (
41
42
isAllowRecording == true || isOnlyAllowRecording != true ,
@@ -87,6 +88,10 @@ class CameraPicker extends StatefulWidget {
87
88
/// 相机的分辨率预设
88
89
final ResolutionPreset resolutionPreset;
89
90
91
+ /// The foreground widget builder which will cover the whole camera preview.
92
+ /// 覆盖在相机预览上方的前景构建
93
+ final Widget Function (CameraValue ) foregroundBuilder;
94
+
90
95
/// Static method to create [AssetEntity] through camera.
91
96
/// 通过相机创建 [AssetEntity] 的静态方法
92
97
static Future <AssetEntity > pickFromCamera (
@@ -100,6 +105,7 @@ class CameraPicker extends StatefulWidget {
100
105
int cameraQuarterTurns = 0 ,
101
106
CameraPickerTextDelegate textDelegate,
102
107
ResolutionPreset resolutionPreset = ResolutionPreset .max,
108
+ Widget Function (CameraValue ) foregroundBuilder,
103
109
}) async {
104
110
if (isAllowRecording != true && isOnlyAllowRecording == true ) {
105
111
throw ArgumentError ('Recording mode error.' );
@@ -122,6 +128,7 @@ class CameraPicker extends StatefulWidget {
122
128
cameraQuarterTurns: cameraQuarterTurns,
123
129
textDelegate: textDelegate,
124
130
resolutionPreset: resolutionPreset,
131
+ foregroundBuilder: foregroundBuilder,
125
132
),
126
133
transitionCurve: Curves .easeIn,
127
134
transitionDuration: _kRouteDuration,
@@ -949,6 +956,10 @@ class CameraPickerState extends State<CameraPicker>
949
956
children: < Widget > [
950
957
Positioned .fill (child: _cameraPreview (context)),
951
958
_focusingAreaWidget,
959
+ if (widget.foregroundBuilder != null )
960
+ Positioned .fill (
961
+ child: widget.foregroundBuilder (value),
962
+ ),
952
963
],
953
964
),
954
965
),
0 commit comments