Skip to content

Commit 56e1b62

Browse files
committed
♻️ allowRecording -> enableRecording
1 parent 8d3013e commit 56e1b62

File tree

5 files changed

+49
-49
lines changed

5 files changed

+49
-49
lines changed

README-ZH.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,20 @@ Flutter SDK:`>=1.20.0` 。
4545

4646
## 使用方法 📖
4747

48-
| 参数名 | 类型 | 描述 | 默认值 |
49-
| ---------------------------- | ------------------------------ | ----------------------------------------------------------------- | -------------------------------------- |
50-
| allowRecording | `bool` | 选择器是否可以录像 | `false` |
51-
| onlyAllowRecording | `bool` | 选择器是否仅可以录像。只在 `isAllowRecording``true` 时有效。 | `false` |
52-
| enabledAudio | `bool` | 选择器是否需要录制音频。只于录像配合有效。 | `true` |
53-
| enableSetExposure | `bool` | 用户是否可以在界面上通过点击设定曝光点 | `true` |
54-
| enableExposureControlOnPoint | `bool` | 用户是否可以根据已经设置的曝光点调节曝光度 | `true` |
55-
| enablePinchToZoom | `bool` | 用户是否可以在界面上双指缩放相机对焦 | `true` |
56-
| maximumRecordingDuration | `Duration` | 录制视频最长时长 | `const Duration(seconds: 15)` |
57-
| theme | `ThemeData` | 选择器的主题 | `CameraPicker.themeData(C.themeColor)` |
58-
| textDelegate | `CameraPickerTextDelegate` | 控制部件中的文字实现 | `DefaultCameraPickerTextDelegate` |
59-
| resolutionPreset | `ResolutionPreset` | 相机的分辨率预设 | `ResolutionPreset.max` |
60-
| cameraQuarterTurns | `int` | 摄像机视图顺时针旋转次数,每次90度 | `0` |
61-
| foregroundBuilder | `Widget Function(CameraValue)` | 覆盖在相机预览上方的前景构建 | null |
48+
| 参数名 | 类型 | 描述 | 默认值 |
49+
| ---------------------------- | ------------------------------ | ---------------------------------------------------------------- | -------------------------------------- |
50+
| enableRecording | `bool` | 选择器是否可以录像 | `false` |
51+
| onlyEnableRecording | `bool` | 选择器是否仅可以录像。只在 `enableRecording``true` 时有效。 | `false` |
52+
| enabledAudio | `bool` | 选择器是否需要录制音频。只于录像配合有效。 | `true` |
53+
| enableSetExposure | `bool` | 用户是否可以在界面上通过点击设定曝光点 | `true` |
54+
| enableExposureControlOnPoint | `bool` | 用户是否可以根据已经设置的曝光点调节曝光度 | `true` |
55+
| enablePinchToZoom | `bool` | 用户是否可以在界面上双指缩放相机对焦 | `true` |
56+
| maximumRecordingDuration | `Duration` | 录制视频最长时长 | `const Duration(seconds: 15)` |
57+
| theme | `ThemeData` | 选择器的主题 | `CameraPicker.themeData(C.themeColor)` |
58+
| textDelegate | `CameraPickerTextDelegate` | 控制部件中的文字实现 | `DefaultCameraPickerTextDelegate` |
59+
| resolutionPreset | `ResolutionPreset` | 相机的分辨率预设 | `ResolutionPreset.max` |
60+
| cameraQuarterTurns | `int` | 摄像机视图顺时针旋转次数,每次90度 | `0` |
61+
| foregroundBuilder | `Widget Function(CameraValue)` | 覆盖在相机预览上方的前景构建 | null |
6262

6363
### 简单的使用方法
6464

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,20 @@ Reference:
7171

7272
## Usage 📖
7373

74-
| Name | Type | Description | Default Value |
75-
| ---------------------------- | ------------------------------ | -------------------------------------------------------------------------------------------- | -------------------------------------- |
76-
| allowRecording | `bool` | Whether the picker can record video. | `false` |
77-
| onlyAllowRecording | `bool` | Whether the picker can only record video. Only available when `isAllowRecording` is `true `. | `false` |
78-
| enableAudio | `bool` | Whether Whether the picker should record audio. Only available with recording. | `true` |
79-
| enableSetExposure | `bool` | Whether users can set the exposure point by tapping. | `true` |
80-
| enableExposureControlOnPoint | `bool` | Whether users can adjust exposure according to the set point. | `true` |
81-
| enablePinchToZoom | `bool` | Whether users can zoom the camera by pinch. | `true` |
82-
| maximumRecordingDuration | `Duration` | The maximum duration of the video recording process. | `const Duration(seconds: 15)` |
83-
| theme | `ThemeData` | Theme data for the picker. | `CameraPicker.themeData(C.themeColor)` |
84-
| textDelegate | `CameraPickerTextDelegate` | Text delegate that controls text in widgets. | `DefaultCameraPickerTextDelegate` |
85-
| resolutionPreset | `ResolutionPreset` | Present resolution for the camera. | `ResolutionPreset.max` |
86-
| cameraQuarterTurns | `int` | The number of clockwise quarter turns the camera view should be rotated. | `0` |
87-
| foregroundBuilder | `Widget Function(CameraValue)` | The foreground widget builder which will cover the whole camera preview. | null |
74+
| Name | Type | Description | Default Value |
75+
| ---------------------------- | ------------------------------ | ----------------------------------------------------------------------------------------- - | -------------------------------------- |
76+
| enableRecording | `bool` | Whether the picker can record video. | `false` |
77+
| onlyEnableRecording | `bool` | Whether the picker can only record video. Only available when `enableRecording` is `true `. | `false` |
78+
| enableAudio | `bool` | Whether Whether the picker should record audio. Only available with recording. | `true` |
79+
| enableSetExposure | `bool` | Whether users can set the exposure point by tapping. | `true` |
80+
| enableExposureControlOnPoint | `bool` | Whether users can adjust exposure according to the set point. | `true` |
81+
| enablePinchToZoom | `bool` | Whether users can zoom the camera by pinch. | `true` |
82+
| maximumRecordingDuration | `Duration` | The maximum duration of the video recording process. | `const Duration(seconds: 15)` |
83+
| theme | `ThemeData` | Theme data for the picker. | `CameraPicker.themeData(C.themeColor)` |
84+
| textDelegate | `CameraPickerTextDelegate` | Text delegate that controls text in widgets. | `DefaultCameraPickerTextDelegate` |
85+
| resolutionPreset | `ResolutionPreset` | Present resolution for the camera. | `ResolutionPreset.max` |
86+
| cameraQuarterTurns | `int` | The number of clockwise quarter turns the camera view should be rotated. | `0` |
87+
| foregroundBuilder | `Widget Function(CameraValue)` | The foreground widget builder which will cover the whole camera preview. | null |
8888

8989
### Simple usage
9090

example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class _MyHomePageState extends State<MyHomePage> {
4848
onPressed: () {
4949
CameraPicker.pickFromCamera(
5050
context,
51-
allowRecording: true,
51+
enableRecording: true,
5252
);
5353
},
5454
tooltip: 'Increment',

lib/src/constants/constants.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Constants {
2727
/// 只在调试模式打印
2828
void realDebugPrint(dynamic message) {
2929
if (!kReleaseMode) {
30-
log('$message');
30+
log('$message', name: 'CameraPicker - LOG');
3131
}
3232
}
3333

lib/src/widget/camera_picker.dart

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ const Duration _kRouteDuration = Duration(milliseconds: 300);
2828
class CameraPicker extends StatefulWidget {
2929
CameraPicker({
3030
Key key,
31-
this.allowRecording = false,
32-
this.onlyAllowRecording = false,
31+
this.enableRecording = false,
32+
this.onlyEnableRecording = false,
3333
this.enableAudio = true,
3434
this.enableSetExposure = true,
3535
this.enableExposureControlOnPoint = true,
@@ -40,8 +40,8 @@ class CameraPicker extends StatefulWidget {
4040
this.cameraQuarterTurns = 0,
4141
this.foregroundBuilder,
4242
CameraPickerTextDelegate textDelegate,
43-
}) : assert(allowRecording != null),
44-
assert(onlyAllowRecording != null),
43+
}) : assert(enableRecording != null),
44+
assert(onlyEnableRecording != null),
4545
assert(enableAudio != null),
4646
assert(enablePinchToZoom != null),
4747
assert(enableSetExposure != null),
@@ -50,7 +50,7 @@ class CameraPicker extends StatefulWidget {
5050
assert(resolutionPreset != null),
5151
assert(cameraQuarterTurns != null),
5252
assert(
53-
allowRecording == true || onlyAllowRecording != true,
53+
enableRecording == true || onlyEnableRecording != true,
5454
'Recording mode error.',
5555
),
5656
assert(
@@ -59,7 +59,7 @@ class CameraPicker extends StatefulWidget {
5959
),
6060
super(key: key) {
6161
Constants.textDelegate = textDelegate ??
62-
(allowRecording
62+
(enableRecording
6363
? DefaultCameraPickerTextDelegateWithRecording()
6464
: DefaultCameraPickerTextDelegate());
6565
}
@@ -70,11 +70,11 @@ class CameraPicker extends StatefulWidget {
7070

7171
/// Whether the picker can record video.
7272
/// 选择器是否可以录像
73-
final bool allowRecording;
73+
final bool enableRecording;
7474

7575
/// Whether the picker can record video.
7676
/// 选择器是否可以录像
77-
final bool onlyAllowRecording;
77+
final bool onlyEnableRecording;
7878

7979
/// Whether the picker should record audio.
8080
/// 选择器录像时是否需要录制声音
@@ -115,8 +115,8 @@ class CameraPicker extends StatefulWidget {
115115
/// 通过相机创建 [AssetEntity] 的静态方法
116116
static Future<AssetEntity> pickFromCamera(
117117
BuildContext context, {
118-
bool allowRecording = false,
119-
bool onlyAllowRecording = false,
118+
bool enableRecording = false,
119+
bool onlyEnableRecording = false,
120120
bool enableAudio = true,
121121
bool enableSetExposure = true,
122122
bool enableExposureControlOnPoint = true,
@@ -128,7 +128,7 @@ class CameraPicker extends StatefulWidget {
128128
ResolutionPreset resolutionPreset = ResolutionPreset.max,
129129
Widget Function(CameraValue) foregroundBuilder,
130130
}) async {
131-
if (allowRecording != true && onlyAllowRecording == true) {
131+
if (enableRecording != true && onlyEnableRecording == true) {
132132
throw ArgumentError('Recording mode error.');
133133
}
134134
if (resolutionPreset == null) {
@@ -140,8 +140,8 @@ class CameraPicker extends StatefulWidget {
140140
).push<AssetEntity>(
141141
SlidePageTransitionBuilder<AssetEntity>(
142142
builder: CameraPicker(
143-
allowRecording: allowRecording,
144-
onlyAllowRecording: onlyAllowRecording,
143+
enableRecording: enableRecording,
144+
onlyEnableRecording: onlyEnableRecording,
145145
enableAudio: enableAudio,
146146
enableSetExposure: enableSetExposure,
147147
enableExposureControlOnPoint: enableExposureControlOnPoint,
@@ -294,13 +294,13 @@ class CameraPickerState extends State<CameraPicker>
294294
////////////////////////////// Global Getters //////////////////////////////
295295
////////////////////////////////////////////////////////////////////////////
296296
297-
bool get allowRecording => widget.allowRecording;
297+
bool get enableRecording => widget.enableRecording;
298298

299-
bool get onlyAllowRecording => widget.onlyAllowRecording;
299+
bool get onlyEnableRecording => widget.onlyEnableRecording;
300300

301301
/// No audio integration required when it's only for camera.
302302
/// 在仅允许拍照时不需要启用音频
303-
bool get enableAudio => allowRecording && widget.enableAudio;
303+
bool get enableAudio => enableRecording && widget.enableAudio;
304304

305305
bool get enableSetExposure => widget.enableSetExposure;
306306

@@ -771,11 +771,11 @@ class CameraPickerState extends State<CameraPicker>
771771
final Size outerSize = Size.square(Screens.width / 3.5);
772772
return Listener(
773773
behavior: HitTestBehavior.opaque,
774-
onPointerUp: allowRecording ? recordDetectionCancel : null,
774+
onPointerUp: enableRecording ? recordDetectionCancel : null,
775775
child: InkWell(
776776
borderRadius: maxBorderRadius,
777-
onTap: !onlyAllowRecording ? takePicture : null,
778-
onLongPress: allowRecording ? recordDetection : null,
777+
onTap: !onlyEnableRecording ? takePicture : null,
778+
onLongPress: enableRecording ? recordDetection : null,
779779
child: SizedBox.fromSize(
780780
size: outerSize,
781781
child: Stack(

0 commit comments

Comments
 (0)