Skip to content

Commit 4edb4ee

Browse files
committed
♻️ isShowingProgress -> isRecording.
1 parent 895e5ae commit 4edb4ee

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lib/src/widget/camera_picker.dart

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ class _CameraPickerState extends State<CameraPicker> {
143143
/// 当长按拍照按钮时,会进入准备录制视频的状态,此时需要执行动画。
144144
bool isShootingButtonAnimate = false;
145145

146-
/// Whether the recording progress should display.
147-
/// 视频录制的进度是否显示
146+
/// Whether the recording progress started.
147+
/// 是否已开始录制视频
148148
///
149149
/// After [shootingButton] animated, the [CircleProgressBar] will become visible.
150150
/// 当拍照按钮动画执行结束后,进度将变为可见状态并开始更新其状态。
151-
bool isShowingProgress = false;
151+
bool isRecording = false;
152152

153153
/// The [Timer] for record start detection.
154154
/// 用于检测是否开始录制的定时器
@@ -363,7 +363,9 @@ class _CameraPickerState extends State<CameraPicker> {
363363
height: Screens.width / 3.5,
364364
child: Row(
365365
children: <Widget>[
366-
Expanded(child: Center(child: backButton)),
366+
Expanded(
367+
child: !isRecording ? Center(child: backButton) : const SizedBox.shrink(),
368+
),
367369
Expanded(child: Center(child: shootingButton)),
368370
const Spacer(),
369371
],
@@ -404,8 +406,8 @@ class _CameraPickerState extends State<CameraPicker> {
404406
behavior: HitTestBehavior.opaque,
405407
onPointerUp: (PointerUpEvent event) {
406408
recordDetectTimer?.cancel();
407-
if (isShowingProgress) {
408-
isShowingProgress = false;
409+
if (isRecording) {
410+
isRecording = false;
409411
if (mounted) {
410412
setState(() {});
411413
}
@@ -422,7 +424,7 @@ class _CameraPickerState extends State<CameraPicker> {
422424
onTap: () {},
423425
onLongPress: () {
424426
recordDetectTimer = Timer(recordDetectDuration, () {
425-
isShowingProgress = true;
427+
isRecording = true;
426428
if (mounted) {
427429
setState(() {});
428430
}
@@ -458,7 +460,7 @@ class _CameraPickerState extends State<CameraPicker> {
458460
),
459461
),
460462
),
461-
if (isShowingProgress)
463+
if (isRecording)
462464
CircleProgressBar(
463465
duration: 15.seconds,
464466
outerRadius: outerSize.width,

0 commit comments

Comments
 (0)