diff --git a/lib/features/recording/recording_page.dart b/lib/features/recording/recording_page.dart index f97d867..dbe6e1c 100644 --- a/lib/features/recording/recording_page.dart +++ b/lib/features/recording/recording_page.dart @@ -98,6 +98,13 @@ class _RecordingPageState extends ConsumerState { await ref.read(recordingSessionControllerProvider.notifier).startRecording(); } + void _clearClipboardForNewRound() { + ref.read(recordingViewModelProvider.notifier).resetClipboardInfo(); + ref + .read(recordingSessionControllerProvider.notifier) + .clearSavedRecordingResult(); + } + Future _showRecordingSavedDialogIfNeeded() async { final session = ref.read(recordingSessionControllerProvider); if (session.lastSavedDisplayName == null || session.gallerySaveFailed) { @@ -118,12 +125,7 @@ class _RecordingPageState extends ConsumerState { .read(recordingSessionControllerProvider.notifier) .clearSavedRecordingResult(); }, - onRecordNewRound: () { - ref.read(recordingViewModelProvider.notifier).resetClipboardInfo(); - ref - .read(recordingSessionControllerProvider.notifier) - .clearSavedRecordingResult(); - }, + onRecordNewRound: _clearClipboardForNewRound, ); } @@ -188,6 +190,7 @@ class _RecordingPageState extends ConsumerState { eventAddress: showClipboardInfo ? clipboard.address : null, showClipboardHint: showClipboardInfo, clipboardAddress: clipboard.address.trim(), + onClearEventInfo: _clearClipboardForNewRound, onPasteEventInfo: () async { final result = await ref .read(recordingViewModelProvider.notifier) @@ -268,6 +271,7 @@ class _RecordingHud extends StatelessWidget { this.eventAddress, this.showClipboardHint = false, this.clipboardAddress = '', + required this.onClearEventInfo, required this.onPasteEventInfo, required this.onStart, required this.onStop, @@ -281,6 +285,7 @@ class _RecordingHud extends StatelessWidget { final String? eventAddress; final bool showClipboardHint; final String clipboardAddress; + final VoidCallback onClearEventInfo; final Future Function() onPasteEventInfo; final Future Function() onStart; final Future Function() onStop; @@ -446,15 +451,36 @@ class _RecordingHud extends StatelessWidget { right: 12.w, child: Padding( padding: EdgeInsets.only(right: state.isRecording ? 96.w : 0), - child: Text( - eventTitle!, - style: _overlayTextStyle.copyWith( - fontSize: 16.sp, - fontWeight: FontWeight.w600, - ), - textAlign: TextAlign.center, - maxLines: 2, - overflow: TextOverflow.ellipsis, + child: Row( + children: [ + Expanded( + child: Text( + eventTitle!, + style: _overlayTextStyle.copyWith( + fontSize: 16.sp, + fontWeight: FontWeight.w600, + ), + textAlign: TextAlign.center, + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), + ), + if (!state.isRecording) + IconButton( + onPressed: onClearEventInfo, + icon: Icon( + Icons.delete_outline, + color: Colors.white, + size: 22.r, + ), + padding: EdgeInsets.zero, + constraints: BoxConstraints( + minWidth: 40.r, + minHeight: 40.r, + ), + tooltip: '删除', + ), + ], ), ), ),