mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 19:49:22 +00:00
Merge pull request #162 from cake-tech/CAKE-48
[CAKE-48] Block explorer link added to transaction details page.
This commit is contained in:
commit
b75484594c
3 changed files with 39 additions and 4 deletions
|
@ -0,0 +1,8 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/src/screens/transaction_details/transaction_details_list_item.dart';
|
||||
|
||||
class BlockExplorerListItem extends TransactionDetailsListItem {
|
||||
BlockExplorerListItem({String title, String value, this.onTap})
|
||||
: super(title: title, value: value);
|
||||
final Function() onTap;
|
||||
}
|
|
@ -7,8 +7,14 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter/services.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/widgets/standart_list_row.dart';
|
||||
import 'package:cake_wallet/src/screens/transaction_details/blockexplorer_list_item.dart';
|
||||
import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/utils/date_formatter.dart';
|
||||
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
class TransactionDetailsPage extends BasePage {
|
||||
TransactionDetailsPage({this.transactionDetailsViewModel});
|
||||
|
@ -33,9 +39,16 @@ class TransactionDetailsPage extends BasePage {
|
|||
showBar<void>(context,
|
||||
S.of(context).transaction_details_copied(item.title));
|
||||
},
|
||||
child: StandartListRow(
|
||||
title: '${item.title}:',
|
||||
value: item.value),
|
||||
child:
|
||||
StandartListRow(title: '${item.title}:', value: item.value),
|
||||
);
|
||||
}
|
||||
|
||||
if (item is BlockExplorerListItem) {
|
||||
return GestureDetector(
|
||||
onTap: item.onTap,
|
||||
child:
|
||||
StandartListRow(title: '${item.title}:', value: item.value),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,12 +4,14 @@ import 'package:cake_wallet/monero/monero_transaction_info.dart';
|
|||
import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart';
|
||||
import 'package:cake_wallet/src/screens/transaction_details/textfield_list_item.dart';
|
||||
import 'package:cake_wallet/src/screens/transaction_details/transaction_details_list_item.dart';
|
||||
import 'package:cake_wallet/src/screens/transaction_details/blockexplorer_list_item.dart';
|
||||
import 'package:cake_wallet/utils/date_formatter.dart';
|
||||
import 'package:cake_wallet/entities/transaction_description.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
part 'transaction_details_view_model.g.dart';
|
||||
|
||||
|
@ -41,6 +43,12 @@ abstract class TransactionDetailsViewModelBase with Store {
|
|||
value: tx.amountFormatted()),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_fee, value: tx.feeFormatted()),
|
||||
BlockExplorerListItem(
|
||||
title: "View in Block Explorer",
|
||||
value: "View Transaction on XMRChain.net",
|
||||
onTap: () {
|
||||
launch("https://xmrchain.net/search?value=${tx.id}");
|
||||
})
|
||||
];
|
||||
|
||||
if (tx.key?.isNotEmpty ?? null) {
|
||||
|
@ -69,7 +77,13 @@ abstract class TransactionDetailsViewModelBase with Store {
|
|||
if (tx.feeFormatted()?.isNotEmpty)
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_fee,
|
||||
value: tx.feeFormatted())
|
||||
value: tx.feeFormatted()),
|
||||
BlockExplorerListItem(
|
||||
title: "View in Block Explorer",
|
||||
value: "View Transaction on Blockchain.com",
|
||||
onTap: () {
|
||||
launch("https://www.blockchain.com/btc/tx/${tx.id}");
|
||||
})
|
||||
];
|
||||
|
||||
items.addAll(_items);
|
||||
|
|
Loading…
Reference in a new issue