mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-19 02:31:09 +00:00
132 lines
4.2 KiB
Dart
132 lines
4.2 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:stackwallet/models/isar/models/isar_models.dart';
|
|
import 'package:stackwallet/notifications/show_flush_bar.dart';
|
|
import 'package:stackwallet/pages/receive_view/addresses/address_qr_popup.dart';
|
|
import 'package:stackwallet/pages/receive_view/addresses/edit_address_label_view.dart';
|
|
import 'package:stackwallet/utilities/clipboard_interface.dart';
|
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
|
import 'package:stackwallet/utilities/text_styles.dart';
|
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
|
import 'package:stackwallet/widgets/custom_buttons/blue_text_button.dart';
|
|
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
|
import 'package:stackwallet/widgets/icon_widgets/copy_icon.dart';
|
|
import 'package:stackwallet/widgets/icon_widgets/qrcode_icon.dart';
|
|
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
|
import 'package:tuple/tuple.dart';
|
|
|
|
class AddressCard extends StatelessWidget {
|
|
const AddressCard({
|
|
Key? key,
|
|
required this.address,
|
|
required this.walletId,
|
|
required this.coin,
|
|
this.clipboard = const ClipboardWrapper(),
|
|
}) : super(key: key);
|
|
|
|
final Address address;
|
|
final String walletId;
|
|
final Coin coin;
|
|
final ClipboardInterface clipboard;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return RoundedWhiteContainer(
|
|
child: Column(
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
"TODO: label",
|
|
style: STextStyles.itemSubtitle(context),
|
|
),
|
|
CustomTextButton(
|
|
text: "Edit label",
|
|
textSize: 14,
|
|
onTap: () {
|
|
Navigator.of(context).pushNamed(
|
|
EditAddressLabelView.routeName,
|
|
arguments: Tuple2(
|
|
address,
|
|
walletId,
|
|
),
|
|
);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(
|
|
height: 8,
|
|
),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: SelectableText(
|
|
address.value,
|
|
style: STextStyles.itemSubtitle12(context),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
const SizedBox(
|
|
height: 10,
|
|
),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: SecondaryButton(
|
|
label: "Copy address",
|
|
icon: CopyIcon(
|
|
color: Theme.of(context)
|
|
.extension<StackColors>()!
|
|
.buttonTextSecondary,
|
|
),
|
|
onPressed: () async {
|
|
await clipboard.setData(
|
|
ClipboardData(
|
|
text: address.value,
|
|
),
|
|
);
|
|
unawaited(
|
|
showFloatingFlushBar(
|
|
type: FlushBarType.info,
|
|
message: "Copied to clipboard",
|
|
context: context,
|
|
),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
const SizedBox(
|
|
width: 12,
|
|
),
|
|
Expanded(
|
|
child: SecondaryButton(
|
|
label: "Show QR Code",
|
|
icon: QrCodeIcon(
|
|
color: Theme.of(context)
|
|
.extension<StackColors>()!
|
|
.buttonTextSecondary,
|
|
),
|
|
onPressed: () {
|
|
showDialog<void>(
|
|
context: context,
|
|
builder: (context) => AddressQrPopup(
|
|
address: address,
|
|
coin: coin,
|
|
clipboard: clipboard,
|
|
),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|