粘贴删除按钮不参与过渡

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

3
devtools_options.yaml Normal file
View File

@@ -0,0 +1,3 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:

View File

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