Merge pull request #505 from detherminal/staging

feat: wrap with semantic widget for talkback
This commit is contained in:
julian-CStack 2023-05-02 16:44:25 -06:00 committed by GitHub
commit 2dc510b6c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 251 additions and 185 deletions

View file

@ -333,6 +333,9 @@ class _AddWalletViewState extends ConsumerState<AddWalletView> {
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius, Constants.size.circularBorderRadius,
), ),
child: Semantics(
label: "Search Text Field. Inputs Text To Search In Wallets.",
excludeSemantics: true,
child: TextField( child: TextField(
autofocus: isDesktop, autofocus: isDesktop,
autocorrect: !isDesktop, autocorrect: !isDesktop,
@ -380,6 +383,7 @@ class _AddWalletViewState extends ConsumerState<AddWalletView> {
: null, : null,
), ),
), ),
)
), ),
const SizedBox( const SizedBox(
height: 10, height: 10,

View file

@ -238,14 +238,22 @@ class _NameYourWalletViewState extends ConsumerState<NameYourWalletView> {
TextFieldIconButton( TextFieldIconButton(
key: const Key("genRandomWalletNameButtonKey"), key: const Key("genRandomWalletNameButtonKey"),
child: _showDiceIcon child: _showDiceIcon
? DiceIcon( ? Semantics(
label: "Generate Random Wallet Name Button. Generates A Random Name For Wallet.",
excludeSemantics: true,
child: DiceIcon(
width: isDesktop ? 20 : 17, width: isDesktop ? 20 : 17,
height: isDesktop ? 20 : 17, height: isDesktop ? 20 : 17,
),
) )
: XIcon( : Semantics(
label: "Generate Random Wallet Name Button. Generates A Random Name For Wallet.",
excludeSemantics: true,
child: XIcon(
width: isDesktop ? 21 : 18, width: isDesktop ? 21 : 18,
height: isDesktop ? 21 : 18, height: isDesktop ? 21 : 18,
), ),
),
onTap: () async { onTap: () async {
if (_showDiceIcon) { if (_showDiceIcon) {
textEditingController.text = textEditingController.text =

View file

@ -140,6 +140,7 @@ class _NewWalletRecoveryPhraseViewState
child: AspectRatio( child: AspectRatio(
aspectRatio: 1, aspectRatio: 1,
child: AppBarIconButton( child: AppBarIconButton(
semanticsLabel: "Copy Button. Copies The Recovery Phrase To Clipboard.",
color: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.background, .background,

View file

@ -87,6 +87,7 @@ class _NewWalletRecoveryPhraseWarningViewState
right: 10, right: 10,
), ),
child: AppBarIconButton( child: AppBarIconButton(
semanticsLabel: "Question Button. Opens A Dialog For Recovery Phrase Explanation.",
icon: SvgPicture.asset( icon: SvgPicture.asset(
Assets.svg.circleQuestion, Assets.svg.circleQuestion,
width: 20, width: 20,

View file

@ -636,6 +636,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
child: AspectRatio( child: AspectRatio(
aspectRatio: 1, aspectRatio: 1,
child: AppBarIconButton( child: AppBarIconButton(
semanticsLabel: "View QR Code Button. Opens Camera To Scan QR Code For Restoring Wallet.",
key: const Key("restoreWalletViewQrCodeButton"), key: const Key("restoreWalletViewQrCodeButton"),
size: 36, size: 36,
shadows: const [], shadows: const [],
@ -662,6 +663,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
child: AspectRatio( child: AspectRatio(
aspectRatio: 1, aspectRatio: 1,
child: AppBarIconButton( child: AppBarIconButton(
semanticsLabel: "Paste Button. Pastes From Clipboard For Restoring Wallet.",
key: const Key("restoreWalletPasteButton"), key: const Key("restoreWalletPasteButton"),
size: 36, size: 36,
shadows: const [], shadows: const [],

View file

@ -781,6 +781,9 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
cursor: SystemMouseCursors.click, cursor: SystemMouseCursors.click,
child: child, child: child,
), ),
child: Semantics(
label: "Swap Button. Reverse The Exchange Currencies.",
excludeSemantics: true,
child: RoundedContainer( child: RoundedContainer(
padding: isDesktop padding: isDesktop
? const EdgeInsets.all(6) ? const EdgeInsets.all(6)
@ -806,6 +809,7 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
), ),
), ),
), ),
)
), ),
], ],
), ),

View file

@ -191,6 +191,7 @@ class _HomeViewState extends ConsumerState<HomeView> {
child: AspectRatio( child: AspectRatio(
aspectRatio: 1, aspectRatio: 1,
child: AppBarIconButton( child: AppBarIconButton(
semanticsLabel: "Notifications Button. Takes To Notifications Page.",
key: const Key("walletsViewAlertsButton"), key: const Key("walletsViewAlertsButton"),
size: 36, size: 36,
shadows: const [], shadows: const [],
@ -254,6 +255,7 @@ class _HomeViewState extends ConsumerState<HomeView> {
child: AspectRatio( child: AspectRatio(
aspectRatio: 1, aspectRatio: 1,
child: AppBarIconButton( child: AppBarIconButton(
semanticsLabel: "Settings Button. Takes To Settings Page.",
key: const Key("walletsViewSettingsButton"), key: const Key("walletsViewSettingsButton"),
size: 36, size: 36,
shadows: const [], shadows: const [],

View file

@ -39,6 +39,7 @@ class LockscreenView extends ConsumerStatefulWidget {
this.routeOnSuccessArguments, this.routeOnSuccessArguments,
this.biometrics = const Biometrics(), this.biometrics = const Biometrics(),
this.onSuccess, this.onSuccess,
this.customKeyLabel = "Button",
}) : super(key: key); }) : super(key: key);
static const String routeName = "/lockscreen"; static const String routeName = "/lockscreen";
@ -53,6 +54,8 @@ class LockscreenView extends ConsumerStatefulWidget {
final String biometricsCancelButtonString; final String biometricsCancelButtonString;
final Biometrics biometrics; final Biometrics biometrics;
final VoidCallback? onSuccess; final VoidCallback? onSuccess;
final String customKeyLabel;
@override @override
ConsumerState<LockscreenView> createState() => _LockscreenViewState(); ConsumerState<LockscreenView> createState() => _LockscreenViewState();
@ -245,6 +248,10 @@ class _LockscreenViewState extends ConsumerState<LockscreenView> {
), ),
CustomPinPut( CustomPinPut(
customKey: CustomKey( customKey: CustomKey(
semanticsLabel: Platform.isIOS
? "Face ID Button. Checks Face ID."
: "Fingerprint Button. Checks Fingerprint."
,
onPressed: _checkUseBiometrics, onPressed: _checkUseBiometrics,
iconAssetName: Platform.isIOS iconAssetName: Platform.isIOS
? Assets.svg.faceId ? Assets.svg.faceId

View file

@ -143,6 +143,7 @@ class _ReceiveViewState extends ConsumerState<ReceiveView> {
child: AspectRatio( child: AspectRatio(
aspectRatio: 1, aspectRatio: 1,
child: AppBarIconButton( child: AppBarIconButton(
semanticsLabel: "Address List Pop-up Button. Opens A Pop-up For Adress List Button.",
key: const Key("walletNetworkSettingsAddNewNodeViewButton"), key: const Key("walletNetworkSettingsAddNewNodeViewButton"),
size: 36, size: 36,
shadows: const [], shadows: const [],

View file

@ -981,6 +981,7 @@ class _SendViewState extends ConsumerState<SendView> {
children: [ children: [
_addressToggleFlag _addressToggleFlag
? TextFieldIconButton( ? TextFieldIconButton(
semanticsLabel: "Clear Button. Clears The Address Field Input.",
key: const Key( key: const Key(
"sendViewClearAddressFieldButtonKey"), "sendViewClearAddressFieldButtonKey"),
onTap: () { onTap: () {
@ -997,6 +998,7 @@ class _SendViewState extends ConsumerState<SendView> {
child: const XIcon(), child: const XIcon(),
) )
: TextFieldIconButton( : TextFieldIconButton(
semanticsLabel: "Paste Button. Pastes From Clipboard To Address Field Input.",
key: const Key( key: const Key(
"sendViewPasteAddressFieldButtonKey"), "sendViewPasteAddressFieldButtonKey"),
onTap: () async { onTap: () async {
@ -1046,6 +1048,7 @@ class _SendViewState extends ConsumerState<SendView> {
), ),
if (sendToController.text.isEmpty) if (sendToController.text.isEmpty)
TextFieldIconButton( TextFieldIconButton(
semanticsLabel: "Address Book Button. Opens Address Book For Address Field.",
key: const Key( key: const Key(
"sendViewAddressBookButtonKey"), "sendViewAddressBookButtonKey"),
onTap: () { onTap: () {
@ -1058,6 +1061,7 @@ class _SendViewState extends ConsumerState<SendView> {
), ),
if (sendToController.text.isEmpty) if (sendToController.text.isEmpty)
TextFieldIconButton( TextFieldIconButton(
semanticsLabel: "Scan QR Button. Opens Camera For Scanning QR Code.",
key: const Key( key: const Key(
"sendViewScanQrButtonKey"), "sendViewScanQrButtonKey"),
onTap: () async { onTap: () async {

View file

@ -99,6 +99,9 @@ class _RefreshButtonState extends ConsumerState<WalletRefreshButton> {
return SizedBox( return SizedBox(
height: isDesktop ? 22 : 36, height: isDesktop ? 22 : 36,
width: isDesktop ? 22 : 36, width: isDesktop ? 22 : 36,
child: Semantics(
label: "Refresh Button. Refreshes The Values In Summary.",
excludeSemantics: true,
child: MaterialButton( child: MaterialButton(
color: isDesktop color: isDesktop
? Theme.of(context).extension<StackColors>()!.buttonBackSecondary ? Theme.of(context).extension<StackColors>()!.buttonBackSecondary
@ -149,6 +152,7 @@ class _RefreshButtonState extends ConsumerState<WalletRefreshButton> {
.textFavoriteCard, .textFavoriteCard,
), ),
), ),
)
); );
} }
} }

View file

@ -473,6 +473,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
child: AspectRatio( child: AspectRatio(
aspectRatio: 1, aspectRatio: 1,
child: AppBarIconButton( child: AppBarIconButton(
semanticsLabel: "Network Button. Takes To Network Status Page.",
key: const Key("walletViewRadioButton"), key: const Key("walletViewRadioButton"),
size: 36, size: 36,
shadows: const [], shadows: const [],
@ -502,6 +503,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
child: AspectRatio( child: AspectRatio(
aspectRatio: 1, aspectRatio: 1,
child: AppBarIconButton( child: AppBarIconButton(
semanticsLabel: "Notifications Button. Takes To Notifications Page.",
key: const Key("walletViewAlertsButton"), key: const Key("walletViewAlertsButton"),
size: 36, size: 36,
shadows: const [], shadows: const [],
@ -569,6 +571,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
child: AspectRatio( child: AspectRatio(
aspectRatio: 1, aspectRatio: 1,
child: AppBarIconButton( child: AppBarIconButton(
semanticsLabel: "Settings Button. Takes To Wallet Settings Page.",
key: const Key("walletViewSettingsButton"), key: const Key("walletViewSettingsButton"),
size: 36, size: 36,
shadows: const [], shadows: const [],

View file

@ -13,6 +13,7 @@ class AppBarIconButton extends StatelessWidget {
// this.circularBorderRadius = 10.0, // this.circularBorderRadius = 10.0,
this.size = 36.0, this.size = 36.0,
this.shadows = const [], this.shadows = const [],
this.semanticsLabel = "Button",
}) : super(key: key); }) : super(key: key);
final Widget icon; final Widget icon;
@ -21,6 +22,7 @@ class AppBarIconButton extends StatelessWidget {
// final double circularBorderRadius; // final double circularBorderRadius;
final double size; final double size;
final List<BoxShadow> shadows; final List<BoxShadow> shadows;
final String semanticsLabel;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -32,6 +34,9 @@ class AppBarIconButton extends StatelessWidget {
color: color ?? Theme.of(context).extension<StackColors>()!.background, color: color ?? Theme.of(context).extension<StackColors>()!.background,
boxShadow: shadows, boxShadow: shadows,
), ),
child: Semantics(
excludeSemantics: true,
label: semanticsLabel,
child: MaterialButton( child: MaterialButton(
splashColor: Theme.of(context).extension<StackColors>()!.highlight, splashColor: Theme.of(context).extension<StackColors>()!.highlight,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
@ -42,6 +47,7 @@ class AppBarIconButton extends StatelessWidget {
onPressed: onPressed, onPressed: onPressed,
child: icon, child: icon,
), ),
)
); );
} }
} }
@ -53,12 +59,14 @@ class AppBarBackButton extends StatelessWidget {
this.isCompact = false, this.isCompact = false,
this.size, this.size,
this.iconSize, this.iconSize,
this.semanticsLabel = "Back Button. Takes Back To Previous Page.",
}) : super(key: key); }) : super(key: key);
final VoidCallback? onPressed; final VoidCallback? onPressed;
final bool isCompact; final bool isCompact;
final double? size; final double? size;
final double? iconSize; final double? iconSize;
final String semanticsLabel;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -71,6 +79,7 @@ class AppBarBackButton extends StatelessWidget {
) )
: const EdgeInsets.all(10), : const EdgeInsets.all(10),
child: AppBarIconButton( child: AppBarIconButton(
semanticsLabel: semanticsLabel,
size: size ?? size: size ??
(isDesktop (isDesktop
? isCompact ? isCompact
@ -88,7 +97,7 @@ class AppBarBackButton extends StatelessWidget {
color: Theme.of(context).extension<StackColors>()!.topNavIconPrimary, color: Theme.of(context).extension<StackColors>()!.topNavIconPrimary,
), ),
onPressed: onPressed ?? Navigator.of(context).pop, onPressed: onPressed ?? Navigator.of(context).pop,
), )
); );
} }
} }

View file

@ -140,6 +140,9 @@ class _BackspaceKeyState extends State<BackspaceKey> {
} }
}); });
}, },
child: Semantics(
label: "Backspace Button. Deletes The Last Digit.",
excludeSemantics: true,
child: Center( child: Center(
child: SvgPicture.asset( child: SvgPicture.asset(
Assets.svg.delete, Assets.svg.delete,
@ -149,6 +152,7 @@ class _BackspaceKeyState extends State<BackspaceKey> {
Theme.of(context).extension<StackColors>()!.numpadTextDefault, Theme.of(context).extension<StackColors>()!.numpadTextDefault,
), ),
), ),
)
), ),
); );
} }
@ -198,10 +202,12 @@ class CustomKey extends StatelessWidget {
Key? key, Key? key,
required this.onPressed, required this.onPressed,
this.iconAssetName, this.iconAssetName,
this.semanticsLabel = "Button",
}) : super(key: key); }) : super(key: key);
final VoidCallback onPressed; final VoidCallback onPressed;
final String? iconAssetName; final String? iconAssetName;
final String semanticsLabel;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -213,6 +219,9 @@ class CustomKey extends StatelessWidget {
color: Theme.of(context).extension<StackColors>()!.numpadBackDefault, color: Theme.of(context).extension<StackColors>()!.numpadBackDefault,
shadows: const [], shadows: const [],
), ),
child: Semantics(
label: semanticsLabel,
excludeSemantics: true,
child: MaterialButton( child: MaterialButton(
// splashColor: Theme.of(context).extension<StackColors>()!.highlight, // splashColor: Theme.of(context).extension<StackColors>()!.highlight,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
@ -233,6 +242,7 @@ class CustomKey extends StatelessWidget {
), ),
), ),
), ),
)
); );
} }
} }

View file

@ -8,6 +8,7 @@ class TextFieldIconButton extends StatefulWidget {
this.onTap, this.onTap,
required this.child, required this.child,
this.color = Colors.transparent, this.color = Colors.transparent,
this.semanticsLabel = "Button",
}) : super(key: key); }) : super(key: key);
final double width; final double width;
@ -15,6 +16,7 @@ class TextFieldIconButton extends StatefulWidget {
final VoidCallback? onTap; final VoidCallback? onTap;
final Widget child; final Widget child;
final Color color; final Color color;
final String semanticsLabel;
@override @override
State<TextFieldIconButton> createState() => _TextFieldIconButtonState(); State<TextFieldIconButton> createState() => _TextFieldIconButtonState();
@ -36,6 +38,9 @@ class _TextFieldIconButtonState extends State<TextFieldIconButton> {
width: widget.width, width: widget.width,
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(100), borderRadius: BorderRadius.circular(100),
child: Semantics(
label: widget.semanticsLabel,
excludeSemantics: true,
child: RawMaterialButton( child: RawMaterialButton(
constraints: BoxConstraints( constraints: BoxConstraints(
minWidth: widget.width, minWidth: widget.width,
@ -51,6 +56,7 @@ class _TextFieldIconButtonState extends State<TextFieldIconButton> {
), ),
), ),
), ),
)
), ),
); );
} }