Skip to content

Commit c161b0c

Browse files
committed
✨ Expose ImageFormatGroup
1 parent 9356909 commit c161b0c

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

README-ZH.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Flutter SDK:`>=1.20.0` 。
5858
| textDelegate | `CameraPickerTextDelegate` | 控制部件中的文字实现 | `DefaultCameraPickerTextDelegate` |
5959
| resolutionPreset | `ResolutionPreset` | 相机的分辨率预设 | `ResolutionPreset.max` |
6060
| cameraQuarterTurns | `int` | 摄像机视图顺时针旋转次数,每次90度 | `0` |
61+
| imageFormatGroup | `ImageFormatGroup` | 输出图像的格式描述 | `ImageFormatGroup.jpeg` |
6162
| foregroundBuilder | `Widget Function(CameraValue)` | 覆盖在相机预览上方的前景构建 | null |
6263

6364
### 简单的使用方法

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ Reference:
8484
| textDelegate | `CameraPickerTextDelegate` | Text delegate that controls text in widgets. | `DefaultCameraPickerTextDelegate` |
8585
| resolutionPreset | `ResolutionPreset` | Present resolution for the camera. | `ResolutionPreset.max` |
8686
| cameraQuarterTurns | `int` | The number of clockwise quarter turns the camera view should be rotated. | `0` |
87+
| imageFormatGroup | `ImageFormatGroup` | Describes the output of the raw image format. | `ImageFormatGroup.jpeg` |
8788
| foregroundBuilder | `Widget Function(CameraValue)` | The foreground widget builder which will cover the whole camera preview. | null |
8889

8990
### Simple usage

lib/src/widget/camera_picker.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class CameraPicker extends StatefulWidget {
3838
this.maximumRecordingDuration = const Duration(seconds: 15),
3939
this.theme,
4040
this.resolutionPreset = ResolutionPreset.max,
41+
this.imageFormatGroup = ImageFormatGroup.jpeg,
4142
this.cameraQuarterTurns = 0,
4243
this.foregroundBuilder,
4344
CameraPickerTextDelegate textDelegate,
@@ -108,6 +109,13 @@ class CameraPicker extends StatefulWidget {
108109
/// 相机的分辨率预设
109110
final ResolutionPreset resolutionPreset;
110111

112+
/// The [ImageFormatGroup] describes the output of the raw image format.
113+
/// 输出图像的格式描述
114+
///
115+
/// When null the imageFormat will fallback to the platforms default.
116+
/// 为空时将使用平台默认值
117+
final ImageFormatGroup imageFormatGroup;
118+
111119
/// The foreground widget builder which will cover the whole camera preview.
112120
/// 覆盖在相机预览上方的前景构建
113121
final Widget Function(CameraValue) foregroundBuilder;
@@ -127,6 +135,7 @@ class CameraPicker extends StatefulWidget {
127135
int cameraQuarterTurns = 0,
128136
CameraPickerTextDelegate textDelegate,
129137
ResolutionPreset resolutionPreset = ResolutionPreset.max,
138+
ImageFormatGroup imageFormatGroup = ImageFormatGroup.jpeg,
130139
Widget Function(CameraValue) foregroundBuilder,
131140
}) async {
132141
if (enableRecording != true && onlyEnableRecording == true) {
@@ -152,6 +161,7 @@ class CameraPicker extends StatefulWidget {
152161
cameraQuarterTurns: cameraQuarterTurns,
153162
textDelegate: textDelegate,
154163
resolutionPreset: resolutionPreset,
164+
imageFormatGroup: imageFormatGroup,
155165
foregroundBuilder: foregroundBuilder,
156166
),
157167
transitionCurve: Curves.easeIn,
@@ -449,6 +459,7 @@ class CameraPickerState extends State<CameraPicker>
449459
cameraDescription ?? cameras[0],
450460
widget.resolutionPreset,
451461
enableAudio: enableAudio,
462+
imageFormatGroup: widget.imageFormatGroup,
452463
)..addListener(() {
453464
if (controller.value.hasError) {
454465
realDebugPrint('Camera error ${controller.value.errorDescription}');

0 commit comments

Comments
 (0)