dev
dart 152 lines 6.56 KB
Raw
1 import "package:cake_wallet/generated/i18n.dart";
2 import "package:cake_wallet/new-ui/widgets/new_primary_button.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:flutter/material.dart";
6 import "package:url_launcher/url_launcher.dart";
7
8 class ZcashMigrationModal extends StatelessWidget {
9 const ZcashMigrationModal({required this.hasContinue, required this.balance, super.key});
10
11 final String balance;
12 final bool hasContinue;
13
14 @override
15 Widget build(BuildContext context) => SafeArea(
16 bottom: false,
17 child: Container(
18 decoration: BoxDecoration(
19 color: Theme.of(context).colorScheme.surface,
20 borderRadius: const BorderRadius.vertical(top: Radius.circular(16)),),
21 child: SafeArea(
22 top: false,
23 child: Column(
24 children: [
25 ModalTopBar(
26 title: S.of(context).zcash_network_upgrade,
27 trailingIcon: const Icon(Icons.close),
28 onTrailingPressed: Navigator.of(context).pop,
29 trailingSemanticLabel: S.of(context).close,
30 ),
31 Expanded(
32 child: Padding(
33 padding: const EdgeInsets.symmetric(horizontal: 16),
34 child: Column(
35 children: [
36 Expanded(
37 child: Column(
38 spacing: 40,
39 mainAxisAlignment: MainAxisAlignment.center,
40 children: [
41 SizedBox(
42 width: 146,
43 height: 79,
44 child: Stack(
45 children: [
46 const Positioned(
47 left: 67,
48 top: 0,
49 bottom: 0,
50 child: CakeImageWidget(
51 imageUrl: "assets/new-ui/ironwood_migration.svg",
52 width: 75,
53 height: 75,
54 ),
55 ),
56 Positioned(
57 left: 0,
58 child: Container(
59 width: 79,
60 height: 79,
61 decoration: BoxDecoration(
62 borderRadius: BorderRadius.circular(99999999),
63 border: Border.all(
64 color: Theme.of(context).colorScheme.surface,
65 width: 4,),),
66 child: const CakeImageWidget(
67 imageUrl: "assets/new-ui/crypto_full_icons/zcash.svg",
68 height: 75,
69 width: 75,
70 ),
71 ),
72 ),
73 ],
74 ),
75 ),
76 Container(
77 width: double.infinity,
78 decoration: BoxDecoration(
79 borderRadius: BorderRadius.circular(12),
80 color: Theme.of(context).colorScheme.surfaceContainer,),
81 child: Padding(
82 padding: const EdgeInsets.symmetric(vertical: 12),
83 child: Row(
84 mainAxisAlignment: MainAxisAlignment.center,
85 spacing: 4,
86 children: [
87 Text(
88 balance,
89 style: TextStyle(
90 color: Theme.of(context).colorScheme.primary,),
91 ),
92 Text(S.of(context).is_currently_being_migrated),
93 ],
94 ),
95 ),),
96 RichText(
97 textAlign: TextAlign.center,
98 text: TextSpan(
99 children: [
100 TextSpan(
101 text: "${S.of(context).zcash_network_upgrade_desc_1}\n\n",
102 style: Theme.of(context).textTheme.bodyMedium,),
103 TextSpan(
104 text: "${S.of(context).zcash_network_upgrade_desc_2}\n\n",
105 style: Theme.of(context).textTheme.bodyMedium,),
106 TextSpan(
107 text: "${S.of(context).zcash_network_upgrade_desc_3}\n\n",
108 style: Theme.of(context).textTheme.bodyMedium?.copyWith(
109 color: const Color(0xFFF9C03C),
110 ),
111 ),
112 ],
113 ),
114 ),
115 ],
116 ),
117 ),
118 ],
119 ),
120 ),
121 ),
122 Padding(
123 padding: const EdgeInsets.all(12),
124 child: Column(
125 spacing: 12,
126 children: [
127 NewPrimaryButton(
128 onPressed: _launchDocs,
129 text: S.of(context).learn_more,
130 color: Theme.of(context).colorScheme.surfaceContainer,
131 textColor: Theme.of(context).colorScheme.primary,),
132 if (hasContinue)
133 NewPrimaryButton(
134 onPressed: Navigator.of(context).pop,
135 text: S.of(context).continue_text,
136 color: Theme.of(context).colorScheme.primary,
137 textColor: Theme.of(context).colorScheme.onPrimary,),
138 ],
139 ),
140 ),
141 ],
142 ),
143 ),
144 ),
145 );
146
147 void _launchDocs() {
148 try {
149 launchUrl(Uri.parse("https://docs.cakewallet.com/cryptos/zcash/ironwood-migration"));
150 } catch (_) {}
151 }
152 }