dev
dart 155 lines 6.36 KB
Raw
1 import 'dart:math';
2
3 import 'package:cake_wallet/entities/new_ui_entities/list_item/list_item_regular_row.dart';
4 import 'package:cake_wallet/generated/i18n.dart';
5 import 'package:cake_wallet/new-ui/widgets/modal_page_wrapper.dart';
6 import 'package:cake_wallet/new-ui/widgets/receive_page/receive_top_bar.dart';
7 import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
8 import 'package:cake_wallet/src/widgets/new_list_row/new_list_section.dart';
9 import 'package:flutter/material.dart';
10 import 'package:url_launcher/url_launcher.dart';
11
12 // written by people who happened to read my slack message in 2025
13 // whoever works on this codebase in the future, feel free to add your own mark here
14 const List<String> aboutPageEasterEggs = [
15 "Designed in (S)pain",
16 "Proudly managing over 🤷‍♂️ XMR",
17 "The cake is not a lie 🍰",
18 "I don’t play soccer because I enjoy the sport. I’m just doing it for kicks.",
19 "Markets in red? Big deal.\nWhat color is the grass outside?",
20 "Conquered Web3, now working on Web6-7",
21 "Proud owner of none of your funds\n(we are not impressed)",
22 "*writing down my seedphrase*\ncake cake cake cake cake cake cake ca...",
23 "Don't forget to actually use your crypto to pay for stuff in the real world 🙂",
24 "A chain of blocks? That's preposterous!",
25 "IOU a hug <3",
26 "Warning: up to 4.8% programmed by cats",
27 "We love collecting your data <3\nWe're just really incompetent at it"
28 ];
29
30 class AboutPage extends StatefulWidget {
31 const AboutPage({super.key, required this.appVersion});
32
33 final String appVersion;
34
35 @override
36 State<AboutPage> createState() => _AboutPageState();
37 }
38
39 class _AboutPageState extends State<AboutPage> {
40 static const int easterEggTreshold = 5;
41 String _bottomText = S.current.payment_made_easy;
42 int _easterEggCounter = 0;
43
44 void _easterEgg() {
45 _easterEggCounter++;
46 if (_easterEggCounter == easterEggTreshold) {
47 setState(() {
48 _bottomText = aboutPageEasterEggs.elementAt(Random().nextInt(aboutPageEasterEggs.length));
49 });
50 }
51 }
52
53 @override
54 Widget build(BuildContext context) {
55 return ModalPageWrapper(
56 topBar: ModalTopBar(
57 title: S.of(context).about,
58 leadingIcon: Icon(Icons.arrow_back_ios_new),
59 leadingSemanticLabel: S.of(context).seed_alert_back,
60 onLeadingPressed: Navigator.of(context).pop,
61 ),
62 content: Container(
63 color: Theme.of(context).colorScheme.surface,
64 child: Column(children: [
65 Column(
66 children: [
67 Column(
68 spacing: 16,
69 children: [
70 SizedBox(),
71 GestureDetector(
72 onTap: _easterEgg,
73 child: CakeImageWidget(
74 imageUrl: "assets/new-ui/cake_squircle_icon.svg",
75 width: 128,
76 height: 128,
77 ),
78 ),
79 Row(
80 mainAxisAlignment: MainAxisAlignment.center,
81 spacing: 8,
82 children: [
83 Text(
84 "Cake Wallet",
85 style: TextStyle(fontSize: 32, fontWeight: FontWeight.w500),
86 ),
87 Text(widget.appVersion,
88 style: TextStyle(
89 fontSize: 32,
90 fontWeight: FontWeight.w500,
91 color: Theme.of(context).colorScheme.onSurfaceVariant))
92 ],
93 ),
94 Padding(
95 padding: const EdgeInsets.symmetric(horizontal: 12.0),
96 child: Wrap(
97 children: [
98 Text(
99 _bottomText,
100 textAlign: TextAlign.center,
101 style: TextStyle(color: Theme.of(context).colorScheme.onSurfaceVariant),
102 ),
103 ],
104 ),
105 ),
106 ],
107 ),
108 SizedBox(height: 32),
109 NewListSections(sections: {
110 "": [
111 ListItemRegularRow(
112 keyValue: "official website",
113 label: "Official Website",
114 onTap: () => launchUrl(Uri.https("cakewallet.com")),
115 trailingIconPath: "assets/new-ui/link_arrow.svg",
116 foregroundColor: Theme.of(context).colorScheme.primary,
117 trailingIconSize: 10),
118 ListItemRegularRow(
119 keyValue: "docs",
120 label: "Cake Docs",
121 onTap: () => launchUrl(Uri.https("docs.cakewallet.com")),
122 trailingIconPath: "assets/new-ui/link_arrow.svg",
123 foregroundColor: Theme.of(context).colorScheme.primary,
124 trailingIconSize: 10)
125 ],
126 "2": [
127 ListItemRegularRow(
128 keyValue: "gh",
129 label: "GitHub",
130 onTap: () => launchUrl(Uri.https("github.com", "cake-tech")),
131 trailingIconPath: "assets/new-ui/link_arrow.svg",
132 foregroundColor: Theme.of(context).colorScheme.primary,
133 trailingIconSize: 10),
134 ListItemRegularRow(
135 keyValue: "twitter",
136 label: "X (Twitter)",
137 onTap: () => launchUrl(Uri.https("twitter.com", "cakewallet")),
138 trailingIconPath: "assets/new-ui/link_arrow.svg",
139 foregroundColor: Theme.of(context).colorScheme.primary,
140 trailingIconSize: 10),
141 ListItemRegularRow(
142 keyValue: "tg",
143 label: "Telegram",
144 onTap: () => launchUrl(Uri.https("t.me", "cakewallet")),
145 trailingIconPath: "assets/new-ui/link_arrow.svg",
146 foregroundColor: Theme.of(context).colorScheme.primary,
147 trailingIconSize: 10)
148 ]
149 })
150 ],
151 )
152 ])),
153 );
154 }
155 }