fix: copy button behavior on receive page (#3424)

Konstantin Ullrich committed Jul 20, 2026 at 16:27 UTC 85bb70807c12a656cf984697787c2972fb73cefc
1 file changed +35 -34
lib/new-ui/widgets/receive_page/receive_bottom_buttons.dart
+35 -34
@@ -1,22 +1,10 @@
1 -import 'dart:io';
2 -
3 -import 'package:cake_wallet/generated/i18n.dart';
4 -import 'package:cake_wallet/new-ui/widgets/modern_button.dart';
5 -import 'package:device_info_plus/device_info_plus.dart';
6 -import 'package:flutter/material.dart';
7 -import 'package:flutter/services.dart';
8 -import 'package:cake_wallet/new-ui/widgets/copy_wrapper.dart';
1 +import "package:cake_wallet/generated/i18n.dart";
2 +import "package:cake_wallet/new-ui/widgets/copy_wrapper.dart";
3 +import "package:cake_wallet/new-ui/widgets/modern_button.dart";
4 +import "package:flutter/material.dart";
5 +import "package:flutter/services.dart";
6
7 class ReceiveBottomButtons extends StatefulWidget {
11 - final bool largeQrMode;
12 - final ClipboardData? copyData;
13 - final VoidCallback onCopyButtonPressed;
14 - final VoidCallback onAmountButtonPressed;
15 - final VoidCallback onLabelButtonPressed;
16 - final VoidCallback onAccountsButtonPressed;
17 - final bool showLabelButton;
18 - final bool showAccountsButton;
19 -
8 const ReceiveBottomButtons({
9 required this.largeQrMode,
10 required this.onCopyButtonPressed,
@@ -29,6 +17,15 @@ class ReceiveBottomButtons extends StatefulWidget {
17 super.key,
18 });
19
20 + final bool largeQrMode;
21 + final ClipboardData? copyData;
22 + final VoidCallback onCopyButtonPressed;
23 + final VoidCallback onAmountButtonPressed;
24 + final VoidCallback onLabelButtonPressed;
25 + final VoidCallback onAccountsButtonPressed;
26 + final bool showLabelButton;
27 + final bool showAccountsButton;
28 +
29 @override
30 State<ReceiveBottomButtons> createState() => _ReceiveBottomButtonsState();
31 }
@@ -49,7 +46,7 @@ class _ReceiveBottomButtonsState extends State<ReceiveBottomButtons> {
46 opacity: targetOpacity,
47 curve: Curves.easeOut,
48 child: Padding(
52 - padding: const EdgeInsets.symmetric(horizontal: 32.0),
49 + padding: const EdgeInsets.symmetric(horizontal: 32),
50 child: Row(
51 mainAxisSize: MainAxisSize.max,
52 mainAxisAlignment: MainAxisAlignment.center,
@@ -57,12 +54,13 @@ class _ReceiveBottomButtonsState extends State<ReceiveBottomButtons> {
54 children: [
55 GestureDetector(
56 onTap: widget.copyData == null ? widget.onCopyButtonPressed : null,
57 + behavior: HitTestBehavior.opaque,
58 child: IgnorePointer(
59 ignoring: widget.copyData == null,
60 child: CopyWrapper(
61 data: widget.copyData,
62 builder: (context, copied) => AnimatedSwitcher(
65 - duration: Duration(milliseconds: 200),
63 + duration: const Duration(milliseconds: 200),
64 child: IgnorePointer(
65 child: ModernButton.svg(
66 key: ValueKey(copied),
@@ -84,25 +82,28 @@ class _ReceiveBottomButtonsState extends State<ReceiveBottomButtons> {
82 ),
83 ),
84 ModernButton.svg(
87 - size: 60,
88 - iconSize: 32,
89 - svgPath: "assets/new-ui/set-amount.svg",
90 - onPressed: widget.onAmountButtonPressed,
91 - label: S.of(context).set_amount),
85 + size: 60,
86 + iconSize: 32,
87 + svgPath: "assets/new-ui/set-amount.svg",
88 + onPressed: widget.onAmountButtonPressed,
89 + label: S.of(context).set_amount,
90 + ),
91 if (widget.showLabelButton)
92 ModernButton.svg(
94 - size: 60,
95 - iconSize: 32,
96 - svgPath: "assets/new-ui/add-label.svg",
97 - onPressed: widget.onLabelButtonPressed,
98 - label: S.of(context).label),
93 + size: 60,
94 + iconSize: 32,
95 + svgPath: "assets/new-ui/add-label.svg",
96 + onPressed: widget.onLabelButtonPressed,
97 + label: S.of(context).label,
98 + ),
99 if (widget.showAccountsButton)
100 ModernButton.svg(
101 - size: 60,
102 - iconSize: 32,
103 - svgPath: "assets/new-ui/addr-book.svg",
104 - onPressed: widget.onAccountsButtonPressed,
105 - label: S.of(context).addresses),
101 + size: 60,
102 + iconSize: 32,
103 + svgPath: "assets/new-ui/addr-book.svg",
104 + onPressed: widget.onAccountsButtonPressed,
105 + label: S.of(context).addresses,
106 + ),
107 ],
108 ),
109 ),