2023-05-26 21:21:16 +00:00
|
|
|
/*
|
|
|
|
* This file is part of Stack Wallet.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2023 Cypher Stack
|
|
|
|
* All Rights Reserved.
|
|
|
|
* The code is distributed under GPLv3 license, see LICENSE file for details.
|
|
|
|
* Generated by Cypher Stack on 2023-05-26
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2022-09-06 01:18:45 +00:00
|
|
|
import 'dart:async';
|
|
|
|
|
2023-12-27 16:01:13 +00:00
|
|
|
import 'package:dropdown_button2/dropdown_button2.dart';
|
2022-08-26 08:11:35 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/services.dart';
|
2022-09-06 01:18:45 +00:00
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
2022-08-26 08:11:35 +00:00
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
2023-12-27 16:01:13 +00:00
|
|
|
import 'package:isar/isar.dart';
|
2022-08-26 08:11:35 +00:00
|
|
|
import 'package:qr_flutter/qr_flutter.dart';
|
2023-04-10 20:23:52 +00:00
|
|
|
import 'package:stackwallet/models/isar/models/isar_models.dart';
|
2022-08-26 08:11:35 +00:00
|
|
|
import 'package:stackwallet/notifications/show_flush_bar.dart';
|
2023-03-07 17:12:51 +00:00
|
|
|
import 'package:stackwallet/pages/receive_view/addresses/wallet_addresses_view.dart';
|
2022-08-26 08:11:35 +00:00
|
|
|
import 'package:stackwallet/pages/receive_view/generate_receiving_uri_qr_code_view.dart';
|
2023-12-27 16:01:13 +00:00
|
|
|
import 'package:stackwallet/providers/db/main_db_provider.dart';
|
2022-09-06 01:18:45 +00:00
|
|
|
import 'package:stackwallet/providers/providers.dart';
|
2022-08-26 08:11:35 +00:00
|
|
|
import 'package:stackwallet/route_generator.dart';
|
2023-05-09 21:57:40 +00:00
|
|
|
import 'package:stackwallet/themes/stack_colors.dart';
|
2023-06-23 21:27:09 +00:00
|
|
|
import 'package:stackwallet/utilities/address_utils.dart';
|
2022-08-26 08:11:35 +00:00
|
|
|
import 'package:stackwallet/utilities/assets.dart';
|
|
|
|
import 'package:stackwallet/utilities/clipboard_interface.dart';
|
2023-02-01 15:29:51 +00:00
|
|
|
import 'package:stackwallet/utilities/constants.dart';
|
2022-08-26 08:11:35 +00:00
|
|
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
2024-04-24 22:36:12 +00:00
|
|
|
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
|
2022-08-26 08:11:35 +00:00
|
|
|
import 'package:stackwallet/utilities/text_styles.dart';
|
2023-11-03 19:46:55 +00:00
|
|
|
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
|
2024-05-08 16:39:09 +00:00
|
|
|
import 'package:stackwallet/wallets/wallet/impl/bitcoin_wallet.dart';
|
2024-04-24 22:36:12 +00:00
|
|
|
import 'package:stackwallet/wallets/wallet/intermediate/bip39_hd_wallet.dart';
|
|
|
|
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/bcash_interface.dart';
|
2023-11-16 22:25:20 +00:00
|
|
|
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/multi_address_interface.dart';
|
2023-12-27 16:01:13 +00:00
|
|
|
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/spark_interface.dart';
|
2022-11-25 19:24:01 +00:00
|
|
|
import 'package:stackwallet/widgets/background.dart';
|
2023-12-27 16:01:13 +00:00
|
|
|
import 'package:stackwallet/widgets/conditional_parent.dart';
|
2022-08-26 08:11:35 +00:00
|
|
|
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
2022-09-06 01:18:45 +00:00
|
|
|
import 'package:stackwallet/widgets/custom_buttons/blue_text_button.dart';
|
|
|
|
import 'package:stackwallet/widgets/custom_loading_overlay.dart';
|
2024-04-23 21:06:36 +00:00
|
|
|
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
|
|
|
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
2022-09-06 01:18:45 +00:00
|
|
|
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
2022-08-26 08:11:35 +00:00
|
|
|
|
2022-09-06 01:18:45 +00:00
|
|
|
class ReceiveView extends ConsumerStatefulWidget {
|
2022-08-26 08:11:35 +00:00
|
|
|
const ReceiveView({
|
2024-04-23 21:06:36 +00:00
|
|
|
super.key,
|
2022-09-06 01:18:45 +00:00
|
|
|
required this.walletId,
|
2023-04-10 20:23:52 +00:00
|
|
|
this.tokenContract,
|
2022-08-26 08:11:35 +00:00
|
|
|
this.clipboard = const ClipboardWrapper(),
|
2024-04-23 21:06:36 +00:00
|
|
|
});
|
2022-08-26 08:11:35 +00:00
|
|
|
|
|
|
|
static const String routeName = "/receiveView";
|
|
|
|
|
2022-09-06 01:18:45 +00:00
|
|
|
final String walletId;
|
2023-04-10 20:23:52 +00:00
|
|
|
final EthContract? tokenContract;
|
2022-08-26 08:11:35 +00:00
|
|
|
final ClipboardInterface clipboard;
|
|
|
|
|
2022-09-06 01:18:45 +00:00
|
|
|
@override
|
|
|
|
ConsumerState<ReceiveView> createState() => _ReceiveViewState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _ReceiveViewState extends ConsumerState<ReceiveView> {
|
|
|
|
late final Coin coin;
|
|
|
|
late final String walletId;
|
|
|
|
late final ClipboardInterface clipboard;
|
2024-04-24 22:36:12 +00:00
|
|
|
late final bool _supportsSpark;
|
|
|
|
late final bool _showMultiType;
|
2023-12-27 16:01:13 +00:00
|
|
|
|
2024-04-24 22:36:12 +00:00
|
|
|
int _currentIndex = 0;
|
|
|
|
|
|
|
|
final List<AddressType> _walletAddressTypes = [];
|
|
|
|
final Map<AddressType, String> _addressMap = {};
|
|
|
|
final Map<AddressType, StreamSubscription<Address?>> _addressSubMap = {};
|
2022-09-06 01:18:45 +00:00
|
|
|
|
|
|
|
Future<void> generateNewAddress() async {
|
2023-11-03 19:46:55 +00:00
|
|
|
final wallet = ref.read(pWallets).getWallet(walletId);
|
|
|
|
|
2023-11-16 22:25:20 +00:00
|
|
|
if (wallet is MultiAddressInterface) {
|
2023-11-03 19:46:55 +00:00
|
|
|
bool shouldPop = false;
|
|
|
|
unawaited(
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (_) {
|
|
|
|
return WillPopScope(
|
|
|
|
onWillPop: () async => shouldPop,
|
|
|
|
child: Container(
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.overlay
|
|
|
|
.withOpacity(0.5),
|
|
|
|
child: const CustomLoadingOverlay(
|
|
|
|
message: "Generating address",
|
|
|
|
eventBus: null,
|
|
|
|
),
|
2022-09-22 17:43:44 +00:00
|
|
|
),
|
2023-11-03 19:46:55 +00:00
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
);
|
2022-09-06 01:18:45 +00:00
|
|
|
|
2024-04-24 22:36:12 +00:00
|
|
|
final Address? address;
|
|
|
|
if (wallet is Bip39HDWallet && wallet is! BCashInterface) {
|
|
|
|
final type = DerivePathType.values.firstWhere(
|
|
|
|
(e) => e.getAddressType() == _walletAddressTypes[_currentIndex],
|
|
|
|
);
|
|
|
|
address = await wallet.generateNextReceivingAddress(
|
|
|
|
derivePathType: type,
|
|
|
|
);
|
|
|
|
await ref.read(mainDBProvider).isar.writeTxn(() async {
|
|
|
|
await ref.read(mainDBProvider).isar.addresses.put(address!);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
await wallet.generateNewReceivingAddress();
|
|
|
|
address = null;
|
|
|
|
}
|
2022-09-06 01:18:45 +00:00
|
|
|
|
2023-11-03 19:46:55 +00:00
|
|
|
shouldPop = true;
|
2022-09-06 01:18:45 +00:00
|
|
|
|
2023-11-03 19:46:55 +00:00
|
|
|
if (mounted) {
|
|
|
|
Navigator.of(context)
|
|
|
|
.popUntil(ModalRoute.withName(ReceiveView.routeName));
|
2024-04-24 22:36:12 +00:00
|
|
|
|
|
|
|
setState(() {
|
|
|
|
_addressMap[_walletAddressTypes[_currentIndex]] =
|
|
|
|
address?.value ?? ref.read(pWalletReceivingAddress(walletId));
|
|
|
|
});
|
2023-11-03 19:46:55 +00:00
|
|
|
}
|
2022-09-06 01:18:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-27 16:01:13 +00:00
|
|
|
Future<void> generateNewSparkAddress() async {
|
|
|
|
final wallet = ref.read(pWallets).getWallet(walletId);
|
|
|
|
if (wallet is SparkInterface) {
|
|
|
|
bool shouldPop = false;
|
|
|
|
unawaited(
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (_) {
|
|
|
|
return WillPopScope(
|
|
|
|
onWillPop: () async => shouldPop,
|
|
|
|
child: Container(
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.overlay
|
|
|
|
.withOpacity(0.5),
|
|
|
|
child: const CustomLoadingOverlay(
|
|
|
|
message: "Generating address",
|
|
|
|
eventBus: null,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
|
|
|
final address = await wallet.generateNextSparkAddress();
|
|
|
|
await ref.read(mainDBProvider).isar.writeTxn(() async {
|
|
|
|
await ref.read(mainDBProvider).isar.addresses.put(address);
|
|
|
|
});
|
|
|
|
|
|
|
|
shouldPop = true;
|
|
|
|
|
|
|
|
if (mounted) {
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
2024-04-24 22:36:12 +00:00
|
|
|
setState(() {
|
|
|
|
_addressMap[AddressType.spark] = address.value;
|
|
|
|
});
|
2023-12-27 16:01:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-06 01:18:45 +00:00
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
walletId = widget.walletId;
|
2023-11-03 19:46:55 +00:00
|
|
|
coin = ref.read(pWalletCoin(walletId));
|
2022-09-06 01:18:45 +00:00
|
|
|
clipboard = widget.clipboard;
|
2024-04-24 22:36:12 +00:00
|
|
|
final wallet = ref.read(pWallets).getWallet(walletId);
|
|
|
|
_supportsSpark = wallet is SparkInterface;
|
|
|
|
_showMultiType = _supportsSpark ||
|
|
|
|
(wallet is! BCashInterface &&
|
|
|
|
wallet is Bip39HDWallet &&
|
|
|
|
wallet.supportedAddressTypes.length > 1);
|
|
|
|
|
|
|
|
_walletAddressTypes.add(coin.primaryAddressType);
|
|
|
|
|
|
|
|
if (_showMultiType) {
|
|
|
|
if (_supportsSpark) {
|
|
|
|
_walletAddressTypes.insert(0, AddressType.spark);
|
|
|
|
} else {
|
|
|
|
_walletAddressTypes.addAll((wallet as Bip39HDWallet)
|
|
|
|
.supportedAddressTypes
|
|
|
|
.where((e) => e != coin.primaryAddressType));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-08 16:39:09 +00:00
|
|
|
if (_walletAddressTypes.length > 1 && wallet is BitcoinWallet) {
|
|
|
|
_walletAddressTypes.removeWhere((e) => e == AddressType.p2pkh);
|
|
|
|
}
|
|
|
|
|
2024-04-24 22:36:12 +00:00
|
|
|
_addressMap[_walletAddressTypes[_currentIndex]] =
|
|
|
|
ref.read(pWalletReceivingAddress(walletId));
|
2023-12-27 16:01:13 +00:00
|
|
|
|
2024-04-24 22:36:12 +00:00
|
|
|
if (_showMultiType) {
|
|
|
|
for (final type in _walletAddressTypes) {
|
|
|
|
_addressSubMap[type] = ref
|
|
|
|
.read(mainDBProvider)
|
|
|
|
.isar
|
|
|
|
.addresses
|
|
|
|
.where()
|
|
|
|
.walletIdEqualTo(walletId)
|
|
|
|
.filter()
|
|
|
|
.typeEqualTo(type)
|
|
|
|
.sortByDerivationIndexDesc()
|
|
|
|
.findFirst()
|
|
|
|
.asStream()
|
|
|
|
.listen((event) {
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
if (mounted) {
|
|
|
|
setState(() {
|
|
|
|
_addressMap[type] =
|
|
|
|
event?.value ?? _addressMap[type] ?? "[No address yet]";
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2023-12-27 16:01:13 +00:00
|
|
|
});
|
2024-04-24 22:36:12 +00:00
|
|
|
}
|
2023-12-27 16:01:13 +00:00
|
|
|
}
|
2022-09-06 01:18:45 +00:00
|
|
|
|
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
|
2023-12-27 16:01:13 +00:00
|
|
|
@override
|
|
|
|
void dispose() {
|
2024-04-24 22:36:12 +00:00
|
|
|
for (final subscription in _addressSubMap.values) {
|
|
|
|
subscription.cancel();
|
|
|
|
}
|
2023-12-27 16:01:13 +00:00
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
|
2022-08-26 08:11:35 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
debugPrint("BUILD: $runtimeType");
|
2022-09-06 01:18:45 +00:00
|
|
|
|
2023-04-10 20:23:52 +00:00
|
|
|
final ticker = widget.tokenContract?.symbol ?? coin.ticker;
|
|
|
|
|
2024-04-24 22:36:12 +00:00
|
|
|
final String address;
|
|
|
|
if (_showMultiType) {
|
|
|
|
address = _addressMap[_walletAddressTypes[_currentIndex]]!;
|
2023-12-27 16:01:13 +00:00
|
|
|
} else {
|
2024-04-24 22:36:12 +00:00
|
|
|
address = ref.watch(pWalletReceivingAddress(walletId));
|
2023-12-27 16:01:13 +00:00
|
|
|
}
|
|
|
|
|
2022-11-25 19:24:01 +00:00
|
|
|
return Background(
|
|
|
|
child: Scaffold(
|
|
|
|
backgroundColor: Theme.of(context).extension<StackColors>()!.background,
|
|
|
|
appBar: AppBar(
|
|
|
|
leading: AppBarBackButton(
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
title: Text(
|
2023-04-10 20:23:52 +00:00
|
|
|
"Receive $ticker",
|
2022-11-25 19:24:01 +00:00
|
|
|
style: STextStyles.navBarTitle(context),
|
|
|
|
),
|
2023-02-01 15:29:51 +00:00
|
|
|
actions: [
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
top: 10,
|
|
|
|
bottom: 10,
|
|
|
|
right: 10,
|
|
|
|
),
|
|
|
|
child: AspectRatio(
|
|
|
|
aspectRatio: 1,
|
|
|
|
child: AppBarIconButton(
|
2023-05-09 21:57:40 +00:00
|
|
|
semanticsLabel:
|
2023-05-14 03:24:42 +00:00
|
|
|
"Address List Pop-up Button. Opens A Pop-up For Address List Button.",
|
2023-02-01 15:29:51 +00:00
|
|
|
key: const Key("walletNetworkSettingsAddNewNodeViewButton"),
|
|
|
|
size: 36,
|
|
|
|
shadows: const [],
|
|
|
|
color: Theme.of(context).extension<StackColors>()!.background,
|
|
|
|
icon: SvgPicture.asset(
|
|
|
|
Assets.svg.verticalEllipsis,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.accentColorDark,
|
|
|
|
width: 20,
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
onPressed: () {
|
|
|
|
showDialog<dynamic>(
|
|
|
|
barrierColor: Colors.transparent,
|
|
|
|
barrierDismissible: true,
|
|
|
|
context: context,
|
|
|
|
builder: (_) {
|
|
|
|
return Stack(
|
|
|
|
children: [
|
|
|
|
Positioned(
|
|
|
|
top: 9,
|
|
|
|
right: 10,
|
|
|
|
child: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.popupBG,
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
Constants.size.circularBorderRadius,
|
|
|
|
),
|
|
|
|
// boxShadow: [CFColors.standardBoxShadow],
|
|
|
|
boxShadow: const [],
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
Navigator.of(context).pushNamed(
|
2023-03-06 21:09:32 +00:00
|
|
|
WalletAddressesView.routeName,
|
|
|
|
arguments: walletId,
|
2023-02-01 15:29:51 +00:00
|
|
|
);
|
|
|
|
},
|
|
|
|
child: RoundedWhiteContainer(
|
2023-02-02 21:37:59 +00:00
|
|
|
boxShadow: [
|
|
|
|
Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.standardBoxShadow,
|
|
|
|
],
|
2023-02-01 15:29:51 +00:00
|
|
|
child: Material(
|
|
|
|
color: Colors.transparent,
|
2023-02-02 21:37:59 +00:00
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
horizontal: 12,
|
|
|
|
),
|
|
|
|
child: Text(
|
|
|
|
"Address list",
|
|
|
|
style: STextStyles.field(context),
|
|
|
|
),
|
2023-02-01 15:29:51 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
2022-08-26 08:11:35 +00:00
|
|
|
),
|
2022-11-25 19:24:01 +00:00
|
|
|
body: Padding(
|
|
|
|
padding: const EdgeInsets.all(12),
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.all(4),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
children: [
|
2023-12-27 16:01:13 +00:00
|
|
|
ConditionalParent(
|
2024-04-24 22:36:12 +00:00
|
|
|
condition: _showMultiType,
|
2023-12-27 16:01:13 +00:00
|
|
|
builder: (child) => Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
children: [
|
2024-04-23 21:42:47 +00:00
|
|
|
Text(
|
|
|
|
"Address type",
|
|
|
|
style: STextStyles.w500_14(context).copyWith(
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.infoItemLabel,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 10,
|
|
|
|
),
|
2023-12-27 16:01:13 +00:00
|
|
|
DropdownButtonHideUnderline(
|
2024-04-24 22:36:12 +00:00
|
|
|
child: DropdownButton2<int>(
|
|
|
|
value: _currentIndex,
|
2023-12-27 16:01:13 +00:00
|
|
|
items: [
|
2024-04-24 22:36:12 +00:00
|
|
|
for (int i = 0;
|
|
|
|
i < _walletAddressTypes.length;
|
|
|
|
i++)
|
|
|
|
DropdownMenuItem(
|
|
|
|
value: i,
|
|
|
|
child: Text(
|
2024-05-08 17:01:52 +00:00
|
|
|
_supportsSpark &&
|
|
|
|
_walletAddressTypes[i] ==
|
|
|
|
AddressType.p2pkh
|
|
|
|
? "Transparent address"
|
|
|
|
: "${_walletAddressTypes[i].readableName} address",
|
2024-04-24 22:36:12 +00:00
|
|
|
style: STextStyles.w500_14(context),
|
|
|
|
),
|
2023-12-27 16:01:13 +00:00
|
|
|
),
|
2022-11-25 19:24:01 +00:00
|
|
|
],
|
2023-12-27 16:01:13 +00:00
|
|
|
onChanged: (value) {
|
2024-04-24 22:36:12 +00:00
|
|
|
if (value != null && value != _currentIndex) {
|
2023-12-27 16:01:13 +00:00
|
|
|
setState(() {
|
2024-04-24 22:36:12 +00:00
|
|
|
_currentIndex = value;
|
2023-12-27 16:01:13 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
isExpanded: true,
|
|
|
|
iconStyleData: IconStyleData(
|
|
|
|
icon: Padding(
|
|
|
|
padding: const EdgeInsets.only(right: 10),
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
Assets.svg.chevronDown,
|
|
|
|
width: 12,
|
|
|
|
height: 6,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.textFieldActiveSearchIconRight,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2024-04-23 21:42:47 +00:00
|
|
|
buttonStyleData: ButtonStyleData(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.textFieldDefaultBG,
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
Constants.size.circularBorderRadius,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2023-12-27 16:01:13 +00:00
|
|
|
dropdownStyleData: DropdownStyleData(
|
|
|
|
offset: const Offset(0, -10),
|
|
|
|
elevation: 0,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.textFieldDefaultBG,
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
Constants.size.circularBorderRadius,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
menuItemStyleData: const MenuItemStyleData(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: 16,
|
|
|
|
vertical: 8,
|
|
|
|
),
|
|
|
|
),
|
2022-11-25 19:24:01 +00:00
|
|
|
),
|
2023-12-27 16:01:13 +00:00
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 12,
|
|
|
|
),
|
2024-04-24 22:36:12 +00:00
|
|
|
child,
|
2023-12-27 16:01:13 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
child: GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
HapticFeedback.lightImpact();
|
|
|
|
clipboard.setData(
|
|
|
|
ClipboardData(
|
2024-04-24 22:36:12 +00:00
|
|
|
text: address,
|
|
|
|
),
|
2023-12-27 16:01:13 +00:00
|
|
|
);
|
|
|
|
showFloatingFlushBar(
|
|
|
|
type: FlushBarType.info,
|
|
|
|
message: "Copied to clipboard",
|
|
|
|
iconAsset: Assets.svg.copy,
|
|
|
|
context: context,
|
|
|
|
);
|
|
|
|
},
|
|
|
|
child: RoundedWhiteContainer(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"Your $ticker address",
|
|
|
|
style: STextStyles.itemSubtitle(context),
|
|
|
|
),
|
|
|
|
const Spacer(),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
SvgPicture.asset(
|
|
|
|
Assets.svg.copy,
|
|
|
|
width: 10,
|
|
|
|
height: 10,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.infoItemIcons,
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
width: 4,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"Copy",
|
|
|
|
style: STextStyles.link2(context),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 4,
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Text(
|
2024-04-24 22:36:12 +00:00
|
|
|
address,
|
2023-12-27 16:01:13 +00:00
|
|
|
style: STextStyles.itemSubtitle12(context),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-08-26 08:11:35 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2024-04-23 21:06:36 +00:00
|
|
|
const SizedBox(
|
|
|
|
height: 12,
|
|
|
|
),
|
|
|
|
PrimaryButton(
|
|
|
|
label: "Copy address",
|
|
|
|
onPressed: () {
|
|
|
|
HapticFeedback.lightImpact();
|
|
|
|
clipboard.setData(
|
|
|
|
ClipboardData(
|
2024-04-24 22:36:12 +00:00
|
|
|
text: address,
|
2024-04-23 21:06:36 +00:00
|
|
|
),
|
|
|
|
);
|
|
|
|
showFloatingFlushBar(
|
|
|
|
type: FlushBarType.info,
|
|
|
|
message: "Copied to clipboard",
|
|
|
|
iconAsset: Assets.svg.copy,
|
|
|
|
context: context,
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
2023-12-27 16:01:13 +00:00
|
|
|
if (ref.watch(pWallets
|
|
|
|
.select((value) => value.getWallet(walletId)))
|
|
|
|
is MultiAddressInterface ||
|
2024-04-24 22:36:12 +00:00
|
|
|
_supportsSpark)
|
2022-11-25 19:24:01 +00:00
|
|
|
const SizedBox(
|
|
|
|
height: 12,
|
|
|
|
),
|
2023-12-27 16:01:13 +00:00
|
|
|
if (ref.watch(pWallets
|
|
|
|
.select((value) => value.getWallet(walletId)))
|
|
|
|
is MultiAddressInterface ||
|
2024-04-24 22:36:12 +00:00
|
|
|
_supportsSpark)
|
2024-04-23 21:06:36 +00:00
|
|
|
SecondaryButton(
|
|
|
|
label: "Generate new address",
|
2024-04-24 22:36:12 +00:00
|
|
|
onPressed: _supportsSpark &&
|
|
|
|
_walletAddressTypes[_currentIndex] ==
|
|
|
|
AddressType.spark
|
2023-12-27 16:01:13 +00:00
|
|
|
? generateNewSparkAddress
|
|
|
|
: generateNewAddress,
|
2022-11-25 19:24:01 +00:00
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 30,
|
|
|
|
),
|
|
|
|
RoundedWhiteContainer(
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
child: Center(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
2023-06-05 13:40:56 +00:00
|
|
|
QrImageView(
|
2023-06-23 21:27:09 +00:00
|
|
|
data: AddressUtils.buildUriString(
|
|
|
|
coin,
|
2024-04-24 22:36:12 +00:00
|
|
|
address,
|
2023-06-23 21:27:09 +00:00
|
|
|
{},
|
|
|
|
),
|
2022-11-25 19:24:01 +00:00
|
|
|
size: MediaQuery.of(context).size.width / 2,
|
|
|
|
foregroundColor: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.accentColorDark),
|
|
|
|
const SizedBox(
|
|
|
|
height: 20,
|
|
|
|
),
|
2023-01-30 21:34:21 +00:00
|
|
|
CustomTextButton(
|
2024-04-23 21:42:47 +00:00
|
|
|
text: "Advanced options",
|
2022-11-25 19:24:01 +00:00
|
|
|
onTap: () async {
|
|
|
|
unawaited(Navigator.of(context).push(
|
|
|
|
RouteGenerator.getRoute(
|
|
|
|
shouldUseMaterialRoute:
|
|
|
|
RouteGenerator.useMaterialPageRoute,
|
|
|
|
builder: (_) => GenerateUriQrCodeView(
|
|
|
|
coin: coin,
|
2024-04-24 22:36:12 +00:00
|
|
|
receivingAddress: address,
|
2022-11-25 19:24:01 +00:00
|
|
|
),
|
|
|
|
settings: const RouteSettings(
|
|
|
|
name: GenerateUriQrCodeView.routeName,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
));
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-08-26 08:11:35 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|