Added the ability to view BTC and XMR transactions on web-based block explorers.

This commit is contained in:
Tanner Silva 2020-10-28 14:02:43 -03:00
parent cd5426da81
commit c2841de503
2 changed files with 37 additions and 18 deletions

View file

@ -9,6 +9,7 @@ import 'package:cake_wallet/src/widgets/standart_list_row.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';
class TransactionDetailsPage extends BasePage {
TransactionDetailsPage(this.transactionInfo) : _items = [] {
@ -26,7 +27,10 @@ class TransactionDetailsPage extends BasePage {
title: S.current.transaction_details_height, value: '${tx.height}'),
StandartListItem(
title: S.current.transaction_details_amount,
value: tx.amountFormatted())
value: tx.amountFormatted()),
StandartListItem(
title: "View in Block Explorer",
value: "https://localmonero.co/blocks/search/${tx.id}"),
];
// FIXME
// if (widget.settingsStore.shouldSaveRecipientAddress &&
@ -57,7 +61,10 @@ class TransactionDetailsPage extends BasePage {
title: S.current.transaction_details_height, value: '${tx.height}'),
StandartListItem(
title: S.current.transaction_details_amount,
value: tx.amountFormatted())
value: tx.amountFormatted()),
StandartListItem(
title: "View in Block Explorer",
value: "https://www.blockchain.com/btc/tx/${tx.id}"),
];
_items.addAll(items);
@ -88,19 +95,31 @@ class TransactionDetailsPage extends BasePage {
itemCount: _items.length,
itemBuilder: (context, index) {
final item = _items[index];
final isDrawBottom = index == _items.length - 1 ? true : false;
return GestureDetector(
onTap: () {
Clipboard.setData(ClipboardData(text: item.value));
showBar<void>(context,
S.of(context).transaction_details_copied(item.title));
},
child: StandartListRow(
title: '${item.title}:',
value: item.value,
isDrawBottom: isDrawBottom),
);
final isFinalBlockExplorerItem =
index == _items.length - 1 ? true : false;
if (isFinalBlockExplorerItem == true) {
return GestureDetector(
onTap: () {
Clipboard.setData(ClipboardData(text: item.value));
showBar<void>(context,
S.of(context).transaction_details_copied(item.title));
},
child: StandartListRow(
title: '${item.title}:',
value: "",
isDrawBottom: isFinalBlockExplorerItem),
);
} else {
return GestureDetector(
onTap: () {
launch(item.value);
},
child: StandartListRow(
title: '${item.title}:',
value: item.value,
isDrawBottom: isFinalBlockExplorerItem),
);
}
}),
);
}

View file

@ -140,7 +140,7 @@ packages:
name: build_runner
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.3"
version: "1.10.4"
build_runner_core:
dependency: transitive
description:
@ -645,7 +645,7 @@ packages:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.21"
version: "1.6.22"
path_provider_linux:
dependency: transitive
description:
@ -764,7 +764,7 @@ packages:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
version: "2.1.4+1"
rxdart:
dependency: "direct main"
description: