mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-04-07 06:57:29 +00:00
Changed way to committing of transactions.
This commit is contained in:
parent
465c69c776
commit
b7e8abcb95
4 changed files with 66 additions and 21 deletions
lib/src
screens
stores/send
|
@ -296,7 +296,7 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
|
|||
}),
|
||||
bottomSection: Observer(
|
||||
builder: (_) => tradeStore.trade.from == CryptoCurrency.xmr &&
|
||||
!(sendStore.state is TransactionCreatedSuccessfully)
|
||||
!(sendStore.state is TransactionCommitted)
|
||||
? Container(
|
||||
padding: EdgeInsets.only(top: 20.0, bottom: 20.0),
|
||||
child: LoadingPrimaryButton(
|
||||
|
@ -351,6 +351,33 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
|
|||
}
|
||||
|
||||
if (state is TransactionCreatedSuccessfully) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(S.of(context).confirm_sending),
|
||||
content: Text(S.of(context).commit_transaction_amount_fee(
|
||||
sendStore.pendingTransaction.amount,
|
||||
sendStore.pendingTransaction.fee)),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
child: Text(S.of(context).ok),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
sendStore.commitTransaction();
|
||||
}),
|
||||
FlatButton(
|
||||
child: Text(S.of(context).cancel),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
)
|
||||
],
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (state is TransactionCommitted) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
|
|
|
@ -7,6 +7,7 @@ import 'package:cake_wallet/src/stores/settings/settings_store.dart';
|
|||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
|
||||
class FaqPage extends BasePage {
|
||||
@override
|
||||
String get title => S.current.faq;
|
||||
|
||||
@override
|
||||
|
@ -21,24 +22,18 @@ class FaqPage extends BasePage {
|
|||
final itemChild = faqItems[index]["answer"].toString();
|
||||
|
||||
return ExpansionTile(
|
||||
title: Text(
|
||||
itemTitle
|
||||
),
|
||||
title: Text(itemTitle),
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 15.0,
|
||||
right: 15.0
|
||||
),
|
||||
child: Text(
|
||||
itemChild,
|
||||
),
|
||||
)
|
||||
)
|
||||
padding: EdgeInsets.only(left: 15.0, right: 15.0),
|
||||
child: Text(
|
||||
itemChild,
|
||||
),
|
||||
))
|
||||
],
|
||||
)
|
||||
],
|
||||
|
@ -83,4 +78,4 @@ class FaqPage extends BasePage {
|
|||
return 'assets/faq/faq_en.json';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -402,7 +402,7 @@ class SendFormState extends State<SendForm> {
|
|||
borderColor:
|
||||
Theme.of(context).accentTextTheme.button.decorationColor,
|
||||
isLoading: sendStore.state is CreatingTransaction ||
|
||||
sendStore.state is TransactionCommitted);
|
||||
sendStore.state is TransactionCommiting);
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -461,6 +461,33 @@ class SendFormState extends State<SendForm> {
|
|||
}
|
||||
|
||||
if (state is TransactionCreatedSuccessfully) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(S.of(context).confirm_sending),
|
||||
content: Text(S.of(context).commit_transaction_amount_fee(
|
||||
sendStore.pendingTransaction.amount,
|
||||
sendStore.pendingTransaction.fee)),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
child: Text(S.of(context).ok),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
sendStore.commitTransaction();
|
||||
}),
|
||||
FlatButton(
|
||||
child: Text(S.of(context).cancel),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
)
|
||||
],
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (state is TransactionCommitted) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
|
|
|
@ -26,12 +26,6 @@ abstract class SendStoreBase with Store {
|
|||
_pendingTransaction = null;
|
||||
_cryptoNumberFormat = NumberFormat()..maximumFractionDigits = 12;
|
||||
_fiatNumberFormat = NumberFormat()..maximumFractionDigits = 2;
|
||||
|
||||
reaction((_) => this.state, (SendingState state) async {
|
||||
if (state is TransactionCreatedSuccessfully) {
|
||||
await commitTransaction();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
WalletService walletService;
|
||||
|
@ -89,7 +83,9 @@ abstract class SendStoreBase with Store {
|
|||
Future commitTransaction() async {
|
||||
try {
|
||||
final transactionId = _pendingTransaction.hash;
|
||||
state = TransactionCommiting();
|
||||
await _pendingTransaction.commit();
|
||||
state = TransactionCommitted();
|
||||
|
||||
if (settingsStore.shouldSaveRecipientAddress) {
|
||||
await transactionDescriptions.add(TransactionDescription(
|
||||
|
|
Loading…
Reference in a new issue