重构录制页面,更新对话框逻辑,优化赛事信息粘贴功能,调整相关文本标签。
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:recording_tool/core/platform/app_platform_info.dart';
|
||||
import 'package:recording_tool/core/platform/device_health_checker.dart';
|
||||
import 'package:recording_tool/features/dialog/dialog-record.dart';
|
||||
import 'package:recording_tool/features/recording/model/model_recording.dart';
|
||||
import 'package:recording_tool/features/recording/platform/recording_platform.dart';
|
||||
import 'package:recording_tool/features/recording/utils/recording_display_name.dart';
|
||||
@@ -46,7 +47,11 @@ class _RecordingPageState extends ConsumerState<RecordingPage> {
|
||||
final lines = DeviceHealthChecker.warningLines(snapshot);
|
||||
if (lines.isEmpty) return;
|
||||
|
||||
await AppDialog.deviceHealthAlert(context, lines: lines);
|
||||
await RecordDialog.showSingle(
|
||||
context,
|
||||
title: lines.join('\n'),
|
||||
buttonText: '确定',
|
||||
);
|
||||
}
|
||||
|
||||
/// 页面启动:健康检查、读剪贴板、进入录制模式、准备相机会话
|
||||
@@ -92,21 +97,24 @@ class _RecordingPageState extends ConsumerState<RecordingPage> {
|
||||
return '录制完成';
|
||||
}
|
||||
|
||||
/// 从剪贴板粘贴赛事信息(与 header「粘贴赛事信息」一致)。
|
||||
Future<void> _pasteEventInfo() async {
|
||||
final result = await ref
|
||||
.read(recordingViewModelProvider.notifier)
|
||||
.getClipboardContent();
|
||||
if (!mounted) return;
|
||||
if (result != ClipboardReadResult.success) {
|
||||
AppToast.show('无选手信息');
|
||||
}
|
||||
}
|
||||
|
||||
/// 无选手信息时弹窗提示
|
||||
Future<void> _showNoPlayerInfoDialog() {
|
||||
return showDialog<void>(
|
||||
context: context,
|
||||
builder: (dialogContext) {
|
||||
return AlertDialog(
|
||||
content: const Text('无选手信息'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(dialogContext).pop(),
|
||||
child: const Text('确定'),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
return RecordDialog.showSingle(
|
||||
context,
|
||||
title: '无选手信息!',
|
||||
buttonText: '粘贴',
|
||||
onPressed: _pasteEventInfo,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -208,15 +216,7 @@ class _RecordingPageState extends ConsumerState<RecordingPage> {
|
||||
eventTitle: showClipboardInfo ? clipboard.title : null,
|
||||
isRecording: state.isRecording,
|
||||
elapsedLabel: state.elapsedLabel,
|
||||
onPasteEventInfo: () async {
|
||||
final result = await ref
|
||||
.read(recordingViewModelProvider.notifier)
|
||||
.getClipboardContent();
|
||||
if (!context.mounted) return;
|
||||
if (result != ClipboardReadResult.success) {
|
||||
AppToast.show('无赛事信息');
|
||||
}
|
||||
},
|
||||
onPasteEventInfo: _pasteEventInfo,
|
||||
onClearEventInfo: _clearClipboardForNewRound,
|
||||
),
|
||||
Expanded(
|
||||
|
||||
@@ -133,9 +133,9 @@ class _HeaderPasteActions extends StatelessWidget {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
// _HeaderActionButton(label: '模拟复制赛事信息', onPressed: onMockCopy),
|
||||
_HeaderActionButton(label: '模拟复制赛事信息', onPressed: onMockCopy),
|
||||
_HeaderActionButton(
|
||||
label: '粘贴赛事信息',
|
||||
label: '粘贴选手信息',
|
||||
onPressed: () => onPasteEventInfo(),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:recording_tool/features/dialog/dialog-record.dart';
|
||||
|
||||
/// 录制结束并保存到相册后的后续操作弹窗。
|
||||
Future<void> showRecordingSavedDialog(
|
||||
@@ -8,112 +8,13 @@ Future<void> showRecordingSavedDialog(
|
||||
required VoidCallback onContinueRound,
|
||||
required VoidCallback onRecordNewRound,
|
||||
}) {
|
||||
return showDialog<void>(
|
||||
context: context,
|
||||
return RecordDialog.showDouble(
|
||||
context,
|
||||
title: '本轮比赛视频已保存到相册\n请选择后续录制信息',
|
||||
leftText: '继续本轮',
|
||||
rightText: '录制新轮',
|
||||
onLeftPressed: onContinueRound,
|
||||
onRightPressed: onRecordNewRound,
|
||||
barrierDismissible: false,
|
||||
builder: (dialogContext) {
|
||||
return RecordingSavedDialogWidget(
|
||||
sessionTitle: sessionTitle,
|
||||
onContinueRound: () {
|
||||
Navigator.of(dialogContext).pop();
|
||||
onContinueRound();
|
||||
},
|
||||
onRecordNewRound: () {
|
||||
Navigator.of(dialogContext).pop();
|
||||
onRecordNewRound();
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
class RecordingSavedDialogWidget extends StatelessWidget {
|
||||
const RecordingSavedDialogWidget({
|
||||
super.key,
|
||||
required this.sessionTitle,
|
||||
required this.onContinueRound,
|
||||
required this.onRecordNewRound,
|
||||
});
|
||||
|
||||
final String sessionTitle;
|
||||
final VoidCallback onContinueRound;
|
||||
final VoidCallback onRecordNewRound;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Dialog(
|
||||
backgroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(4.r),
|
||||
side: const BorderSide(color: Colors.black, width: 1),
|
||||
),
|
||||
insetPadding: EdgeInsets.symmetric(horizontal: 32.w),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(20.w, 20.h, 20.w, 16.h),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
sessionTitle,
|
||||
style: TextStyle(
|
||||
fontSize: 15.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black87,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
SizedBox(height: 16.h),
|
||||
Text(
|
||||
'本轮比赛视频已保存到相册',
|
||||
style: TextStyle(fontSize: 14.sp, color: Colors.black87),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
SizedBox(height: 8.h),
|
||||
SizedBox(height: 20.h),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _RecordingDialogActionButton(
|
||||
label: '继续本轮',
|
||||
onPressed: onContinueRound,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 12.w),
|
||||
Expanded(
|
||||
child: _RecordingDialogActionButton(
|
||||
label: '录制新轮',
|
||||
onPressed: onRecordNewRound,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _RecordingDialogActionButton extends StatelessWidget {
|
||||
const _RecordingDialogActionButton({
|
||||
required this.label,
|
||||
required this.onPressed,
|
||||
});
|
||||
|
||||
final String label;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextButton(
|
||||
onPressed: onPressed,
|
||||
style: TextButton.styleFrom(
|
||||
backgroundColor: const Color(0xFFE8E8E8),
|
||||
foregroundColor: Colors.black87,
|
||||
padding: EdgeInsets.symmetric(vertical: 10.h),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(6.r)),
|
||||
),
|
||||
child: Text(label, style: TextStyle(fontSize: 14.sp)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user