mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-23 19:16:09 +00:00
CAKE-134. CAKE-139. FIXES.
This commit is contained in:
parent
ed72cee3f4
commit
9f498f30a2
8 changed files with 357 additions and 234 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
import 'package:cake_wallet/bitcoin/bitcoin_wallet_service.dart';
|
import 'package:cake_wallet/bitcoin/bitcoin_wallet_service.dart';
|
||||||
import 'package:cake_wallet/core/wallet_service.dart';
|
import 'package:cake_wallet/core/wallet_service.dart';
|
||||||
import 'package:cake_wallet/entities/biometric_auth.dart';
|
import 'package:cake_wallet/entities/biometric_auth.dart';
|
||||||
|
@ -332,7 +333,8 @@ Future setup(
|
||||||
getIt.registerFactory(() => ExchangeTradeViewModel(
|
getIt.registerFactory(() => ExchangeTradeViewModel(
|
||||||
wallet: getIt.get<AppStore>().wallet,
|
wallet: getIt.get<AppStore>().wallet,
|
||||||
trades: tradesSource,
|
trades: tradesSource,
|
||||||
tradesStore: getIt.get<TradesStore>()));
|
tradesStore: getIt.get<TradesStore>(),
|
||||||
|
sendViewModel: getIt.get<SendViewModel>()));
|
||||||
|
|
||||||
getIt.registerFactory(() => ExchangePage(getIt.get<ExchangeViewModel>()));
|
getIt.registerFactory(() => ExchangePage(getIt.get<ExchangeViewModel>()));
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,7 @@ class CurrencyPickerState extends State<CurrencyPicker> {
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
GridView.count(
|
GridView.count(
|
||||||
|
padding: EdgeInsets.all(0),
|
||||||
controller: controller,
|
controller: controller,
|
||||||
crossAxisCount: crossAxisCount,
|
crossAxisCount: crossAxisCount,
|
||||||
childAspectRatio: 1.25,
|
childAspectRatio: 1.25,
|
||||||
|
|
|
@ -1,31 +1,26 @@
|
||||||
import 'package:cake_wallet/palette.dart';
|
import 'dart:ui';
|
||||||
import 'package:cake_wallet/entities/crypto_currency.dart';
|
|
||||||
import 'package:cake_wallet/exchange/exchange_provider_description.dart';
|
|
||||||
import 'package:cake_wallet/src/screens/exchange_trade/exchange_trade_item.dart';
|
|
||||||
import 'package:cake_wallet/src/screens/exchange_trade/information_page.dart';
|
|
||||||
import 'package:cake_wallet/src/widgets/standart_list_row.dart';
|
|
||||||
import 'package:cake_wallet/utils/show_bar.dart';
|
|
||||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
|
||||||
import 'package:cake_wallet/view_model/exchange/exchange_trade_view_model.dart';
|
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
|
import 'package:cake_wallet/core/execution_state.dart';
|
||||||
// import 'package:cake_wallet/src/stores/exchange_trade/exchange_trade_store.dart';
|
import 'package:cake_wallet/entities/crypto_currency.dart';
|
||||||
// import 'package:cake_wallet/src/stores/send/send_store.dart';
|
import 'package:cake_wallet/exchange/exchange_provider_description.dart';
|
||||||
// import 'package:cake_wallet/src/stores/send/sending_state.dart';
|
import 'package:cake_wallet/src/screens/exchange_trade/information_page.dart';
|
||||||
// import 'package:cake_wallet/src/stores/wallet/wallet_store.dart';
|
import 'package:cake_wallet/src/screens/send/widgets/confirm_sending_alert.dart';
|
||||||
|
import 'package:cake_wallet/src/widgets/standart_list_row.dart';
|
||||||
|
import 'package:cake_wallet/utils/show_bar.dart';
|
||||||
|
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||||
|
import 'package:cake_wallet/view_model/exchange/exchange_trade_view_model.dart';
|
||||||
|
import 'package:cake_wallet/view_model/send/send_view_model_state.dart';
|
||||||
import 'package:cake_wallet/src/screens/receive/widgets/qr_image.dart';
|
import 'package:cake_wallet/src/screens/receive/widgets/qr_image.dart';
|
||||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||||
import 'package:cake_wallet/src/screens/exchange_trade/widgets/timer_widget.dart';
|
import 'package:cake_wallet/src/screens/exchange_trade/widgets/timer_widget.dart';
|
||||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
|
||||||
|
|
||||||
void showInformation(
|
void showInformation(
|
||||||
ExchangeTradeViewModel exchangeTradeViewModel, BuildContext context) {
|
ExchangeTradeViewModel exchangeTradeViewModel, BuildContext context) {
|
||||||
|
@ -110,7 +105,7 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
|
||||||
width: 16,
|
width: 16,
|
||||||
color: Theme.of(context).primaryTextTheme.overline.color);
|
color: Theme.of(context).primaryTextTheme.overline.color);
|
||||||
|
|
||||||
//_setEffects(context);
|
_setEffects(context);
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
child: ScrollableWithBottomSection(
|
child: ScrollableWithBottomSection(
|
||||||
|
@ -227,44 +222,25 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
bottomSectionPadding: EdgeInsets.fromLTRB(24, 0, 24, 24),
|
bottomSectionPadding: EdgeInsets.fromLTRB(24, 0, 24, 24),
|
||||||
bottomSection:
|
bottomSection: Observer(builder: (_) {
|
||||||
/*Observer(
|
|
||||||
builder: (_) => tradeStore.trade.from == CryptoCurrency.xmr &&
|
|
||||||
!(sendStore.state is TransactionCommitted)
|
|
||||||
? LoadingPrimaryButton(
|
|
||||||
isDisabled: tradeStore.trade.inputAddress == null ||
|
|
||||||
tradeStore.trade.inputAddress.isEmpty,
|
|
||||||
isLoading: sendStore.state is CreatingTransaction ||
|
|
||||||
sendStore.state is TransactionCommitted,
|
|
||||||
onPressed: () => sendStore.createTransaction(
|
|
||||||
address: tradeStore.trade.inputAddress,
|
|
||||||
amount: tradeStore.trade.amount),
|
|
||||||
text: tradeStore.trade.provider ==
|
|
||||||
ExchangeProviderDescription.xmrto
|
|
||||||
? S.of(context).confirm
|
|
||||||
: S.of(context).send_xmr,
|
|
||||||
color: Colors.blue,
|
|
||||||
textColor: Colors.white)
|
|
||||||
: Offstage()),*/
|
|
||||||
Observer(
|
|
||||||
builder: (_) {
|
|
||||||
final trade = widget.exchangeTradeViewModel.trade;
|
final trade = widget.exchangeTradeViewModel.trade;
|
||||||
|
final sendingState =
|
||||||
|
widget.exchangeTradeViewModel.sendViewModel.state;
|
||||||
|
|
||||||
return trade.from == CryptoCurrency.xmr
|
return trade.from == CryptoCurrency.xmr && !(sendingState is TransactionCommitted)
|
||||||
? LoadingPrimaryButton(
|
? LoadingPrimaryButton(
|
||||||
isDisabled: trade.inputAddress == null ||
|
isDisabled: trade.inputAddress == null ||
|
||||||
trade.inputAddress.isEmpty,
|
trade.inputAddress.isEmpty,
|
||||||
isLoading: false, // FIXME
|
isLoading: sendingState is IsExecutingState,
|
||||||
onPressed: () {}, // FIXME
|
onPressed: () =>
|
||||||
text: trade.provider ==
|
widget.exchangeTradeViewModel.confirmSending(),
|
||||||
ExchangeProviderDescription.xmrto
|
text: trade.provider == ExchangeProviderDescription.xmrto
|
||||||
? S.of(context).confirm
|
? S.of(context).confirm
|
||||||
: S.of(context).send_xmr,
|
: S.of(context).send_xmr,
|
||||||
color: Theme.of(context).accentTextTheme.body2.color,
|
color: Theme.of(context).accentTextTheme.body2.color,
|
||||||
textColor: Colors.white)
|
textColor: Colors.white)
|
||||||
: Offstage();
|
: Offstage();
|
||||||
})
|
})),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,10 +249,9 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*final sendStore = Provider.of<SendStore>(context);
|
reaction((_) => this.widget.exchangeTradeViewModel.sendViewModel.state,
|
||||||
|
(ExecutionState state) {
|
||||||
reaction((_) => sendStore.state, (SendingState state) {
|
if (state is FailureState) {
|
||||||
if (state is SendingFailed) {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
showPopUp<void>(
|
showPopUp<void>(
|
||||||
context: context,
|
context: context,
|
||||||
|
@ -285,30 +260,126 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
|
||||||
alertTitle: S.of(context).error,
|
alertTitle: S.of(context).error,
|
||||||
alertContent: state.error,
|
alertContent: state.error,
|
||||||
buttonText: S.of(context).ok,
|
buttonText: S.of(context).ok,
|
||||||
buttonAction: () => Navigator.of(context).pop()
|
buttonAction: () => Navigator.of(context).pop());
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state is TransactionCreatedSuccessfully) {
|
if (state is ExecutedSuccessfullyState) {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
showPopUp<void>(
|
showPopUp<void>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertWithTwoActions(
|
return ConfirmSendingAlert(
|
||||||
alertTitle: S.of(context).confirm_sending,
|
alertTitle: S.of(context).confirm_sending,
|
||||||
alertContent: S.of(context).commit_transaction_amount_fee(
|
amount: S.of(context).send_amount,
|
||||||
sendStore.pendingTransaction.amount,
|
amountValue: widget.exchangeTradeViewModel.sendViewModel
|
||||||
sendStore.pendingTransaction.fee),
|
.pendingTransaction.amountFormatted,
|
||||||
leftButtonText: S.of(context).ok,
|
fee: S.of(context).send_fee,
|
||||||
rightButtonText: S.of(context).cancel,
|
feeValue: widget.exchangeTradeViewModel.sendViewModel
|
||||||
actionLeftButton: () {
|
.pendingTransaction.feeFormatted,
|
||||||
|
rightButtonText: S.of(context).ok,
|
||||||
|
leftButtonText: S.of(context).cancel,
|
||||||
|
actionRightButton: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
sendStore.commitTransaction();
|
widget.exchangeTradeViewModel.sendViewModel
|
||||||
},
|
.commitTransaction();
|
||||||
actionRightButton: () => Navigator.of(context).pop()
|
showPopUp<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return Observer(builder: (_) {
|
||||||
|
final state = widget
|
||||||
|
.exchangeTradeViewModel.sendViewModel.state;
|
||||||
|
|
||||||
|
if (state is TransactionCommitted) {
|
||||||
|
return Stack(
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
color: Theme.of(context).backgroundColor,
|
||||||
|
child: Center(
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/birthday_cake.png'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: 220, left: 24, right: 24),
|
||||||
|
child: Text(
|
||||||
|
S.of(context).send_success,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.title
|
||||||
|
.color,
|
||||||
|
decoration: TextDecoration.none,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
left: 24,
|
||||||
|
right: 24,
|
||||||
|
bottom: 24,
|
||||||
|
child: PrimaryButton(
|
||||||
|
onPressed: () =>
|
||||||
|
Navigator.of(context).pop(),
|
||||||
|
text: S.of(context).send_got_it,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.accentTextTheme
|
||||||
|
.body2
|
||||||
|
.color,
|
||||||
|
textColor: Colors.white))
|
||||||
|
],
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Stack(
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
color: Theme.of(context).backgroundColor,
|
||||||
|
child: Center(
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/birthday_cake.png'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
BackdropFilter(
|
||||||
|
filter: ImageFilter.blur(
|
||||||
|
sigmaX: 3.0, sigmaY: 3.0),
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.backgroundColor
|
||||||
|
.withOpacity(0.25)),
|
||||||
|
child: Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.only(top: 220),
|
||||||
|
child: Text(
|
||||||
|
S.of(context).send_sending,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.title
|
||||||
|
.color,
|
||||||
|
decoration: TextDecoration.none,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
actionLeftButton: () => Navigator.of(context).pop());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -322,12 +393,11 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
|
||||||
alertTitle: S.of(context).sending,
|
alertTitle: S.of(context).sending,
|
||||||
alertContent: S.of(context).transaction_sent,
|
alertContent: S.of(context).transaction_sent,
|
||||||
buttonText: S.of(context).ok,
|
buttonText: S.of(context).ok,
|
||||||
buttonAction: () => Navigator.of(context).pop()
|
buttonAction: () => Navigator.of(context).pop());
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});*/
|
});
|
||||||
|
|
||||||
_effectsInstalled = true;
|
_effectsInstalled = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -483,8 +483,16 @@ class SendPage extends BasePage {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
text: S.of(context).send,
|
text: S.of(context).send,
|
||||||
color: Theme.of(context).accentTextTheme.body2.color,
|
color: Theme
|
||||||
textColor: Colors.white,
|
.of(context)
|
||||||
|
.accentTextTheme
|
||||||
|
.subtitle
|
||||||
|
.decorationColor,
|
||||||
|
textColor: Theme
|
||||||
|
.of(context)
|
||||||
|
.accentTextTheme
|
||||||
|
.headline
|
||||||
|
.decorationColor,
|
||||||
isLoading: sendViewModel.state is IsExecutingState ||
|
isLoading: sendViewModel.state is IsExecutingState ||
|
||||||
sendViewModel.state is TransactionCommitting,
|
sendViewModel.state is TransactionCommitting,
|
||||||
isDisabled:
|
isDisabled:
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
import 'package:cake_wallet/src/widgets/address_text_field.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
|
||||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
|
||||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||||
|
import 'package:keyboard_actions/keyboard_actions.dart';
|
||||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
import 'package:cake_wallet/view_model/send/send_view_model.dart';
|
import 'package:cake_wallet/view_model/send/send_view_model.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:cake_wallet/src/widgets/address_text_field.dart';
|
||||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:cake_wallet/src/widgets/keyboard_done_button.dart';
|
||||||
|
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||||
|
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||||
|
|
||||||
class SendTemplatePage extends BasePage {
|
class SendTemplatePage extends BasePage {
|
||||||
SendTemplatePage({@required this.sendViewModel});
|
SendTemplatePage({@required this.sendViewModel});
|
||||||
|
@ -20,6 +22,8 @@ class SendTemplatePage extends BasePage {
|
||||||
final _fiatAmountController = TextEditingController();
|
final _fiatAmountController = TextEditingController();
|
||||||
final _nameController = TextEditingController();
|
final _nameController = TextEditingController();
|
||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
final FocusNode _cryptoAmountFocus = FocusNode();
|
||||||
|
final FocusNode _fiatAmountFocus = FocusNode();
|
||||||
|
|
||||||
bool _effectsInstalled = false;
|
bool _effectsInstalled = false;
|
||||||
|
|
||||||
|
@ -42,7 +46,25 @@ class SendTemplatePage extends BasePage {
|
||||||
Widget body(BuildContext context) {
|
Widget body(BuildContext context) {
|
||||||
_setEffects(context);
|
_setEffects(context);
|
||||||
|
|
||||||
return Container(
|
return KeyboardActions(
|
||||||
|
config: KeyboardActionsConfig(
|
||||||
|
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
|
||||||
|
keyboardBarColor: isDarkTheme
|
||||||
|
? Color.fromRGBO(48, 51, 60, 1.0)
|
||||||
|
: Color.fromRGBO(98, 98, 98, 1.0),
|
||||||
|
nextFocus: false,
|
||||||
|
actions: [
|
||||||
|
KeyboardActionsItem(
|
||||||
|
focusNode: _cryptoAmountFocus,
|
||||||
|
toolbarButtons: [(_) => KeyboardDoneButton()],
|
||||||
|
),
|
||||||
|
KeyboardActionsItem(
|
||||||
|
focusNode: _fiatAmountFocus,
|
||||||
|
toolbarButtons: [(_) => KeyboardDoneButton()],
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
child: Container(
|
||||||
|
height: 0,
|
||||||
color: Theme.of(context).backgroundColor,
|
color: Theme.of(context).backgroundColor,
|
||||||
child: ScrollableWithBottomSection(
|
child: ScrollableWithBottomSection(
|
||||||
contentPadding: EdgeInsets.only(bottom: 24),
|
contentPadding: EdgeInsets.only(bottom: 24),
|
||||||
|
@ -50,8 +72,7 @@ class SendTemplatePage extends BasePage {
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.only(
|
borderRadius: BorderRadius.only(
|
||||||
bottomLeft: Radius.circular(24),
|
bottomLeft: Radius.circular(24),
|
||||||
bottomRight: Radius.circular(24)
|
bottomRight: Radius.circular(24)),
|
||||||
),
|
|
||||||
gradient: LinearGradient(colors: [
|
gradient: LinearGradient(colors: [
|
||||||
Theme.of(context).primaryTextTheme.subhead.color,
|
Theme.of(context).primaryTextTheme.subhead.color,
|
||||||
Theme.of(context).primaryTextTheme.subhead.decorationColor,
|
Theme.of(context).primaryTextTheme.subhead.decorationColor,
|
||||||
|
@ -67,10 +88,8 @@ class SendTemplatePage extends BasePage {
|
||||||
BaseTextFormField(
|
BaseTextFormField(
|
||||||
controller: _nameController,
|
controller: _nameController,
|
||||||
hintText: S.of(context).send_name,
|
hintText: S.of(context).send_name,
|
||||||
borderColor: Theme.of(context)
|
borderColor:
|
||||||
.primaryTextTheme
|
Theme.of(context).primaryTextTheme.headline.color,
|
||||||
.headline
|
|
||||||
.color,
|
|
||||||
textStyle: TextStyle(
|
textStyle: TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
|
@ -107,10 +126,14 @@ class SendTemplatePage extends BasePage {
|
||||||
AddressTextFieldOption.qrCode,
|
AddressTextFieldOption.qrCode,
|
||||||
AddressTextFieldOption.addressBook
|
AddressTextFieldOption.addressBook
|
||||||
],
|
],
|
||||||
buttonColor:
|
buttonColor: Theme.of(context)
|
||||||
Theme.of(context).primaryTextTheme.display1.color,
|
.primaryTextTheme
|
||||||
borderColor:
|
.display1
|
||||||
Theme.of(context).primaryTextTheme.headline.color,
|
.color,
|
||||||
|
borderColor: Theme.of(context)
|
||||||
|
.primaryTextTheme
|
||||||
|
.headline
|
||||||
|
.color,
|
||||||
textStyle: TextStyle(
|
textStyle: TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
|
@ -129,6 +152,7 @@ class SendTemplatePage extends BasePage {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(top: 20),
|
padding: const EdgeInsets.only(top: 20),
|
||||||
child: BaseTextFormField(
|
child: BaseTextFormField(
|
||||||
|
focusNode: _cryptoAmountFocus,
|
||||||
controller: _cryptoAmountController,
|
controller: _cryptoAmountController,
|
||||||
keyboardType: TextInputType.numberWithOptions(
|
keyboardType: TextInputType.numberWithOptions(
|
||||||
signed: false, decimal: true),
|
signed: false, decimal: true),
|
||||||
|
@ -167,6 +191,7 @@ class SendTemplatePage extends BasePage {
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 20),
|
padding: const EdgeInsets.only(top: 20),
|
||||||
child: BaseTextFormField(
|
child: BaseTextFormField(
|
||||||
|
focusNode: _fiatAmountFocus,
|
||||||
controller: _fiatAmountController,
|
controller: _fiatAmountController,
|
||||||
keyboardType: TextInputType.numberWithOptions(
|
keyboardType: TextInputType.numberWithOptions(
|
||||||
signed: false, decimal: true),
|
signed: false, decimal: true),
|
||||||
|
@ -206,7 +231,8 @@ class SendTemplatePage extends BasePage {
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
bottomSectionPadding:
|
||||||
|
EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||||
bottomSection: PrimaryButton(
|
bottomSection: PrimaryButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (_formKey.currentState.validate()) {
|
if (_formKey.currentState.validate()) {
|
||||||
|
@ -220,10 +246,12 @@ class SendTemplatePage extends BasePage {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
text: S.of(context).save,
|
text: S.of(context).save,
|
||||||
color: Colors.green,
|
color: Theme.of(context).accentTextTheme.subtitle.decorationColor,
|
||||||
textColor: Colors.white),
|
textColor:
|
||||||
|
Theme.of(context).accentTextTheme.headline.decorationColor,
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _setEffects(BuildContext context) {
|
void _setEffects(BuildContext context) {
|
||||||
|
|
|
@ -13,29 +13,29 @@ import 'package:cake_wallet/src/widgets/standart_list_row.dart';
|
||||||
class TradeDetailsPage extends BasePage {
|
class TradeDetailsPage extends BasePage {
|
||||||
TradeDetailsPage(this.trade) : _items = [] {
|
TradeDetailsPage(this.trade) : _items = [] {
|
||||||
final dateFormat = DateFormatter.withCurrentLocal();
|
final dateFormat = DateFormatter.withCurrentLocal();
|
||||||
final items = [
|
_items.addAll([
|
||||||
StandartListItem(title: S.current.trade_details_id, value: trade.id),
|
StandartListItem(title: S.current.trade_details_id, value: trade.id),
|
||||||
StandartListItem(
|
StandartListItem(
|
||||||
title: S.current.trade_details_state,
|
title: S.current.trade_details_state,
|
||||||
value: trade.state != null
|
value: trade.state != null
|
||||||
? trade.state.toString()
|
? trade.state.toString()
|
||||||
: S.current.trade_details_fetching)
|
: S.current.trade_details_fetching)
|
||||||
];
|
]);
|
||||||
|
|
||||||
if (trade.provider != null) {
|
if (trade.provider != null) {
|
||||||
items.add(StandartListItem(
|
_items.add(StandartListItem(
|
||||||
title: S.current.trade_details_provider,
|
title: S.current.trade_details_provider,
|
||||||
value: trade.provider.toString()));
|
value: trade.provider.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trade.createdAt != null) {
|
if (trade.createdAt != null) {
|
||||||
items.add(StandartListItem(
|
_items.add(StandartListItem(
|
||||||
title: S.current.trade_details_created_at,
|
title: S.current.trade_details_created_at,
|
||||||
value: dateFormat.format(trade.createdAt).toString()));
|
value: dateFormat.format(trade.createdAt).toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trade.from != null && trade.to != null) {
|
if (trade.from != null && trade.to != null) {
|
||||||
items.add(StandartListItem(
|
_items.add(StandartListItem(
|
||||||
title: S.current.trade_details_pair,
|
title: S.current.trade_details_pair,
|
||||||
value: '${trade.from.toString()} → ${trade.to.toString()}'));
|
value: '${trade.from.toString()} → ${trade.to.toString()}'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import 'package:cake_wallet/exchange/morphtoken/morphtoken_exchange_provider.dar
|
||||||
import 'package:cake_wallet/exchange/trade.dart';
|
import 'package:cake_wallet/exchange/trade.dart';
|
||||||
import 'package:cake_wallet/exchange/xmrto/xmrto_exchange_provider.dart';
|
import 'package:cake_wallet/exchange/xmrto/xmrto_exchange_provider.dart';
|
||||||
import 'package:cake_wallet/store/dashboard/trades_store.dart';
|
import 'package:cake_wallet/store/dashboard/trades_store.dart';
|
||||||
|
import 'package:cake_wallet/view_model/send/send_view_model.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
import 'package:cake_wallet/src/screens/exchange_trade/exchange_trade_item.dart';
|
import 'package:cake_wallet/src/screens/exchange_trade/exchange_trade_item.dart';
|
||||||
|
@ -18,7 +19,8 @@ class ExchangeTradeViewModel = ExchangeTradeViewModelBase
|
||||||
with _$ExchangeTradeViewModel;
|
with _$ExchangeTradeViewModel;
|
||||||
|
|
||||||
abstract class ExchangeTradeViewModelBase with Store {
|
abstract class ExchangeTradeViewModelBase with Store {
|
||||||
ExchangeTradeViewModelBase({this.wallet, this.trades, this.tradesStore}) {
|
ExchangeTradeViewModelBase(
|
||||||
|
{this.wallet, this.trades, this.tradesStore, this.sendViewModel}) {
|
||||||
trade = tradesStore.trade;
|
trade = tradesStore.trade;
|
||||||
|
|
||||||
isSendable = trade.from == wallet.currency ||
|
isSendable = trade.from == wallet.currency ||
|
||||||
|
@ -57,6 +59,7 @@ abstract class ExchangeTradeViewModelBase with Store {
|
||||||
final WalletBase wallet;
|
final WalletBase wallet;
|
||||||
final Box<Trade> trades;
|
final Box<Trade> trades;
|
||||||
final TradesStore tradesStore;
|
final TradesStore tradesStore;
|
||||||
|
final SendViewModel sendViewModel;
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
Trade trade;
|
Trade trade;
|
||||||
|
@ -71,6 +74,17 @@ abstract class ExchangeTradeViewModelBase with Store {
|
||||||
|
|
||||||
Timer _timer;
|
Timer _timer;
|
||||||
|
|
||||||
|
@action
|
||||||
|
Future confirmSending() async {
|
||||||
|
if (!isSendable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sendViewModel.address = trade.inputAddress;
|
||||||
|
sendViewModel.setCryptoAmount(trade.amount);
|
||||||
|
await sendViewModel.createTransaction();
|
||||||
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
Future<void> _updateTrade() async {
|
Future<void> _updateTrade() async {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:mobx/mobx.dart';
|
||||||
import 'package:cake_wallet/entities/openalias_record.dart';
|
import 'package:cake_wallet/entities/openalias_record.dart';
|
||||||
import 'package:cake_wallet/entities/template.dart';
|
import 'package:cake_wallet/entities/template.dart';
|
||||||
import 'package:cake_wallet/store/templates/send_template_store.dart';
|
import 'package:cake_wallet/store/templates/send_template_store.dart';
|
||||||
import 'package:intl/intl.dart';
|
|
||||||
import 'package:mobx/mobx.dart';
|
|
||||||
import 'package:cake_wallet/core/template_validator.dart';
|
import 'package:cake_wallet/core/template_validator.dart';
|
||||||
import 'package:cake_wallet/core/address_validator.dart';
|
import 'package:cake_wallet/core/address_validator.dart';
|
||||||
import 'package:cake_wallet/core/amount_validator.dart';
|
import 'package:cake_wallet/core/amount_validator.dart';
|
||||||
|
|
Loading…
Reference in a new issue