Added the ability to view BTC and XMR transactions on web-based block explorers.
Tanner Silva committed
Oct 28, 2020 at 14:02 UTC
c2841de503c5f19fcbea8aecfad051b78aa269d9
2 files changed
+37
-18
lib/src/screens/transaction_details/transaction_details_page.dart
+34
-15
@@ -9,6 +9,7 @@ import 'package:cake_wallet/src/widgets/standart_list_row.dart';
9
import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart';
10
import 'package:cake_wallet/src/screens/base_page.dart';
11
import 'package:cake_wallet/utils/date_formatter.dart';
12
+import 'package:url_launcher/url_launcher.dart';
13
14
class TransactionDetailsPage extends BasePage {
15
TransactionDetailsPage(this.transactionInfo) : _items = [] {
@@ -26,7 +27,10 @@ class TransactionDetailsPage extends BasePage {
27
title: S.current.transaction_details_height, value: '${tx.height}'),
28
StandartListItem(
29
title: S.current.transaction_details_amount,
29
- value: tx.amountFormatted())
30
+ value: tx.amountFormatted()),
31
+ StandartListItem(
32
+ title: "View in Block Explorer",
33
+ value: "https://localmonero.co/blocks/search/${tx.id}"),
34
];
35
// FIXME
36
// if (widget.settingsStore.shouldSaveRecipientAddress &&
@@ -57,7 +61,10 @@ class TransactionDetailsPage extends BasePage {
61
title: S.current.transaction_details_height, value: '${tx.height}'),
62
StandartListItem(
63
title: S.current.transaction_details_amount,
60
- value: tx.amountFormatted())
64
+ value: tx.amountFormatted()),
65
+ StandartListItem(
66
+ title: "View in Block Explorer",
67
+ value: "https://www.blockchain.com/btc/tx/${tx.id}"),
68
];
69
70
_items.addAll(items);
@@ -88,19 +95,31 @@ class TransactionDetailsPage extends BasePage {
95
itemCount: _items.length,
96
itemBuilder: (context, index) {
97
final item = _items[index];
91
- final isDrawBottom = index == _items.length - 1 ? true : false;
92
-
93
- return GestureDetector(
94
- onTap: () {
95
- Clipboard.setData(ClipboardData(text: item.value));
96
- showBar<void>(context,
97
- S.of(context).transaction_details_copied(item.title));
98
- },
99
- child: StandartListRow(
100
- title: '${item.title}:',
101
- value: item.value,
102
- isDrawBottom: isDrawBottom),
103
- );
98
+ final isFinalBlockExplorerItem =
99
+ index == _items.length - 1 ? true : false;
100
+ if (isFinalBlockExplorerItem == true) {
101
+ return GestureDetector(
102
+ onTap: () {
103
+ Clipboard.setData(ClipboardData(text: item.value));
104
+ showBar<void>(context,
105
+ S.of(context).transaction_details_copied(item.title));
106
+ },
107
+ child: StandartListRow(
108
+ title: '${item.title}:',
109
+ value: "",
110
+ isDrawBottom: isFinalBlockExplorerItem),
111
+ );
112
+ } else {
113
+ return GestureDetector(
114
+ onTap: () {
115
+ launch(item.value);
116
+ },
117
+ child: StandartListRow(
118
+ title: '${item.title}:',
119
+ value: item.value,
120
+ isDrawBottom: isFinalBlockExplorerItem),
121
+ );
122
+ }
123
}),
124
);
125
}
pubspec.lock
+3
-3
@@ -140,7 +140,7 @@ packages:
140
name: build_runner
141
url: "https://pub.dartlang.org"
142
source: hosted
143
- version: "1.10.3"
143
+ version: "1.10.4"
144
build_runner_core:
145
dependency: transitive
146
description:
@@ -645,7 +645,7 @@ packages:
645
name: path_provider
646
url: "https://pub.dartlang.org"
647
source: hosted
648
- version: "1.6.21"
648
+ version: "1.6.22"
649
path_provider_linux:
650
dependency: transitive
651
description:
@@ -764,7 +764,7 @@ packages:
764
name: quiver
765
url: "https://pub.dartlang.org"
766
source: hosted
767
- version: "2.1.3"
767
+ version: "2.1.4+1"
768
rxdart:
769
dependency: "direct main"
770
description: