CAKE-345 | fixed send_card.dart

This commit is contained in:
OleksandrSobol 2021-08-11 17:42:55 +03:00
parent f84c7c9a1c
commit 383d2abcc5

View file

@ -63,247 +63,228 @@ class SendCardState extends State<SendCard>
super.build(context); super.build(context);
_setEffects(context); _setEffects(context);
return KeyboardActions( return Stack(
config: KeyboardActionsConfig( children: [
keyboardActionsPlatform: KeyboardActionsPlatform.IOS, KeyboardActions(
keyboardBarColor: Theme.of(context).accentTextTheme.body2 config: KeyboardActionsConfig(
.backgroundColor, keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
nextFocus: false, keyboardBarColor: Theme.of(context).accentTextTheme.body2
actions: [ .backgroundColor,
KeyboardActionsItem( nextFocus: false,
focusNode: cryptoAmountFocus, actions: [
toolbarButtons: [(_) => KeyboardDoneButton()], KeyboardActionsItem(
), focusNode: cryptoAmountFocus,
KeyboardActionsItem( toolbarButtons: [(_) => KeyboardDoneButton()],
focusNode: fiatAmountFocus, ),
toolbarButtons: [(_) => KeyboardDoneButton()], KeyboardActionsItem(
) focusNode: fiatAmountFocus,
]), toolbarButtons: [(_) => KeyboardDoneButton()],
child: Container( )
height: 0, ]),
color: Theme.of(context).backgroundColor, child: Container(
child: Container( height: 0,
height: sendViewModel.isElectrumWallet ? 470 : 445, color: Colors.transparent,
decoration: BoxDecoration( )),
borderRadius: BorderRadius.only( 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) borderColor: Theme.of(context)
.primaryTextTheme .primaryTextTheme
.headline .headline
.color, .color,
textStyle: TextStyle( textStyle: TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Colors.white), color: Colors.white),
hintStyle: TextStyle( hintStyle: 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 { onPushPasteButton: (context) async {
final parsedAddress = final parsedAddress =
await output.applyOpenaliasOrUnstoppableDomains(); await output.applyOpenaliasOrUnstoppableDomains();
showAddressAlert(context, parsedAddress); showAddressAlert(context, parsedAddress);
}, },
validator: sendViewModel.addressValidator, validator: sendViewModel.addressValidator,
), ),
Observer( Observer(
builder: (_) => Padding( builder: (_) => Padding(
padding: const EdgeInsets.only(top: 20), padding: const EdgeInsets.only(top: 20),
child: Stack( child: Stack(
children: [ children: [
BaseTextFormField( BaseTextFormField(
focusNode: cryptoAmountFocus, focusNode: cryptoAmountFocus,
controller: cryptoAmountController, controller: cryptoAmountController,
keyboardType: keyboardType:
TextInputType.numberWithOptions( TextInputType.numberWithOptions(
signed: false, decimal: true), signed: false, decimal: true),
prefixIcon: Padding( prefixIcon: Padding(
padding: EdgeInsets.only(top: 9), padding: EdgeInsets.only(top: 9),
child: Text( child: Text(
sendViewModel.currency.title + sendViewModel.currency.title +
':', ':',
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Colors.white, color: Colors.white,
)), )),
), ),
suffixIcon: SizedBox( suffixIcon: SizedBox(
width: prefixIconWidth, width: prefixIconWidth,
), ),
hintText: '0.0000', hintText: '0.0000',
borderColor: Theme.of(context) borderColor: Theme.of(context)
.primaryTextTheme .primaryTextTheme
.headline .headline
.color, .color,
textStyle: TextStyle( textStyle: TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Colors.white), color: Colors.white),
placeholderTextStyle: TextStyle( 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) color: Theme.of(context)
.primaryTextTheme .primaryTextTheme
.headline .headline
.decorationColor), .decorationColor,
)), fontWeight: FontWeight.w500,
Text( fontSize: 14),
sendViewModel.balance, validator: output.sendAll
style: TextStyle( ? sendViewModel.allAmountValidator
fontSize: 12, : sendViewModel
fontWeight: FontWeight.w600, .amountValidator),
color: Theme.of(context) if (!sendViewModel.isBatchSending) Positioned(
.primaryTextTheme top: 2,
.headline right: 0,
.decorationColor), child: Container(
) width: prefixIconWidth,
], height: prefixIconHeight,
), child: InkWell(
)), onTap: () async =>
Padding( output.setSendAll(),
padding: const EdgeInsets.only(top: 20), child: Container(
child: BaseTextFormField( decoration: BoxDecoration(
focusNode: fiatAmountFocus, color: Theme.of(context)
controller: fiatAmountController, .primaryTextTheme
keyboardType: .display1
TextInputType.numberWithOptions( .color,
signed: false, decimal: true), borderRadius:
prefixIcon: Padding( BorderRadius.all(
padding: EdgeInsets.only(top: 9), Radius.circular(6))),
child: child: Center(
Text(sendViewModel.fiat.title + ':', child: Text(
style: TextStyle( S.of(context).all,
fontSize: 16, textAlign:
fontWeight: FontWeight.w600, TextAlign.center,
color: Colors.white, 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(
hintText: '0.00', sendViewModel.balance,
borderColor: Theme.of(context) style: TextStyle(
.primaryTextTheme fontSize: 12,
.headline fontWeight: FontWeight.w600,
.color, color: Theme.of(context)
textStyle: TextStyle( .primaryTextTheme
fontSize: 14, .headline
fontWeight: FontWeight.w500, .decorationColor),
color: Colors.white), )
placeholderTextStyle: TextStyle( ],
color: Theme.of(context) ),
.primaryTextTheme )),
.headline Padding(
.decorationColor, padding: const EdgeInsets.only(top: 20),
fontWeight: FontWeight.w500,
fontSize: 14),
)),
Padding(
padding: EdgeInsets.only(top: 20),
child: BaseTextFormField( child: BaseTextFormField(
controller: noteController, focusNode: fiatAmountFocus,
keyboardType: TextInputType.multiline, controller: fiatAmountController,
maxLines: null, 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) borderColor: Theme.of(context)
.primaryTextTheme .primaryTextTheme
.headline .headline
@ -312,130 +293,153 @@ 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,
placeholderTextStyle: TextStyle( placeholderTextStyle: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Theme.of(context) color: Theme.of(context)
.primaryTextTheme .primaryTextTheme
.headline .headline
.decorationColor), .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( Observer(
onTap: () => builder: (_) => GestureDetector(
_setTransactionPriority(context), onTap: () =>
child: Container( _setTransactionPriority(context),
padding: EdgeInsets.only(top: 24), child: Container(
child: Row( padding: EdgeInsets.only(top: 24),
mainAxisAlignment: child: Row(
MainAxisAlignment.spaceBetween, mainAxisAlignment:
crossAxisAlignment: CrossAxisAlignment.start, MainAxisAlignment.spaceBetween,
children: <Widget>[ crossAxisAlignment: CrossAxisAlignment.start,
Text( children: <Widget>[
S Text(
.of(context) S
.send_estimated_fee, .of(context)
style: TextStyle( .send_estimated_fee,
fontSize: 12, style: TextStyle(
fontWeight: fontSize: 12,
FontWeight.w500, fontWeight:
//color: Theme.of(context).primaryTextTheme.display2.color, FontWeight.w500,
color: Colors.white)), //color: Theme.of(context).primaryTextTheme.display2.color,
Container( color: Colors.white)),
child: Row( Container(
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( child: Row(
mainAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
MainAxisAlignment.spaceBetween, children: <Widget>[
children: [ Column(
Text( mainAxisAlignment: MainAxisAlignment.start,
S.of(context).coin_control, crossAxisAlignment: CrossAxisAlignment.end,
style: TextStyle( children: [
fontSize: 12, Text(
fontWeight: FontWeight.w600, output
color: Colors.white)), .estimatedFee
Icon( .toString() +
Icons.arrow_forward_ios, ' ' +
size: 12, sendViewModel
color: Colors.white, .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,
)
],
)
)
)
)
],
)
), ),
) ),
)); )
],
);
} }
void _setEffects(BuildContext context) { void _setEffects(BuildContext context) {