优化了 启动录制效果

This commit is contained in:
2026-06-05 18:52:47 +08:00
parent 26098114d2
commit e1446337e9
4 changed files with 22 additions and 5 deletions

View File

@@ -96,6 +96,15 @@ class RecordingCameraController(
return return
} }
if (
boundLifecycleOwner === lifecycleOwner &&
preview != null &&
videoCapture != null
) {
onReady(true)
return
}
try { try {
boundLifecycleOwner = lifecycleOwner boundLifecycleOwner = lifecycleOwner
provider.unbindAll() provider.unbindAll()

View File

@@ -298,7 +298,10 @@ class _RecordingPageState extends ConsumerState<RecordingPage> {
onUnlocked: () => viewModel.setTouchLocked(false), onUnlocked: () => viewModel.setTouchLocked(false),
), ),
if (state.isStartingRecording) if (state.isStartingRecording)
const RecordingLoadingOverlayWidget(message: '正在开始录制…'), RecordingLoadingOverlayWidget(
message: '正在开始录制…',
backgroundColor: Colors.black.withValues(alpha: 0.24),
),
], ],
), ),
), ),

View File

@@ -46,8 +46,8 @@ class RecordingControlButton extends StatelessWidget {
), ),
), ),
AnimatedContainer( AnimatedContainer(
duration: const Duration(milliseconds: 300), duration: const Duration(milliseconds: 500),
curve: Curves.easeInOutCubic, curve: Curves.ease,
width: innerSize, width: innerSize,
height: innerSize, height: innerSize,
decoration: BoxDecoration( decoration: BoxDecoration(

View File

@@ -3,15 +3,20 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
/// 录制加载遮罩(相机启动/开始录制) /// 录制加载遮罩(相机启动/开始录制)
class RecordingLoadingOverlayWidget extends StatelessWidget { class RecordingLoadingOverlayWidget extends StatelessWidget {
const RecordingLoadingOverlayWidget({super.key, required this.message}); const RecordingLoadingOverlayWidget({
super.key,
required this.message,
this.backgroundColor = Colors.black,
});
final String message; final String message;
final Color backgroundColor;
@override @override
/// 显示加载动画与提示文案 /// 显示加载动画与提示文案
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ColoredBox( return ColoredBox(
color: Colors.black, color: backgroundColor,
child: Center( child: Center(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,