Skip to content
Snippets Groups Projects
Commit e47211f1 authored by poka's avatar poka
Browse files

fix: good display of wallet names on transaction screen

parent a751b1eb
Branches
Tags
No related merge requests found
Pipeline #34291 waiting for manual action
...@@ -12,11 +12,16 @@ import 'package:provider/provider.dart'; ...@@ -12,11 +12,16 @@ import 'package:provider/provider.dart';
class TransactionInProgress extends StatelessWidget { class TransactionInProgress extends StatelessWidget {
const TransactionInProgress( const TransactionInProgress(
{Key? key, this.transType = 'pay', this.fromAddress, this.toAddress}) {Key? key,
this.transType = 'pay',
this.fromAddress,
this.toAddress,
this.toUsername})
: super(key: key); : super(key: key);
final String transType; final String transType;
final String? fromAddress; final String? fromAddress;
final String? toAddress; final String? toAddress;
final String? toUsername;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -33,8 +38,15 @@ class TransactionInProgress extends StatelessWidget { ...@@ -33,8 +38,15 @@ class TransactionInProgress extends StatelessWidget {
log.d(walletProfiles.address); log.d(walletProfiles.address);
final from = fromAddress ?? myWalletProvider.getDefaultWallet().name!; final from = fromAddress ??
final to = toAddress ?? getShortPubkey(walletProfiles.address); g1WalletsBox
.get(myWalletProvider.getDefaultWallet().address)
?.username ??
myWalletProvider.getDefaultWallet().name!;
String to = toAddress ?? walletProfiles.address;
to =
myWalletProvider.getWalletDataByAddress(to)?.name ?? getShortPubkey(to);
final amount = walletProfiles.payAmount.text; final amount = walletProfiles.payAmount.text;
String actionName = ''; String actionName = '';
final bool isUdUnit = configBox.get('isUdUnit') ?? false; final bool isUdUnit = configBox.get('isUdUnit') ?? false;
...@@ -220,7 +232,7 @@ class TransactionInProgress extends StatelessWidget { ...@@ -220,7 +232,7 @@ class TransactionInProgress extends StatelessWidget {
style: const TextStyle(fontSize: 18), style: const TextStyle(fontSize: 18),
), ),
Text( Text(
to, toUsername ?? to,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle( style: const TextStyle(
fontSize: 18, fontWeight: FontWeight.w600), fontSize: 18, fontWeight: FontWeight.w600),
......
...@@ -29,6 +29,8 @@ void paymentPopup(BuildContext context, String toAddress, String username) { ...@@ -29,6 +29,8 @@ void paymentPopup(BuildContext context, String toAddress, String username) {
final amountFocus = FocusNode(); final amountFocus = FocusNode();
final dropdownKey = GlobalKey(); final dropdownKey = GlobalKey();
walletViewProvider.payAmount.text = '';
Future executeTransfert() async { Future executeTransfert() async {
String? pin; String? pin;
if (myWalletProvider.pinCode == '') { if (myWalletProvider.pinCode == '') {
...@@ -56,7 +58,8 @@ void paymentPopup(BuildContext context, String toAddress, String username) { ...@@ -56,7 +58,8 @@ void paymentPopup(BuildContext context, String toAddress, String username) {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) { MaterialPageRoute(builder: (context) {
return const TransactionInProgress(); return TransactionInProgress(
toAddress: toAddress, toUsername: username);
}), }),
); );
} }
...@@ -333,7 +336,11 @@ void paymentPopup(BuildContext context, String toAddress, String username) { ...@@ -333,7 +336,11 @@ void paymentPopup(BuildContext context, String toAddress, String username) {
backgroundColor: orangeC, // foreground backgroundColor: orangeC, // foreground
), ),
onPressed: canValidate onPressed: canValidate
? () async => await executeTransfert() ? () async {
// FocusScope.of(context).unfocus();
Navigator.pop(context);
await executeTransfert();
}
: null, : null,
child: Text( child: Text(
'executeTheTransfer'.tr(), 'executeTheTransfer'.tr(),
...@@ -348,8 +355,9 @@ void paymentPopup(BuildContext context, String toAddress, String username) { ...@@ -348,8 +355,9 @@ void paymentPopup(BuildContext context, String toAddress, String username) {
), ),
); );
}); });
}).then((value) => walletViewProvider.payAmount.text = ''); });
} }
//).then((value) => walletViewProvider.payAmount.text = ''
Future<void> infoFeesPopup(BuildContext context) async { Future<void> infoFeesPopup(BuildContext context) async {
return showDialog<void>( return showDialog<void>(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment