diff --git a/lib/src/screens/trade_details/track_trade_list_item.dart b/lib/src/screens/trade_details/track_trade_list_item.dart index 5845ef753..002997bc0 100644 --- a/lib/src/screens/trade_details/track_trade_list_item.dart +++ b/lib/src/screens/trade_details/track_trade_list_item.dart @@ -1,7 +1,6 @@ -import 'package:cake_wallet/src/widgets/standart_list_row.dart'; -import 'package:flutter/material.dart'; +import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart'; -class TrackTradeListItem extends StandartListRow { +class TrackTradeListItem extends StandartListItem { TrackTradeListItem({String title, String value, this.onTap}) : super(title: title, value: value); final Function() onTap; diff --git a/lib/src/screens/trade_details/trade_details_page.dart b/lib/src/screens/trade_details/trade_details_page.dart index e4cad6547..ded8777fe 100644 --- a/lib/src/screens/trade_details/trade_details_page.dart +++ b/lib/src/screens/trade_details/trade_details_page.dart @@ -8,6 +8,7 @@ import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/widgets/standart_list_row.dart'; +import 'package:cake_wallet/src/screens/trade_details/track_trade_list_item.dart'; class TradeDetailsPage extends BasePage { TradeDetailsPage(this.tradeDetailsViewModel); @@ -26,6 +27,16 @@ class TradeDetailsPage extends BasePage { itemBuilder: (_, __, index) { final item = tradeDetailsViewModel.items[index]; + if (item is TrackTradeListItem) { + return GestureDetector( + onTap: item.onTap, + child: StandartListRow( + title: '${item.title}', + value: '${item.value}' + )); + } + + if (item is SectionStandardListItem) { return GestureDetector( onTap: () { Clipboard.setData(ClipboardData(text: '${item.value}')); @@ -37,7 +48,7 @@ class TradeDetailsPage extends BasePage { title: '${item.title}', value: '${item.value}' )); - }); + } }); } } \ No newline at end of file diff --git a/lib/view_model/trade_details_view_model.dart b/lib/view_model/trade_details_view_model.dart index 63cb5f323..b077208a3 100644 --- a/lib/view_model/trade_details_view_model.dart +++ b/lib/view_model/trade_details_view_model.dart @@ -10,7 +10,8 @@ import 'package:hive/hive.dart'; import 'package:mobx/mobx.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart'; - +import 'package:cake_wallet/src/screens/trade_details/track_trade_list_item.dart'; +import 'package:url_launcher/url_launcher.dart'; part 'trade_details_view_model.g.dart'; class TradeDetailsViewModel = TradeDetailsViewModelBase @@ -90,6 +91,15 @@ abstract class TradeDetailsViewModelBase with Store { value: trade.provider.toString())); } + if (trade.provider.title == "ChangeNOW") { + items.add(TrackTradeListItem( + title: "Track", + value: "https://changenow.io/exchange/txs/${trade.id.toString()}", + onTap: () { + launch("https://www.blockchain.com/btc/tx/${tx.id}"); + })); + } + if (trade.createdAt != null) { items.add(StandartListItem( title: S.current.trade_details_created_at, @@ -102,4 +112,4 @@ abstract class TradeDetailsViewModelBase with Store { value: '${trade.from.toString()} → ${trade.to.toString()}')); } } -} \ No newline at end of file +}