CAKE-345 | fixed bug on send_card.dart and fixed addresses for transaction details

This commit is contained in:
OleksandrSobol 2021-08-11 17:23:24 +03:00
parent a8375321bc
commit f84c7c9a1c
2 changed files with 329 additions and 325 deletions

View file

@ -80,227 +80,55 @@ class SendCardState extends State<SendCard>
) )
]), ]),
child: Container( child: Container(
height: sendViewModel.isElectrumWallet ? 470 : 445, height: 0,
decoration: BoxDecoration( color: Theme.of(context).backgroundColor,
borderRadius: BorderRadius.only( child: Container(
bottomLeft: Radius.circular(24), height: sendViewModel.isElectrumWallet ? 470 : 445,
bottomRight: Radius.circular(24)), decoration: BoxDecoration(
gradient: LinearGradient(colors: [ borderRadius: BorderRadius.only(
Theme.of(context).primaryTextTheme.subhead.color, bottomLeft: Radius.circular(24),
Theme.of(context) bottomRight: Radius.circular(24)),
.primaryTextTheme gradient: LinearGradient(colors: [
.subhead Theme.of(context).primaryTextTheme.subhead.color,
.decorationColor, Theme.of(context)
], begin: Alignment.topLeft, end: Alignment.bottomRight), .primaryTextTheme
), .subhead
child: Padding( .decorationColor,
padding: EdgeInsets.fromLTRB(24, 80, 24, 32), ], begin: Alignment.topLeft, end: Alignment.bottomRight),
child: SingleChildScrollView( ),
child: Column( child: Padding(
mainAxisSize: MainAxisSize.min, padding: EdgeInsets.fromLTRB(24, 80, 24, 32),
children: <Widget>[ child: SingleChildScrollView(
AddressTextField( child: Column(
focusNode: addressFocusNode, mainAxisSize: MainAxisSize.min,
controller: addressController, children: <Widget>[
onURIScanned: (uri) { AddressTextField(
var address = ''; focusNode: addressFocusNode,
var amount = ''; controller: addressController,
onURIScanned: (uri) {
var address = '';
var amount = '';
if (uri != null) { if (uri != null) {
address = uri.path; address = uri.path;
amount = uri.queryParameters['tx_amount'] ?? amount = uri.queryParameters['tx_amount'] ??
uri.queryParameters['amount']; uri.queryParameters['amount'];
} else { } else {
address = uri.toString(); address = uri.toString();
} }
addressController.text = address; addressController.text = address;
cryptoAmountController.text = amount; cryptoAmountController.text = amount;
}, },
options: [ options: [
AddressTextFieldOption.paste, AddressTextFieldOption.paste,
AddressTextFieldOption.qrCode, AddressTextFieldOption.qrCode,
AddressTextFieldOption.addressBook AddressTextFieldOption.addressBook
], ],
buttonColor: Theme.of(context) buttonColor: Theme.of(context)
.primaryTextTheme .primaryTextTheme
.display1 .display1
.color, .color,
borderColor: Theme.of(context)
.primaryTextTheme
.headline
.color,
textStyle: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.white),
hintStyle: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Theme.of(context)
.primaryTextTheme
.headline
.decorationColor),
onPushPasteButton: (context) async {
final parsedAddress =
await output.applyOpenaliasOrUnstoppableDomains();
showAddressAlert(context, parsedAddress);
},
validator: sendViewModel.addressValidator,
),
Observer(
builder: (_) => Padding(
padding: const EdgeInsets.only(top: 20),
child: Stack(
children: [
BaseTextFormField(
focusNode: cryptoAmountFocus,
controller: cryptoAmountController,
keyboardType:
TextInputType.numberWithOptions(
signed: false, decimal: true),
prefixIcon: Padding(
padding: EdgeInsets.only(top: 9),
child: Text(
sendViewModel.currency.title +
':',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Colors.white,
)),
),
suffixIcon: SizedBox(
width: prefixIconWidth,
),
hintText: '0.0000',
borderColor: Theme.of(context)
.primaryTextTheme
.headline
.color,
textStyle: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.white),
placeholderTextStyle: TextStyle(
color: Theme.of(context)
.primaryTextTheme
.headline
.decorationColor,
fontWeight: FontWeight.w500,
fontSize: 14),
validator: output.sendAll
? sendViewModel.allAmountValidator
: sendViewModel
.amountValidator),
if (!sendViewModel.isBatchSending) Positioned(
top: 2,
right: 0,
child: Container(
width: prefixIconWidth,
height: prefixIconHeight,
child: InkWell(
onTap: () async =>
output.setSendAll(),
child: Container(
decoration: BoxDecoration(
color: Theme.of(context)
.primaryTextTheme
.display1
.color,
borderRadius:
BorderRadius.all(
Radius.circular(6))),
child: Center(
child: Text(
S.of(context).all,
textAlign:
TextAlign.center,
style: TextStyle(
fontSize: 12,
fontWeight:
FontWeight.bold,
color:
Theme.of(context)
.primaryTextTheme
.display1
.decorationColor))),
))))])
)),
Observer(
builder: (_) => Padding(
padding: EdgeInsets.only(top: 10),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
child: Text(
S.of(context).available_balance +
':',
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Theme.of(context)
.primaryTextTheme
.headline
.decorationColor),
)),
Text(
sendViewModel.balance,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Theme.of(context)
.primaryTextTheme
.headline
.decorationColor),
)
],
),
)),
Padding(
padding: const EdgeInsets.only(top: 20),
child: BaseTextFormField(
focusNode: fiatAmountFocus,
controller: fiatAmountController,
keyboardType:
TextInputType.numberWithOptions(
signed: false, decimal: true),
prefixIcon: Padding(
padding: EdgeInsets.only(top: 9),
child:
Text(sendViewModel.fiat.title + ':',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Colors.white,
)),
),
hintText: '0.00',
borderColor: Theme.of(context)
.primaryTextTheme
.headline
.color,
textStyle: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.white),
placeholderTextStyle: TextStyle(
color: Theme.of(context)
.primaryTextTheme
.headline
.decorationColor,
fontWeight: FontWeight.w500,
fontSize: 14),
)),
Padding(
padding: EdgeInsets.only(top: 20),
child: BaseTextFormField(
controller: noteController,
keyboardType: TextInputType.multiline,
maxLines: null,
borderColor: Theme.of(context) borderColor: Theme.of(context)
.primaryTextTheme .primaryTextTheme
.headline .headline
@ -309,128 +137,304 @@ class SendCardState extends State<SendCard>
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Colors.white), color: Colors.white),
hintText: S.of(context).note_optional, hintStyle: TextStyle(
placeholderTextStyle: TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Theme.of(context) color: Theme.of(context)
.primaryTextTheme .primaryTextTheme
.headline .headline
.decorationColor), .decorationColor),
onPushPasteButton: (context) async {
final parsedAddress =
await output.applyOpenaliasOrUnstoppableDomains();
showAddressAlert(context, parsedAddress);
},
validator: sendViewModel.addressValidator,
), ),
), Observer(
Observer( builder: (_) => Padding(
builder: (_) => GestureDetector( padding: const EdgeInsets.only(top: 20),
onTap: () => child: Stack(
_setTransactionPriority(context), children: [
child: Container( BaseTextFormField(
padding: EdgeInsets.only(top: 24), focusNode: cryptoAmountFocus,
controller: cryptoAmountController,
keyboardType:
TextInputType.numberWithOptions(
signed: false, decimal: true),
prefixIcon: Padding(
padding: EdgeInsets.only(top: 9),
child: Text(
sendViewModel.currency.title +
':',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Colors.white,
)),
),
suffixIcon: SizedBox(
width: prefixIconWidth,
),
hintText: '0.0000',
borderColor: Theme.of(context)
.primaryTextTheme
.headline
.color,
textStyle: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.white),
placeholderTextStyle: TextStyle(
color: Theme.of(context)
.primaryTextTheme
.headline
.decorationColor,
fontWeight: FontWeight.w500,
fontSize: 14),
validator: output.sendAll
? sendViewModel.allAmountValidator
: sendViewModel
.amountValidator),
if (!sendViewModel.isBatchSending) Positioned(
top: 2,
right: 0,
child: Container(
width: prefixIconWidth,
height: prefixIconHeight,
child: InkWell(
onTap: () async =>
output.setSendAll(),
child: Container(
decoration: BoxDecoration(
color: Theme.of(context)
.primaryTextTheme
.display1
.color,
borderRadius:
BorderRadius.all(
Radius.circular(6))),
child: Center(
child: Text(
S.of(context).all,
textAlign:
TextAlign.center,
style: TextStyle(
fontSize: 12,
fontWeight:
FontWeight.bold,
color:
Theme.of(context)
.primaryTextTheme
.display1
.decorationColor))),
))))])
)),
Observer(
builder: (_) => Padding(
padding: EdgeInsets.only(top: 10),
child: Row( child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceBetween, MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Expanded(
child: Text(
S.of(context).available_balance +
':',
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Theme.of(context)
.primaryTextTheme
.headline
.decorationColor),
)),
Text( Text(
S sendViewModel.balance,
.of(context) style: TextStyle(
.send_estimated_fee, fontSize: 12,
style: TextStyle( fontWeight: FontWeight.w600,
fontSize: 12, color: Theme.of(context)
fontWeight: .primaryTextTheme
FontWeight.w500, .headline
//color: Theme.of(context).primaryTextTheme.display2.color, .decorationColor),
color: Colors.white)),
Container(
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
output
.estimatedFee
.toString() +
' ' +
sendViewModel
.currency.title,
style: TextStyle(
fontSize: 12,
fontWeight:
FontWeight.w600,
//color: Theme.of(context).primaryTextTheme.display2.color,
color:
Colors.white)),
Padding(
padding:
EdgeInsets.only(top: 5),
child: Text(
output
.estimatedFeeFiatAmount
+ ' ' +
sendViewModel
.fiat.title,
style: TextStyle(
fontSize: 12,
fontWeight:
FontWeight.w600,
color: Theme
.of(context)
.primaryTextTheme
.headline
.decorationColor))
),
],
),
Padding(
padding: EdgeInsets.only(
top: 2,
left: 5),
child: Icon(
Icons.arrow_forward_ios,
size: 12,
color: Colors.white,
),
)
],
),
) )
], ],
), ),
), )),
)), Padding(
if (sendViewModel.isElectrumWallet) Padding( padding: const EdgeInsets.only(top: 20),
padding: EdgeInsets.only(top: 6), child: BaseTextFormField(
child: GestureDetector( focusNode: fiatAmountFocus,
onTap: () => Navigator.of(context) controller: fiatAmountController,
.pushNamed(Routes.unspentCoinsList), keyboardType:
TextInputType.numberWithOptions(
signed: false, decimal: true),
prefixIcon: Padding(
padding: EdgeInsets.only(top: 9),
child:
Text(sendViewModel.fiat.title + ':',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Colors.white,
)),
),
hintText: '0.00',
borderColor: Theme.of(context)
.primaryTextTheme
.headline
.color,
textStyle: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.white),
placeholderTextStyle: TextStyle(
color: Theme.of(context)
.primaryTextTheme
.headline
.decorationColor,
fontWeight: FontWeight.w500,
fontSize: 14),
)),
Padding(
padding: EdgeInsets.only(top: 20),
child: BaseTextFormField(
controller: noteController,
keyboardType: TextInputType.multiline,
maxLines: null,
borderColor: Theme.of(context)
.primaryTextTheme
.headline
.color,
textStyle: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.white),
hintText: S.of(context).note_optional,
placeholderTextStyle: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Theme.of(context)
.primaryTextTheme
.headline
.decorationColor),
),
),
Observer(
builder: (_) => GestureDetector(
onTap: () =>
_setTransactionPriority(context),
child: Container( child: Container(
color: Colors.transparent, padding: EdgeInsets.only(top: 24),
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceBetween, MainAxisAlignment.spaceBetween,
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Text( children: <Widget>[
S.of(context).coin_control, Text(
style: TextStyle( S
fontSize: 12, .of(context)
fontWeight: FontWeight.w600, .send_estimated_fee,
color: Colors.white)), style: TextStyle(
Icon( fontSize: 12,
Icons.arrow_forward_ios, fontWeight:
size: 12, FontWeight.w500,
color: Colors.white, //color: Theme.of(context).primaryTextTheme.display2.color,
) color: Colors.white)),
], Container(
) child: Row(
) crossAxisAlignment: CrossAxisAlignment.start,
) children: <Widget>[
) Column(
], mainAxisAlignment: MainAxisAlignment.start,
) crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
output
.estimatedFee
.toString() +
' ' +
sendViewModel
.currency.title,
style: TextStyle(
fontSize: 12,
fontWeight:
FontWeight.w600,
//color: Theme.of(context).primaryTextTheme.display2.color,
color:
Colors.white)),
Padding(
padding:
EdgeInsets.only(top: 5),
child: Text(
output
.estimatedFeeFiatAmount
+ ' ' +
sendViewModel
.fiat.title,
style: TextStyle(
fontSize: 12,
fontWeight:
FontWeight.w600,
color: Theme
.of(context)
.primaryTextTheme
.headline
.decorationColor))
),
],
),
Padding(
padding: EdgeInsets.only(
top: 2,
left: 5),
child: Icon(
Icons.arrow_forward_ios,
size: 12,
color: Colors.white,
),
)
],
),
)
],
),
),
)),
if (sendViewModel.isElectrumWallet) Padding(
padding: EdgeInsets.only(top: 6),
child: GestureDetector(
onTap: () => Navigator.of(context)
.pushNamed(Routes.unspentCoinsList),
child: Container(
color: Colors.transparent,
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
S.of(context).coin_control,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Colors.white)),
Icon(
Icons.arrow_forward_ios,
size: 12,
color: Colors.white,
)
],
)
)
)
)
],
)
),
), ),
), )
)); ));
} }

View file

@ -151,7 +151,7 @@ abstract class SendViewModelBase with Store {
@action @action
Future<void> commitTransaction() async { Future<void> commitTransaction() async {
String address = outputs.fold('', (acc, value) { String address = outputs.fold('', (acc, value) {
return acc + value.address + '\n'; return acc + value.address + '\n\n';
}); });
address = address.trim(); address = address.trim();