粘贴删除按钮不参与过渡

This commit is contained in:
2026-06-08 15:51:05 +08:00
parent 7ab03dd912
commit 41fcd730f0
2 changed files with 40 additions and 39 deletions

View File

@@ -26,7 +26,7 @@ class RecordHeaderWidget extends StatelessWidget {
bool get _showEventTitle => hasValidClipboardInfo;
Widget _buildHeaderContent() {
Widget _buildAnimatedHeaderContent() {
if (_showEventTitle) {
return _HeaderEventTitleRow(
key: ValueKey('title-${eventTitle ?? ''}'),
@@ -36,14 +36,6 @@ class RecordHeaderWidget extends StatelessWidget {
);
}
if (_showPasteButtons) {
return _HeaderPasteActions(
key: const ValueKey('paste-actions'),
onMockCopy: _mockCopyEventInfo,
onPasteEventInfo: onPasteEventInfo,
);
}
return const SizedBox.shrink(key: ValueKey('header-empty'));
}
@@ -72,13 +64,26 @@ class RecordHeaderWidget extends StatelessWidget {
fit: BoxFit.contain,
),
Expanded(
child: AnimatedSwitcher(
duration: RecordContentTransition.duration,
switchInCurve: Curves.easeOutCubic,
switchOutCurve: Curves.easeInCubic,
layoutBuilder: RecordContentTransition.stackLayoutBuilder,
transitionBuilder: RecordContentTransition.builder,
child: _buildHeaderContent(),
child: Stack(
alignment: Alignment.center,
children: [
AnimatedSwitcher(
duration: RecordContentTransition.duration,
switchInCurve: Curves.easeOutCubic,
switchOutCurve: Curves.easeInCubic,
layoutBuilder: RecordContentTransition.stackLayoutBuilder,
transitionBuilder: RecordContentTransition.builder,
child: _buildAnimatedHeaderContent(),
),
if (_showPasteButtons)
Align(
alignment: Alignment.centerRight,
child: _HeaderPasteActions(
onMockCopy: _mockCopyEventInfo,
onPasteEventInfo: onPasteEventInfo,
),
),
],
),
),
],
@@ -130,28 +135,22 @@ class _HeaderEventTitleRow extends StatelessWidget {
),
),
),
AnimatedSwitcher(
duration: RecordContentTransition.duration,
switchInCurve: Curves.easeOutCubic,
switchOutCurve: Curves.easeInCubic,
transitionBuilder: RecordContentTransition.builder,
child: !isRecording
? IconButton(
key: const ValueKey('clear-event-info'),
onPressed: onClearEventInfo,
icon: Assets.images.imageDelete.image(
width: 15.r,
height: 15.r,
fit: BoxFit.contain,
excludeFromSemantics: true,
),
padding: EdgeInsets.zero,
constraints: BoxConstraints(minWidth: 40.r, minHeight: 40.r),
alignment: Alignment.centerRight,
tooltip: '删除',
)
: const SizedBox.shrink(key: ValueKey('clear-event-info-hidden')),
),
!isRecording
? IconButton(
key: const ValueKey('clear-event-info'),
onPressed: onClearEventInfo,
icon: Assets.images.imageDelete.image(
width: 15.r,
height: 15.r,
fit: BoxFit.contain,
excludeFromSemantics: true,
),
padding: EdgeInsets.zero,
constraints: BoxConstraints(minWidth: 40.r, minHeight: 40.r),
alignment: Alignment.centerRight,
tooltip: '删除',
)
: const SizedBox.shrink(key: ValueKey('clear-event-info-hidden')),
],
);
}
@@ -159,7 +158,6 @@ class _HeaderEventTitleRow extends StatelessWidget {
class _HeaderPasteActions extends StatelessWidget {
const _HeaderPasteActions({
super.key,
required this.onMockCopy,
required this.onPasteEventInfo,
});