mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-26 06:08:40 +01:00
fix: copy button behavior on receive page (#3424)
This commit is contained in:
@@ -1,22 +1,10 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/new-ui/widgets/modern_button.dart';
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:cake_wallet/new-ui/widgets/copy_wrapper.dart';
|
||||
import "package:cake_wallet/generated/i18n.dart";
|
||||
import "package:cake_wallet/new-ui/widgets/copy_wrapper.dart";
|
||||
import "package:cake_wallet/new-ui/widgets/modern_button.dart";
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter/services.dart";
|
||||
|
||||
class ReceiveBottomButtons extends StatefulWidget {
|
||||
final bool largeQrMode;
|
||||
final ClipboardData? copyData;
|
||||
final VoidCallback onCopyButtonPressed;
|
||||
final VoidCallback onAmountButtonPressed;
|
||||
final VoidCallback onLabelButtonPressed;
|
||||
final VoidCallback onAccountsButtonPressed;
|
||||
final bool showLabelButton;
|
||||
final bool showAccountsButton;
|
||||
|
||||
const ReceiveBottomButtons({
|
||||
required this.largeQrMode,
|
||||
required this.onCopyButtonPressed,
|
||||
@@ -29,6 +17,15 @@ class ReceiveBottomButtons extends StatefulWidget {
|
||||
super.key,
|
||||
});
|
||||
|
||||
final bool largeQrMode;
|
||||
final ClipboardData? copyData;
|
||||
final VoidCallback onCopyButtonPressed;
|
||||
final VoidCallback onAmountButtonPressed;
|
||||
final VoidCallback onLabelButtonPressed;
|
||||
final VoidCallback onAccountsButtonPressed;
|
||||
final bool showLabelButton;
|
||||
final bool showAccountsButton;
|
||||
|
||||
@override
|
||||
State<ReceiveBottomButtons> createState() => _ReceiveBottomButtonsState();
|
||||
}
|
||||
@@ -49,7 +46,7 @@ class _ReceiveBottomButtonsState extends State<ReceiveBottomButtons> {
|
||||
opacity: targetOpacity,
|
||||
curve: Curves.easeOut,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 32.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 32),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@@ -57,12 +54,13 @@ class _ReceiveBottomButtonsState extends State<ReceiveBottomButtons> {
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: widget.copyData == null ? widget.onCopyButtonPressed : null,
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: IgnorePointer(
|
||||
ignoring: widget.copyData == null,
|
||||
child: CopyWrapper(
|
||||
data: widget.copyData,
|
||||
builder: (context, copied) => AnimatedSwitcher(
|
||||
duration: Duration(milliseconds: 200),
|
||||
duration: const Duration(milliseconds: 200),
|
||||
child: IgnorePointer(
|
||||
child: ModernButton.svg(
|
||||
key: ValueKey(copied),
|
||||
@@ -84,25 +82,28 @@ class _ReceiveBottomButtonsState extends State<ReceiveBottomButtons> {
|
||||
),
|
||||
),
|
||||
ModernButton.svg(
|
||||
size: 60,
|
||||
iconSize: 32,
|
||||
svgPath: "assets/new-ui/set-amount.svg",
|
||||
onPressed: widget.onAmountButtonPressed,
|
||||
label: S.of(context).set_amount),
|
||||
size: 60,
|
||||
iconSize: 32,
|
||||
svgPath: "assets/new-ui/set-amount.svg",
|
||||
onPressed: widget.onAmountButtonPressed,
|
||||
label: S.of(context).set_amount,
|
||||
),
|
||||
if (widget.showLabelButton)
|
||||
ModernButton.svg(
|
||||
size: 60,
|
||||
iconSize: 32,
|
||||
svgPath: "assets/new-ui/add-label.svg",
|
||||
onPressed: widget.onLabelButtonPressed,
|
||||
label: S.of(context).label),
|
||||
size: 60,
|
||||
iconSize: 32,
|
||||
svgPath: "assets/new-ui/add-label.svg",
|
||||
onPressed: widget.onLabelButtonPressed,
|
||||
label: S.of(context).label,
|
||||
),
|
||||
if (widget.showAccountsButton)
|
||||
ModernButton.svg(
|
||||
size: 60,
|
||||
iconSize: 32,
|
||||
svgPath: "assets/new-ui/addr-book.svg",
|
||||
onPressed: widget.onAccountsButtonPressed,
|
||||
label: S.of(context).addresses),
|
||||
size: 60,
|
||||
iconSize: 32,
|
||||
svgPath: "assets/new-ui/addr-book.svg",
|
||||
onPressed: widget.onAccountsButtonPressed,
|
||||
label: S.of(context).addresses,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user