mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-28 06:28:41 +01:00
* Give ModernButton and CoinActionButton one labeled a11y node ModernButton, CoinActionButton and the ModalTopBar chrome buttons were icon-only IconButtons with no tooltip and a detached caption sibling, so screen readers announced an unnamed "button" plus unrelated static text. - Add optional semanticLabel to ModernButton; wrap the control in MergeSemantics + Semantics(button: true, label: semanticLabel ?? label) and exclude both the icon and the visible caption so exactly one node is exposed. No visual or pointer change. - Give CoinActionButton the same treatment, reusing the label callers already pass (dashboard Send / Receive / Swap / Scan). - Add leadingSemanticLabel / trailingSemanticLabel to ModalTopBar, defaulting the leading button to "Close", and mark a non-empty title as a semantics header. - Migrate every ModernButton / ModalTopBar call site to pass a localized label, and drop the now-redundant external Semantics wrapper in base_page.dart so the back button is not labeled twice. - Localize the hard-coded "Settings" modal title in settings_page.dart. New English keys: rotate_address, swap_reverse_direction, switch_camera, switch_input_currency, test_node_speeds, turn_flash_off, turn_flash_on. * Require explicit accessible names on ModalTopBar and ModernButton icons ModalTopBar defaulted every leading icon's accessible name to "Close", so the ~40 callers that pass a back arrow announced the wrong action, and trailingSemanticLabel was optional, leaving the trailing icon controls unnamed. - Drop the "?? close" fallback in ModalTopBar: the leading ModernButton now gets exactly leadingSemanticLabel, and constructor asserts require a non-empty label whenever leadingIcon / trailingIcon is supplied. Callers that pass leadingWidget / trailingWidget instead are unaffected, and a null icon still builds no button at all. - Assert in both ModernButton constructors that the control has a name: either semanticLabel or a non-empty visible label. - Pass the matching localized label at every ModalTopBar call site: "Go back" for back arrows, "Close" for close icons, and the action name for trailing icons (History, Configure, Export CSV, Save, Scan, Close). - Label the last unnamed ModernButton (wallet accounts, wallet_info.dart). No new localization keys; all labels reuse existing strings_en.arb keys. * fix(a11y): put ModalTopBar header flag on the title Text node On-device audit (CW-1574, defect D2) found zero [heading] nodes in the Android accessibility tree on the Receive page: Semantics(header:) wrapped the AnimatedSwitcher rather than the Text inside it, so the flag never landed on the node that carries the title label. Move the header semantics inside the AnimatedSwitcher, directly around the Text. The ValueKey(title) moves with it onto the Semantics wrapper, since AnimatedSwitcher switches on its direct child's key -- keying the Semantics by title preserves the existing switch/animation behavior exactly. No test or robot resolves the title ValueKey through a Text-typed finder, so the key relocation is not observable from the test suites on this branch. * Set headingLevel so Android surfaces modal titles as headings The Flutter 3.41 engine drives AccessibilityNodeInfo.setHeading from headingLevel, not the IS_HEADER flag (which 3.35 used). Proven by an on-device probe: header:-only headings print on a 3.35-engine build and vanish on the 3.41-engine CI build.
156 lines
6.4 KiB
Dart
156 lines
6.4 KiB
Dart
import 'dart:math';
|
||
|
||
import 'package:cake_wallet/entities/new_ui_entities/list_item/list_item_regular_row.dart';
|
||
import 'package:cake_wallet/generated/i18n.dart';
|
||
import 'package:cake_wallet/new-ui/widgets/modal_page_wrapper.dart';
|
||
import 'package:cake_wallet/new-ui/widgets/receive_page/receive_top_bar.dart';
|
||
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
|
||
import 'package:cake_wallet/src/widgets/new_list_row/new_list_section.dart';
|
||
import 'package:flutter/material.dart';
|
||
import 'package:url_launcher/url_launcher.dart';
|
||
|
||
// written by people who happened to read my slack message in 2025
|
||
// whoever works on this codebase in the future, feel free to add your own mark here
|
||
const List<String> aboutPageEasterEggs = [
|
||
"Designed in (S)pain",
|
||
"Proudly managing over 🤷♂️ XMR",
|
||
"The cake is not a lie 🍰",
|
||
"I don’t play soccer because I enjoy the sport. I’m just doing it for kicks.",
|
||
"Markets in red? Big deal.\nWhat color is the grass outside?",
|
||
"Conquered Web3, now working on Web6-7",
|
||
"Proud owner of none of your funds\n(we are not impressed)",
|
||
"*writing down my seedphrase*\ncake cake cake cake cake cake cake ca...",
|
||
"Don't forget to actually use your crypto to pay for stuff in the real world 🙂",
|
||
"A chain of blocks? That's preposterous!",
|
||
"IOU a hug <3",
|
||
"Warning: up to 4.8% programmed by cats",
|
||
"We love collecting your data <3\nWe're just really incompetent at it"
|
||
];
|
||
|
||
class AboutPage extends StatefulWidget {
|
||
const AboutPage({super.key, required this.appVersion});
|
||
|
||
final String appVersion;
|
||
|
||
@override
|
||
State<AboutPage> createState() => _AboutPageState();
|
||
}
|
||
|
||
class _AboutPageState extends State<AboutPage> {
|
||
static const int easterEggTreshold = 5;
|
||
String _bottomText = S.current.payment_made_easy;
|
||
int _easterEggCounter = 0;
|
||
|
||
void _easterEgg() {
|
||
_easterEggCounter++;
|
||
if (_easterEggCounter == easterEggTreshold) {
|
||
setState(() {
|
||
_bottomText = aboutPageEasterEggs.elementAt(Random().nextInt(aboutPageEasterEggs.length));
|
||
});
|
||
}
|
||
}
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return ModalPageWrapper(
|
||
topBar: ModalTopBar(
|
||
title: S.of(context).about,
|
||
leadingIcon: Icon(Icons.arrow_back_ios_new),
|
||
leadingSemanticLabel: S.of(context).seed_alert_back,
|
||
onLeadingPressed: Navigator.of(context).pop,
|
||
),
|
||
content: Container(
|
||
color: Theme.of(context).colorScheme.surface,
|
||
child: Column(children: [
|
||
Column(
|
||
children: [
|
||
Column(
|
||
spacing: 16,
|
||
children: [
|
||
SizedBox(),
|
||
GestureDetector(
|
||
onTap: _easterEgg,
|
||
child: CakeImageWidget(
|
||
imageUrl: "assets/new-ui/cake_squircle_icon.svg",
|
||
width: 128,
|
||
height: 128,
|
||
),
|
||
),
|
||
Row(
|
||
mainAxisAlignment: MainAxisAlignment.center,
|
||
spacing: 8,
|
||
children: [
|
||
Text(
|
||
"Cake Wallet",
|
||
style: TextStyle(fontSize: 32, fontWeight: FontWeight.w500),
|
||
),
|
||
Text(widget.appVersion,
|
||
style: TextStyle(
|
||
fontSize: 32,
|
||
fontWeight: FontWeight.w500,
|
||
color: Theme.of(context).colorScheme.onSurfaceVariant))
|
||
],
|
||
),
|
||
Padding(
|
||
padding: const EdgeInsets.symmetric(horizontal: 12.0),
|
||
child: Wrap(
|
||
children: [
|
||
Text(
|
||
_bottomText,
|
||
textAlign: TextAlign.center,
|
||
style: TextStyle(color: Theme.of(context).colorScheme.onSurfaceVariant),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
],
|
||
),
|
||
SizedBox(height: 32),
|
||
NewListSections(sections: {
|
||
"": [
|
||
ListItemRegularRow(
|
||
keyValue: "official website",
|
||
label: "Official Website",
|
||
onTap: () => launchUrl(Uri.https("cakewallet.com")),
|
||
trailingIconPath: "assets/new-ui/link_arrow.svg",
|
||
foregroundColor: Theme.of(context).colorScheme.primary,
|
||
trailingIconSize: 10),
|
||
ListItemRegularRow(
|
||
keyValue: "docs",
|
||
label: "Cake Docs",
|
||
onTap: () => launchUrl(Uri.https("docs.cakewallet.com")),
|
||
trailingIconPath: "assets/new-ui/link_arrow.svg",
|
||
foregroundColor: Theme.of(context).colorScheme.primary,
|
||
trailingIconSize: 10)
|
||
],
|
||
"2": [
|
||
ListItemRegularRow(
|
||
keyValue: "gh",
|
||
label: "GitHub",
|
||
onTap: () => launchUrl(Uri.https("github.com", "cake-tech")),
|
||
trailingIconPath: "assets/new-ui/link_arrow.svg",
|
||
foregroundColor: Theme.of(context).colorScheme.primary,
|
||
trailingIconSize: 10),
|
||
ListItemRegularRow(
|
||
keyValue: "twitter",
|
||
label: "X (Twitter)",
|
||
onTap: () => launchUrl(Uri.https("twitter.com", "cakewallet")),
|
||
trailingIconPath: "assets/new-ui/link_arrow.svg",
|
||
foregroundColor: Theme.of(context).colorScheme.primary,
|
||
trailingIconSize: 10),
|
||
ListItemRegularRow(
|
||
keyValue: "tg",
|
||
label: "Telegram",
|
||
onTap: () => launchUrl(Uri.https("t.me", "cakewallet")),
|
||
trailingIconPath: "assets/new-ui/link_arrow.svg",
|
||
foregroundColor: Theme.of(context).colorScheme.primary,
|
||
trailingIconSize: 10)
|
||
]
|
||
})
|
||
],
|
||
)
|
||
])),
|
||
);
|
||
}
|
||
}
|