dev
dart 120 lines 5.07 KB
Raw
1 import 'package:cake_wallet/entities/new_ui_entities/list_item/list_item_regular_row.dart';
2 import 'package:cake_wallet/generated/i18n.dart';
3 import 'package:cake_wallet/new-ui/widgets/receive_page/receive_top_bar.dart';
4 import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
5 import 'package:cake_wallet/src/widgets/new_list_row/new_list_section.dart';
6 import 'package:cake_wallet/wallet_types.g.dart';
7 import 'package:flutter/material.dart';
8 import 'package:hive/hive.dart';
9 import 'package:url_launcher/url_launcher.dart';
10
11 class ScanPageNetworkList extends StatelessWidget {
12 const ScanPageNetworkList({super.key});
13
14 /// Same icon the row would render from `trailingIconPath`, but it now carries the
15 /// information that following the row leaves the app.
16 Widget _externalLinkIcon(BuildContext context) => Semantics(
17 label: S.of(context).opens_in_browser,
18 excludeSemantics: true,
19 child: CakeImageWidget(
20 imageUrl: "assets/new-ui/external_link.svg",
21 height: 18,
22 width: 18,
23 colorFilter:
24 ColorFilter.mode(Theme.of(context).colorScheme.onSurfaceVariant, BlendMode.srcIn),
25 ),
26 );
27
28 @override
29 Widget build(BuildContext context) {
30 return Container(
31 decoration: BoxDecoration(
32 borderRadius: BorderRadius.vertical(top: Radius.circular(18)),
33 color: Theme.of(context).colorScheme.surface),
34 child: Column(
35 children: [
36 ModalTopBar(
37 title: S.of(context).compatible_services,
38 leadingIcon: Icon(Icons.arrow_back_ios_new),
39 leadingSemanticLabel: S.of(context).seed_alert_back,
40 onLeadingPressed: Navigator.of(context).pop,
41 ),
42 Padding(
43 padding: const EdgeInsets.symmetric(horizontal: 24.0),
44 child: Column(
45 spacing: 32,
46 children: [
47 Column(
48 spacing: 24,
49 children: [
50 CakeImageWidget(
51 imageUrl: "assets/new-ui/scan_service.svg",
52 width: 75,
53 height: 75,
54 colorFilter:
55 ColorFilter.mode(Theme.of(context).colorScheme.primary, BlendMode.srcIn),
56 ),
57 Text(
58 S.of(context).compatible_services_desc,
59 style: TextStyle(color: Theme.of(context).colorScheme.onSurfaceVariant),
60 textAlign: TextAlign.center,
61 )
62 ],
63 ),
64 NewListSections(sections: {
65 "base": [
66 ListItemRegularRow(
67 keyValue: "addrs",
68 label: S.of(context).crypto_addresses,
69 showArrow: false,
70 iconPath: "assets/new-ui/navbar/wallets.svg",
71 iconColor: Theme.of(context).colorScheme.onSurfaceVariant,
72 subtitle: "${availableWalletTypes.length} ${S.of(context).networks}"),
73 ListItemRegularRow(
74 keyValue: "invoices",
75 label: S.of(context).payment_invoices,
76 showArrow: false,
77 iconColor: Theme.of(context).colorScheme.onSurfaceVariant,
78 iconPath: "assets/new-ui/payment_invoices.svg"),
79 ListItemRegularRow(
80 keyValue: "contacts",
81 label: S.of(context).contacts,
82 showArrow: false,
83 iconColor: Theme.of(context).colorScheme.onSurfaceVariant,
84 iconPath: "assets/new-ui/navbar/contacts.svg"),
85 ListItemRegularRow(
86 keyValue: "nodes",
87 label: S.of(context).nodes,
88 showArrow: false,
89 iconColor: Theme.of(context).colorScheme.onSurfaceVariant,
90 iconPath: "assets/new-ui/node_minimal.svg"),
91 ],
92 "extra": [
93 ListItemRegularRow(
94 iconPath: "assets/new-ui/wc_min.svg",
95 keyValue: "wc",
96 label: "WalletConnect",
97 subtitle: S.of(context).wc_desc,
98 trailingWidget: _externalLinkIcon(context),
99 onTap: () {
100 launchUrl(Uri.https("walletconnect.com"));
101 }),
102 ListItemRegularRow(
103 iconPath: "assets/new-ui/ocp_min.svg",
104 keyValue: "ocp",
105 label: "OpenCryptoPay",
106 subtitle: S.of(context).ocp_desc,
107 trailingWidget: _externalLinkIcon(context),
108 onTap: () {
109 launchUrl(Uri.https("opencryptopay.io"));
110 })
111 ]
112 })
113 ],
114 ),
115 )
116 ],
117 ),
118 );
119 }
120 }