add lottie animations for sending as well as some clean up

This commit is contained in:
julian 2023-03-13 11:49:39 -06:00
parent 0a90f32f5f
commit 87c15c2c39
36 changed files with 428 additions and 176 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -64,33 +64,49 @@ class _ConfirmChangeNowSendViewState
final isDesktop = Util.isDesktop; final isDesktop = Util.isDesktop;
Future<void> _attemptSend(BuildContext context) async { Future<void> _attemptSend(BuildContext context) async {
final manager =
ref.read(walletsChangeNotifierProvider).getManager(walletId);
unawaited( unawaited(
showDialog<void>( showDialog<void>(
context: context, context: context,
useSafeArea: false, useSafeArea: false,
barrierDismissible: false, barrierDismissible: false,
builder: (context) { builder: (context) {
return const SendingTransactionDialog(); return SendingTransactionDialog(
coin: manager.coin,
);
}, },
), ),
); );
final time = Future<dynamic>.delayed(
const Duration(
seconds: 3,
),
);
late String txid;
Future<String> txidFuture;
final String note = transactionInfo["note"] as String? ?? ""; final String note = transactionInfo["note"] as String? ?? "";
final manager =
ref.read(walletsChangeNotifierProvider).getManager(walletId);
try { try {
late final String txid;
if (widget.shouldSendPublicFiroFunds == true) { if (widget.shouldSendPublicFiroFunds == true) {
txid = await (manager.wallet as FiroWallet) txidFuture = (manager.wallet as FiroWallet)
.confirmSendPublic(txData: transactionInfo); .confirmSendPublic(txData: transactionInfo);
} else { } else {
txid = await manager.confirmSend(txData: transactionInfo); txidFuture = manager.confirmSend(txData: transactionInfo);
} }
unawaited(manager.refresh()); unawaited(manager.refresh());
final results = await Future.wait([
txidFuture,
time,
]);
txid = results.first as String;
// save note // save note
await ref await ref
.read(notesServiceChangeNotifierProvider(walletId)) .read(notesServiceChangeNotifierProvider(walletId))

View file

@ -536,24 +536,34 @@ class _Step4ViewState extends ConsumerState<Step4View> {
try { try {
bool wasCancelled = false; bool wasCancelled = false;
unawaited(showDialog<dynamic>( unawaited(
context: context, showDialog<dynamic>(
useSafeArea: false, context: context,
barrierDismissible: false, useSafeArea: false,
builder: (context) { barrierDismissible: false,
return BuildingTransactionDialog( builder: (context) {
onCancel: () { return BuildingTransactionDialog(
wasCancelled = true; coin: manager.coin,
onCancel: () {
wasCancelled = true;
Navigator.of(context) Navigator.of(context)
.pop(); .pop();
}, },
); );
}, },
)); ),
);
final txData = final time =
await manager.prepareSend( Future<dynamic>.delayed(
const Duration(
seconds: 3,
),
);
final txDataFuture =
manager.prepareSend(
address: address, address: address,
satoshiAmount: amount, satoshiAmount: amount,
args: { args: {
@ -563,6 +573,15 @@ class _Step4ViewState extends ConsumerState<Step4View> {
}, },
); );
final results =
await Future.wait([
txDataFuture,
time,
]);
final txData = results.last
as Map<String, dynamic>;
if (!wasCancelled) { if (!wasCancelled) {
// pop building dialog // pop building dialog

View file

@ -240,6 +240,7 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
), ),
), ),
child: BuildingTransactionDialog( child: BuildingTransactionDialog(
coin: manager.coin,
onCancel: () { onCancel: () {
wasCancelled = true; wasCancelled = true;
@ -251,11 +252,18 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
), ),
); );
late Map<String, dynamic> txData; final time = Future<dynamic>.delayed(
const Duration(
seconds: 3,
),
);
Map<String, dynamic> txData;
Future<Map<String, dynamic>> txDataFuture;
// if not firo then do normal send // if not firo then do normal send
if (shouldSendPublicFiroFunds == null) { if (shouldSendPublicFiroFunds == null) {
txData = await manager.prepareSend( txDataFuture = manager.prepareSend(
address: address, address: address,
satoshiAmount: _amount, satoshiAmount: _amount,
args: { args: {
@ -267,7 +275,7 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
final firoWallet = manager.wallet as FiroWallet; final firoWallet = manager.wallet as FiroWallet;
// otherwise do firo send based on balance selected // otherwise do firo send based on balance selected
if (shouldSendPublicFiroFunds) { if (shouldSendPublicFiroFunds) {
txData = await firoWallet.prepareSendPublic( txDataFuture = firoWallet.prepareSendPublic(
address: address, address: address,
satoshiAmount: _amount, satoshiAmount: _amount,
args: { args: {
@ -276,7 +284,7 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
}, },
); );
} else { } else {
txData = await firoWallet.prepareSend( txDataFuture = firoWallet.prepareSend(
address: address, address: address,
satoshiAmount: _amount, satoshiAmount: _amount,
args: { args: {
@ -287,6 +295,13 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
} }
} }
final results = await Future.wait([
txDataFuture,
time,
]);
txData = results.first as Map<String, dynamic>;
if (!wasCancelled) { if (!wasCancelled) {
// pop building dialog // pop building dialog

View file

@ -74,40 +74,57 @@ class _ConfirmTransactionViewState
late final TextEditingController noteController; late final TextEditingController noteController;
Future<void> _attemptSend(BuildContext context) async { Future<void> _attemptSend(BuildContext context) async {
final manager =
ref.read(walletsChangeNotifierProvider).getManager(walletId);
unawaited( unawaited(
showDialog<dynamic>( showDialog<dynamic>(
context: context, context: context,
useSafeArea: false, useSafeArea: false,
barrierDismissible: false, barrierDismissible: false,
builder: (context) { builder: (context) {
return const SendingTransactionDialog(); return SendingTransactionDialog(
coin: manager.coin,
);
}, },
), ),
); );
final time = Future<dynamic>.delayed(
const Duration(
seconds: 3,
),
);
late String txid;
Future<String> txidFuture;
final note = noteController.text; final note = noteController.text;
final manager =
ref.read(walletsChangeNotifierProvider).getManager(walletId);
try { try {
String txid;
if (widget.isPaynymNotificationTransaction) { if (widget.isPaynymNotificationTransaction) {
txid = await (manager.wallet as PaynymWalletInterface) txidFuture = (manager.wallet as PaynymWalletInterface)
.broadcastNotificationTx(preparedTx: transactionInfo); .broadcastNotificationTx(preparedTx: transactionInfo);
} else if (widget.isPaynymTransaction) { } else if (widget.isPaynymTransaction) {
txid = await manager.confirmSend(txData: transactionInfo); txidFuture = manager.confirmSend(txData: transactionInfo);
} else { } else {
final coin = manager.coin; final coin = manager.coin;
if ((coin == Coin.firo || coin == Coin.firoTestNet) && if ((coin == Coin.firo || coin == Coin.firoTestNet) &&
ref.read(publicPrivateBalanceStateProvider.state).state != ref.read(publicPrivateBalanceStateProvider.state).state !=
"Private") { "Private") {
txid = await (manager.wallet as FiroWallet) txidFuture = (manager.wallet as FiroWallet)
.confirmSendPublic(txData: transactionInfo); .confirmSendPublic(txData: transactionInfo);
} else { } else {
txid = await manager.confirmSend(txData: transactionInfo); txidFuture = manager.confirmSend(txData: transactionInfo);
} }
} }
final results = await Future.wait([
txidFuture,
time,
]);
txid = results.first as String;
// save note // save note
await ref await ref
.read(notesServiceChangeNotifierProvider(walletId)) .read(notesServiceChangeNotifierProvider(walletId))

View file

@ -431,6 +431,7 @@ class _SendViewState extends ConsumerState<SendView> {
barrierDismissible: false, barrierDismissible: false,
builder: (context) { builder: (context) {
return BuildingTransactionDialog( return BuildingTransactionDialog(
coin: manager.coin,
onCancel: () { onCancel: () {
wasCancelled = true; wasCancelled = true;
@ -442,7 +443,14 @@ class _SendViewState extends ConsumerState<SendView> {
); );
} }
final time = Future<dynamic>.delayed(
const Duration(
seconds: 3,
),
);
Map<String, dynamic> txData; Map<String, dynamic> txData;
Future<Map<String, dynamic>> txDataFuture;
if (isPaynymSend) { if (isPaynymSend) {
final wallet = manager.wallet as PaynymWalletInterface; final wallet = manager.wallet as PaynymWalletInterface;
@ -451,7 +459,7 @@ class _SendViewState extends ConsumerState<SendView> {
wallet.networkType, wallet.networkType,
); );
final feeRate = ref.read(feeRateTypeStateProvider); final feeRate = ref.read(feeRateTypeStateProvider);
txData = await wallet.preparePaymentCodeSend( txDataFuture = wallet.preparePaymentCodeSend(
paymentCode: paymentCode, paymentCode: paymentCode,
satoshiAmount: amount, satoshiAmount: amount,
args: { args: {
@ -466,13 +474,13 @@ class _SendViewState extends ConsumerState<SendView> {
} else if ((coin == Coin.firo || coin == Coin.firoTestNet) && } else if ((coin == Coin.firo || coin == Coin.firoTestNet) &&
ref.read(publicPrivateBalanceStateProvider.state).state != ref.read(publicPrivateBalanceStateProvider.state).state !=
"Private") { "Private") {
txData = await (manager.wallet as FiroWallet).prepareSendPublic( txDataFuture = (manager.wallet as FiroWallet).prepareSendPublic(
address: _address!, address: _address!,
satoshiAmount: amount, satoshiAmount: amount,
args: {"feeRate": ref.read(feeRateTypeStateProvider)}, args: {"feeRate": ref.read(feeRateTypeStateProvider)},
); );
} else { } else {
txData = await manager.prepareSend( txDataFuture = manager.prepareSend(
address: _address!, address: _address!,
satoshiAmount: amount, satoshiAmount: amount,
args: { args: {
@ -486,6 +494,13 @@ class _SendViewState extends ConsumerState<SendView> {
); );
} }
final results = await Future.wait([
txDataFuture,
time,
]);
txData = results.first as Map<String, dynamic>;
if (!wasCancelled && mounted) { if (!wasCancelled && mounted) {
// pop building dialog // pop building dialog
Navigator.of(context).pop(); Navigator.of(context).pop();

View file

@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart'; import 'package:lottie/lottie.dart';
import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart'; import 'package:stackwallet/utilities/util.dart';
@ -11,41 +12,44 @@ class BuildingTransactionDialog extends StatefulWidget {
const BuildingTransactionDialog({ const BuildingTransactionDialog({
Key? key, Key? key,
required this.onCancel, required this.onCancel,
required this.coin,
}) : super(key: key); }) : super(key: key);
final VoidCallback onCancel; final VoidCallback onCancel;
final Coin coin;
@override @override
State<BuildingTransactionDialog> createState() => _RestoringDialogState(); State<BuildingTransactionDialog> createState() => _RestoringDialogState();
} }
class _RestoringDialogState extends State<BuildingTransactionDialog> class _RestoringDialogState extends State<BuildingTransactionDialog> {
with TickerProviderStateMixin { // with TickerProviderStateMixin {
late AnimationController? _spinController; // late AnimationController? _spinController;
late Animation<double> _spinAnimation; // late Animation<double> _spinAnimation;
late final VoidCallback onCancel; late final VoidCallback onCancel;
@override @override
void initState() { void initState() {
onCancel = widget.onCancel; onCancel = widget.onCancel;
_spinController = AnimationController( // _spinController = AnimationController(
duration: const Duration(seconds: 2), // duration: const Duration(seconds: 2),
vsync: this, // vsync: this,
)..repeat(); // )..repeat();
//
_spinAnimation = CurvedAnimation( // _spinAnimation = CurvedAnimation(
parent: _spinController!, // parent: _spinController!,
curve: Curves.linear, // curve: Curves.linear,
); // );
super.initState(); super.initState();
} }
@override @override
void dispose() { void dispose() {
_spinController?.dispose(); // _spinController?.dispose();
_spinController = null; // _spinController = null;
super.dispose(); super.dispose();
} }
@ -63,16 +67,20 @@ class _RestoringDialogState extends State<BuildingTransactionDialog>
const SizedBox( const SizedBox(
height: 40, height: 40,
), ),
RotationTransition(
turns: _spinAnimation, Lottie.asset(
child: SvgPicture.asset( Assets.lottie.kiss(widget.coin),
Assets.svg.arrowRotate,
color:
Theme.of(context).extension<StackColors>()!.accentColorDark,
width: 24,
height: 24,
),
), ),
// RotationTransition(
// turns: _spinAnimation,
// child: SvgPicture.asset(
// Assets.svg.arrowRotate,
// color:
// Theme.of(context).extension<StackColors>()!.accentColorDark,
// width: 24,
// height: 24,
// ),
// ),
const SizedBox( const SizedBox(
height: 40, height: 40,
), ),
@ -90,34 +98,73 @@ class _RestoringDialogState extends State<BuildingTransactionDialog>
onWillPop: () async { onWillPop: () async {
return false; return false;
}, },
child: StackDialog( child: StackDialogBase(
title: "Generating transaction", child: Column(
// // TODO get message from design team crossAxisAlignment: CrossAxisAlignment.stretch,
// message: "<PLACEHOLDER>", mainAxisSize: MainAxisSize.min,
icon: RotationTransition( children: [
turns: _spinAnimation, Lottie.asset(
child: SvgPicture.asset( Assets.lottie.kiss(widget.coin),
Assets.svg.arrowRotate, ),
color: Text(
Theme.of(context).extension<StackColors>()!.accentColorDark, "Generating transaction",
width: 24, textAlign: TextAlign.center,
height: 24, style: STextStyles.pageTitleH2(context),
), ),
), const SizedBox(
rightButton: TextButton( height: 32,
style: Theme.of(context) ),
.extension<StackColors>()! Row(
.getSecondaryEnabledButtonStyle(context), children: [
child: Text( const Spacer(),
"Cancel", Expanded(
style: STextStyles.itemSubtitle12(context), child: TextButton(
), style: Theme.of(context)
onPressed: () { .extension<StackColors>()!
Navigator.of(context).pop(); .getSecondaryEnabledButtonStyle(context),
onCancel.call(); child: Text(
}, "Cancel",
style: STextStyles.itemSubtitle12(context),
),
onPressed: () {
Navigator.of(context).pop();
onCancel.call();
},
),
)
],
),
],
), ),
), ),
// child: StackDialog(
// title: "Generating transaction",
// // // TODO get message from design team
// // message: "<PLACEHOLDER>",
// icon: RotationTransition(
// turns: _spinAnimation,
// child: SvgPicture.asset(
// Assets.svg.arrowRotate,
// color:
// Theme.of(context).extension<StackColors>()!.accentColorDark,
// width: 24,
// height: 24,
// ),
// ),
// rightButton: TextButton(
// style: Theme.of(context)
// .extension<StackColors>()!
// .getSecondaryEnabledButtonStyle(context),
// child: Text(
// "Cancel",
// style: STextStyles.itemSubtitle12(context),
// ),
// onPressed: () {
// Navigator.of(context).pop();
// onCancel.call();
// },
// ),
// ),
); );
} }
} }

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart'; import 'package:lottie/lottie.dart';
import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart'; import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart'; import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
import 'package:stackwallet/widgets/stack_dialog.dart'; import 'package:stackwallet/widgets/stack_dialog.dart';
@ -10,36 +10,39 @@ import 'package:stackwallet/widgets/stack_dialog.dart';
class SendingTransactionDialog extends StatefulWidget { class SendingTransactionDialog extends StatefulWidget {
const SendingTransactionDialog({ const SendingTransactionDialog({
Key? key, Key? key,
required this.coin,
}) : super(key: key); }) : super(key: key);
final Coin coin;
@override @override
State<SendingTransactionDialog> createState() => _RestoringDialogState(); State<SendingTransactionDialog> createState() => _RestoringDialogState();
} }
class _RestoringDialogState extends State<SendingTransactionDialog> class _RestoringDialogState extends State<SendingTransactionDialog> {
with TickerProviderStateMixin { // with TickerProviderStateMixin {
late AnimationController? _spinController; // late AnimationController? _spinController;
late Animation<double> _spinAnimation; // late Animation<double> _spinAnimation;
@override @override
void initState() { void initState() {
_spinController = AnimationController( // _spinController = AnimationController(
duration: const Duration(seconds: 2), // duration: const Duration(seconds: 2),
vsync: this, // vsync: this,
)..repeat(); // )..repeat();
//
_spinAnimation = CurvedAnimation( // _spinAnimation = CurvedAnimation(
parent: _spinController!, // parent: _spinController!,
curve: Curves.linear, // curve: Curves.linear,
); // );
super.initState(); super.initState();
} }
@override @override
void dispose() { void dispose() {
_spinController?.dispose(); // _spinController?.dispose();
_spinController = null; // _spinController = null;
super.dispose(); super.dispose();
} }
@ -60,17 +63,20 @@ class _RestoringDialogState extends State<SendingTransactionDialog>
const SizedBox( const SizedBox(
height: 40, height: 40,
), ),
RotationTransition( Lottie.asset(
turns: _spinAnimation, Assets.lottie.kiss(widget.coin),
child: SvgPicture.asset(
Assets.svg.arrowRotate,
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
width: 24,
height: 24,
),
), ),
// RotationTransition(
// turns: _spinAnimation,
// child: SvgPicture.asset(
// Assets.svg.arrowRotate,
// color: Theme.of(context)
// .extension<StackColors>()!
// .accentColorDark,
// width: 24,
// height: 24,
// ),
// ),
], ],
), ),
), ),
@ -80,21 +86,40 @@ class _RestoringDialogState extends State<SendingTransactionDialog>
onWillPop: () async { onWillPop: () async {
return false; return false;
}, },
child: StackDialog( child: StackDialogBase(
title: "Sending transaction", child: Column(
// // TODO get message from design team crossAxisAlignment: CrossAxisAlignment.stretch,
// message: "<PLACEHOLDER>", mainAxisSize: MainAxisSize.min,
icon: RotationTransition( children: [
turns: _spinAnimation, Lottie.asset(
child: SvgPicture.asset( Assets.lottie.kiss(widget.coin),
Assets.svg.arrowRotate, ),
color: Text(
Theme.of(context).extension<StackColors>()!.accentColorDark, "Sending transaction",
width: 24, textAlign: TextAlign.center,
height: 24, style: STextStyles.pageTitleH2(context),
), ),
const SizedBox(
height: 32,
),
],
), ),
), ),
// child: StackDialog(
// title: "Sending transaction",
// // // TODO get message from design team
// // message: "<PLACEHOLDER>",
// icon: RotationTransition(
// turns: _spinAnimation,
// child: SvgPicture.asset(
// Assets.svg.arrowRotate,
// color:
// Theme.of(context).extension<StackColors>()!.accentColorDark,
// width: 24,
// height: 24,
// ),
// ),
// ),
); );
} }
} }

View file

@ -57,11 +57,15 @@ class HiddenSettings extends StatelessWidget {
.read(notificationsProvider) .read(notificationsProvider)
.delete(notifs[0], true); .delete(notifs[0], true);
unawaited(showFloatingFlushBar( if (context.mounted) {
type: FlushBarType.success, unawaited(
message: "Notification history deleted", showFloatingFlushBar(
context: context, type: FlushBarType.success,
)); message: "Notification history deleted",
context: context,
),
);
}
}, },
child: RoundedWhiteContainer( child: RoundedWhiteContainer(
child: Text( child: Text(
@ -112,11 +116,15 @@ class HiddenSettings extends StatelessWidget {
.read(debugServiceProvider) .read(debugServiceProvider)
.deleteAllLogs(); .deleteAllLogs();
unawaited(showFloatingFlushBar( if (context.mounted) {
type: FlushBarType.success, unawaited(
message: "Debug Logs deleted", showFloatingFlushBar(
context: context, type: FlushBarType.success,
)); message: "Debug Logs deleted",
context: context,
),
);
}
}, },
child: RoundedWhiteContainer( child: RoundedWhiteContainer(
child: Text( child: Text(
@ -217,9 +225,9 @@ class HiddenSettings extends StatelessWidget {
// builder: (_) { // builder: (_) {
// return StackDialogBase( // return StackDialogBase(
// child: SizedBox( // child: SizedBox(
// width: 200, // width: 300,
// child: Lottie.asset( // child: Lottie.asset(
// Assets.lottie.test2, // Assets.lottie.plain(Coin.bitcoincash),
// ), // ),
// ), // ),
// ); // );
@ -230,8 +238,9 @@ class HiddenSettings extends StatelessWidget {
// child: Text( // child: Text(
// "Lottie test", // "Lottie test",
// style: STextStyles.button(context).copyWith( // style: STextStyles.button(context).copyWith(
// color: Theme.of(context).extension<StackColors>()!.accentColorDark // color: Theme.of(context)
// ), // .extension<StackColors>()!
// .accentColorDark),
// ), // ),
// ), // ),
// ), // ),

View file

@ -61,7 +61,7 @@ class DesktopBuyIcon extends ConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
return SvgPicture.asset( return SvgPicture.asset(
Assets.svg.buyDesktop, Assets.svg.buy(context),
width: 20, width: 20,
height: 20, height: 20,
color: DesktopMenuItemId.buy == color: DesktopMenuItemId.buy ==

View file

@ -219,29 +219,41 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
try { try {
bool wasCancelled = false; bool wasCancelled = false;
unawaited(showDialog<dynamic>( if (mounted) {
context: context, unawaited(
useSafeArea: false, showDialog<dynamic>(
barrierDismissible: false, context: context,
builder: (context) { useSafeArea: false,
return DesktopDialog( barrierDismissible: false,
maxWidth: 400, builder: (context) {
maxHeight: double.infinity, return DesktopDialog(
child: Padding( maxWidth: 400,
padding: const EdgeInsets.all(32), maxHeight: double.infinity,
child: BuildingTransactionDialog( child: Padding(
onCancel: () { padding: const EdgeInsets.all(32),
wasCancelled = true; child: BuildingTransactionDialog(
coin: manager.coin,
onCancel: () {
wasCancelled = true;
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
), ),
), ),
); );
}, },
)); ),
);
}
final time = Future<dynamic>.delayed(
const Duration(
seconds: 3,
),
);
Map<String, dynamic> txData; Map<String, dynamic> txData;
Future<Map<String, dynamic>> txDataFuture;
if (isPaynymSend) { if (isPaynymSend) {
final wallet = manager.wallet as PaynymWalletInterface; final wallet = manager.wallet as PaynymWalletInterface;
@ -250,7 +262,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
wallet.networkType, wallet.networkType,
); );
final feeRate = ref.read(feeRateTypeStateProvider); final feeRate = ref.read(feeRateTypeStateProvider);
txData = await wallet.preparePaymentCodeSend( txDataFuture = wallet.preparePaymentCodeSend(
paymentCode: paymentCode, paymentCode: paymentCode,
satoshiAmount: amount, satoshiAmount: amount,
args: {"feeRate": feeRate}, args: {"feeRate": feeRate},
@ -258,19 +270,26 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
} else if ((coin == Coin.firo || coin == Coin.firoTestNet) && } else if ((coin == Coin.firo || coin == Coin.firoTestNet) &&
ref.read(publicPrivateBalanceStateProvider.state).state != ref.read(publicPrivateBalanceStateProvider.state).state !=
"Private") { "Private") {
txData = await (manager.wallet as FiroWallet).prepareSendPublic( txDataFuture = (manager.wallet as FiroWallet).prepareSendPublic(
address: _address!, address: _address!,
satoshiAmount: amount, satoshiAmount: amount,
args: {"feeRate": ref.read(feeRateTypeStateProvider)}, args: {"feeRate": ref.read(feeRateTypeStateProvider)},
); );
} else { } else {
txData = await manager.prepareSend( txDataFuture = manager.prepareSend(
address: _address!, address: _address!,
satoshiAmount: amount, satoshiAmount: amount,
args: {"feeRate": ref.read(feeRateTypeStateProvider)}, args: {"feeRate": ref.read(feeRateTypeStateProvider)},
); );
} }
final results = await Future.wait([
txDataFuture,
time,
]);
txData = results.first as Map<String, dynamic>;
if (!wasCancelled && mounted) { if (!wasCancelled && mounted) {
if (isPaynymSend) { if (isPaynymSend) {
txData["paynymAccountLite"] = widget.accountLite!; txData["paynymAccountLite"] = widget.accountLite!;

View file

@ -39,9 +39,6 @@ class _EXCHANGE {
class _BUY { class _BUY {
const _BUY(); const _BUY();
String buy(BuildContext context) =>
"assets/svg/${Theme.of(context).extension<StackColors>()!.themeType.name}/buy-coins-icon.svg";
String simplexLogo(BuildContext context) { String simplexLogo(BuildContext context) {
switch (Theme.of(context).extension<StackColors>()!.themeType) { switch (Theme.of(context).extension<StackColors>()!.themeType) {
case ThemeType.dark: case ThemeType.dark:
@ -223,7 +220,6 @@ class _SVG {
String get anonymizeFailed => "assets/svg/tx-icon-anonymize-failed.svg"; String get anonymizeFailed => "assets/svg/tx-icon-anonymize-failed.svg";
String get addressBookDesktop => "assets/svg/address-book-desktop.svg"; String get addressBookDesktop => "assets/svg/address-book-desktop.svg";
String get exchangeDesktop => "assets/svg/exchange-desktop.svg"; String get exchangeDesktop => "assets/svg/exchange-desktop.svg";
String get buyDesktop => "assets/svg/light/buy-coins-icon.svg";
String get aboutDesktop => "assets/svg/about-desktop.svg"; String get aboutDesktop => "assets/svg/about-desktop.svg";
String get walletDesktop => "assets/svg/wallet-desktop.svg"; String get walletDesktop => "assets/svg/wallet-desktop.svg";
String get exitDesktop => "assets/svg/exit-desktop.svg"; String get exitDesktop => "assets/svg/exit-desktop.svg";
@ -371,6 +367,13 @@ class _PNG {
class _ANIMATIONS { class _ANIMATIONS {
const _ANIMATIONS(); const _ANIMATIONS();
String get test => "assets/lottie/test.json";
String get test2 => "assets/lottie/test2.json"; String get test2 => "assets/lottie/test2.json";
String plain(Coin coin) {
return "assets/lottie/coins/${coin.mainNetVersion.name}/plain.lottie.json";
}
String kiss(Coin coin) {
return "assets/lottie/coins/${coin.mainNetVersion.name}/kiss.lottie.json";
}
} }

View file

@ -218,6 +218,37 @@ extension CoinExt on Coin {
} }
} }
Coin get mainNetVersion {
switch (this) {
case Coin.bitcoin:
case Coin.litecoin:
case Coin.bitcoincash:
case Coin.dogecoin:
case Coin.firo:
case Coin.namecoin:
case Coin.particl:
case Coin.epicCash:
case Coin.monero:
case Coin.wownero:
return this;
case Coin.dogecoinTestNet:
return Coin.dogecoin;
case Coin.bitcoinTestNet:
return Coin.bitcoin;
case Coin.litecoinTestNet:
return Coin.litecoin;
case Coin.bitcoincashTestnet:
return Coin.bitcoincash;
case Coin.firoTestNet:
return Coin.firo;
}
}
int get requiredConfirmations { int get requiredConfirmations {
switch (this) { switch (this) {
case Coin.bitcoin: case Coin.bitcoin:

View file

@ -320,9 +320,6 @@ flutter:
# coin control icons # coin control icons
- assets/svg/coin_control/ - assets/svg/coin_control/
# lottie animations
- assets/lottie/test.json
- assets/lottie/test2.json
# socials # socials
- assets/svg/socials/ - assets/svg/socials/
@ -358,6 +355,24 @@ flutter:
# buy # buy
- assets/svg/buy/ - assets/svg/buy/
# lottie animations
# basic
- assets/lottie/test2.json
# coin animations
- assets/lottie/coins/bitcoin/
- assets/lottie/coins/bitcoincash/
- assets/lottie/coins/dogecoin/
- assets/lottie/coins/epiccash/
- assets/lottie/coins/ethereum/
- assets/lottie/coins/firo/
- assets/lottie/coins/litecoin/
- assets/lottie/coins/monero/
- assets/lottie/coins/namecoin/
- assets/lottie/coins/particl/
- assets/lottie/coins/wownero/
# An image asset can refer to one or more resolution-specific "variants", see # An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware. # https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see # For details regarding adding assets from package dependencies, see