From 6522d36c7bfd7f5c793513c629ee368ab2dc24b3 Mon Sep 17 00:00:00 2001 From: detherminal Date: Thu, 27 Apr 2023 21:14:04 +0300 Subject: [PATCH 1/3] feat: wrap with semantic widget for talkback --- .../add_wallet_view/add_wallet_view.dart | 92 ++++++++-------- .../name_your_wallet_view.dart | 18 +++- .../new_wallet_recovery_phrase_view.dart | 1 + ...w_wallet_recovery_phrase_warning_view.dart | 1 + .../restore_wallet_view.dart | 2 + lib/pages/exchange_view/exchange_form.dart | 48 +++++---- lib/pages/home_view/home_view.dart | 2 + lib/pages/pinpad_views/lock_screen_view.dart | 7 ++ lib/pages/receive_view/receive_view.dart | 1 + lib/pages/send_view/send_view.dart | 4 + .../sub_widgets/wallet_refresh_button.dart | 102 +++++++++--------- lib/pages/wallet_view/wallet_view.dart | 3 + .../custom_buttons/app_bar_icon_button.dart | 63 ++++++----- lib/widgets/custom_pin_put/pin_keyboard.dart | 64 ++++++----- lib/widgets/textfield_icon_button.dart | 32 +++--- 15 files changed, 253 insertions(+), 187 deletions(-) diff --git a/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart b/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart index 3f78bda33..5c8c800be 100644 --- a/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart +++ b/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart @@ -333,53 +333,57 @@ class _AddWalletViewState extends ConsumerState { borderRadius: BorderRadius.circular( Constants.size.circularBorderRadius, ), - child: TextField( - autofocus: isDesktop, - autocorrect: !isDesktop, - enableSuggestions: !isDesktop, - controller: _searchFieldController, - focusNode: _searchFocusNode, - onChanged: (value) => setState(() => _searchTerm = value), - style: STextStyles.field(context), - decoration: standardInputDecoration( - "Search", - _searchFocusNode, - context, - desktopMed: isDesktop, - ).copyWith( - prefixIcon: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 16, + child: Semantics( + label: "Search Text Field. Inputs Text To Search In Wallets.", + excludeSemantics: true, + child: TextField( + autofocus: isDesktop, + autocorrect: !isDesktop, + enableSuggestions: !isDesktop, + controller: _searchFieldController, + focusNode: _searchFocusNode, + onChanged: (value) => setState(() => _searchTerm = value), + style: STextStyles.field(context), + decoration: standardInputDecoration( + "Search", + _searchFocusNode, + context, + desktopMed: isDesktop, + ).copyWith( + prefixIcon: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 16, + ), + child: SvgPicture.asset( + Assets.svg.search, + width: 16, + height: 16, + ), ), - child: SvgPicture.asset( - Assets.svg.search, - width: 16, - height: 16, - ), - ), - suffixIcon: _searchFieldController.text.isNotEmpty - ? Padding( - padding: const EdgeInsets.only(right: 0), - child: UnconstrainedBox( - child: Row( - children: [ - TextFieldIconButton( - child: const XIcon(), - onTap: () async { - setState(() { - _searchFieldController.text = ""; - _searchTerm = ""; - }); - }, - ), - ], + suffixIcon: _searchFieldController.text.isNotEmpty + ? Padding( + padding: const EdgeInsets.only(right: 0), + child: UnconstrainedBox( + child: Row( + children: [ + TextFieldIconButton( + child: const XIcon(), + onTap: () async { + setState(() { + _searchFieldController.text = ""; + _searchTerm = ""; + }); + }, ), - ), - ) - : null, + ], + ), + ), + ) + : null, + ), ), - ), + ) ), const SizedBox( height: 10, diff --git a/lib/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart b/lib/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart index 6a3f28318..805355071 100644 --- a/lib/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart +++ b/lib/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart @@ -238,14 +238,22 @@ class _NameYourWalletViewState extends ConsumerState { TextFieldIconButton( key: const Key("genRandomWalletNameButtonKey"), child: _showDiceIcon - ? DiceIcon( - width: isDesktop ? 20 : 17, - height: isDesktop ? 20 : 17, - ) - : XIcon( + ? Semantics( + label: "Generate Random Wallet Name Button. Generates A Random Name For Wallet.", + excludeSemantics: true, + child: DiceIcon( + width: isDesktop ? 20 : 17, + height: isDesktop ? 20 : 17, + ), + ) + : Semantics( + label: "Generate Random Wallet Name Button. Generates A Random Name For Wallet.", + excludeSemantics: true, + child: XIcon( width: isDesktop ? 21 : 18, height: isDesktop ? 21 : 18, ), + ), onTap: () async { if (_showDiceIcon) { textEditingController.text = diff --git a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/new_wallet_recovery_phrase_view.dart b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/new_wallet_recovery_phrase_view.dart index 0b358753d..f6a3c74a2 100644 --- a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/new_wallet_recovery_phrase_view.dart +++ b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/new_wallet_recovery_phrase_view.dart @@ -140,6 +140,7 @@ class _NewWalletRecoveryPhraseViewState child: AspectRatio( aspectRatio: 1, child: AppBarIconButton( + label: "Copy Button. Copies The Recovery Phrase To Clipboard.", color: Theme.of(context) .extension()! .background, diff --git a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart index 262d882d4..85e1c1063 100644 --- a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart +++ b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart @@ -87,6 +87,7 @@ class _NewWalletRecoveryPhraseWarningViewState right: 10, ), child: AppBarIconButton( + label: "Question Button. Openes A Dialog For Recovery Phrase Explanation.", icon: SvgPicture.asset( Assets.svg.circleQuestion, width: 20, diff --git a/lib/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart b/lib/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart index ec0d5bc2c..ca3a4f394 100644 --- a/lib/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart +++ b/lib/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart @@ -636,6 +636,7 @@ class _RestoreWalletViewState extends ConsumerState { child: AspectRatio( aspectRatio: 1, child: AppBarIconButton( + label: "View QR Code Button. Opens Camera To Scan QR Code For Restoring Wallet.", key: const Key("restoreWalletViewQrCodeButton"), size: 36, shadows: const [], @@ -662,6 +663,7 @@ class _RestoreWalletViewState extends ConsumerState { child: AspectRatio( aspectRatio: 1, child: AppBarIconButton( + label: "Paste Button. Pastes From Clipboard For Restoring Wallet.", key: const Key("restoreWalletPasteButton"), size: 36, shadows: const [], diff --git a/lib/pages/exchange_view/exchange_form.dart b/lib/pages/exchange_view/exchange_form.dart index 11b4f4e51..389bedd05 100644 --- a/lib/pages/exchange_view/exchange_form.dart +++ b/lib/pages/exchange_view/exchange_form.dart @@ -781,31 +781,35 @@ class _ExchangeFormState extends ConsumerState { cursor: SystemMouseCursors.click, child: child, ), - child: RoundedContainer( - padding: isDesktop - ? const EdgeInsets.all(6) - : const EdgeInsets.all(2), - color: Theme.of(context) - .extension()! - .buttonBackSecondary, - radiusMultiplier: 0.75, - child: GestureDetector( - onTap: () async { - await _swap(); - }, - child: Padding( - padding: const EdgeInsets.all(4), - child: SvgPicture.asset( - Assets.svg.swap, - width: 20, - height: 20, - color: Theme.of(context) - .extension()! - .accentColorDark, + child: Semantics( + label: "Swap Button. Reverse The Exchange Currencies.", + excludeSemantics: true, + child: RoundedContainer( + padding: isDesktop + ? const EdgeInsets.all(6) + : const EdgeInsets.all(2), + color: Theme.of(context) + .extension()! + .buttonBackSecondary, + radiusMultiplier: 0.75, + child: GestureDetector( + onTap: () async { + await _swap(); + }, + child: Padding( + padding: const EdgeInsets.all(4), + child: SvgPicture.asset( + Assets.svg.swap, + width: 20, + height: 20, + color: Theme.of(context) + .extension()! + .accentColorDark, + ), ), ), ), - ), + ) ), ], ), diff --git a/lib/pages/home_view/home_view.dart b/lib/pages/home_view/home_view.dart index ea9b29558..e9c839452 100644 --- a/lib/pages/home_view/home_view.dart +++ b/lib/pages/home_view/home_view.dart @@ -191,6 +191,7 @@ class _HomeViewState extends ConsumerState { child: AspectRatio( aspectRatio: 1, child: AppBarIconButton( + label: "Notifications Button. Takes To Notifications Page.", key: const Key("walletsViewAlertsButton"), size: 36, shadows: const [], @@ -254,6 +255,7 @@ class _HomeViewState extends ConsumerState { child: AspectRatio( aspectRatio: 1, child: AppBarIconButton( + label: "Settings Button. Takes To Settings Page.", key: const Key("walletsViewSettingsButton"), size: 36, shadows: const [], diff --git a/lib/pages/pinpad_views/lock_screen_view.dart b/lib/pages/pinpad_views/lock_screen_view.dart index 7e9f9b77f..f99f3ddfc 100644 --- a/lib/pages/pinpad_views/lock_screen_view.dart +++ b/lib/pages/pinpad_views/lock_screen_view.dart @@ -39,6 +39,7 @@ class LockscreenView extends ConsumerStatefulWidget { this.routeOnSuccessArguments, this.biometrics = const Biometrics(), this.onSuccess, + this.customKeyLabel = "Button", }) : super(key: key); static const String routeName = "/lockscreen"; @@ -53,6 +54,8 @@ class LockscreenView extends ConsumerStatefulWidget { final String biometricsCancelButtonString; final Biometrics biometrics; final VoidCallback? onSuccess; + final String customKeyLabel; + @override ConsumerState createState() => _LockscreenViewState(); @@ -245,6 +248,10 @@ class _LockscreenViewState extends ConsumerState { ), CustomPinPut( customKey: CustomKey( + customKeyLabel: Platform.isIOS + ? "Face ID Button. Checks Face ID." + : "Fingerprint Button. Checks Fingerprint." + , onPressed: _checkUseBiometrics, iconAssetName: Platform.isIOS ? Assets.svg.faceId diff --git a/lib/pages/receive_view/receive_view.dart b/lib/pages/receive_view/receive_view.dart index 87587aa46..e46badfd3 100644 --- a/lib/pages/receive_view/receive_view.dart +++ b/lib/pages/receive_view/receive_view.dart @@ -143,6 +143,7 @@ class _ReceiveViewState extends ConsumerState { child: AspectRatio( aspectRatio: 1, child: AppBarIconButton( + label: "Adress List Pop-up Button. Opens A Pop-up For Adress List Button.", key: const Key("walletNetworkSettingsAddNewNodeViewButton"), size: 36, shadows: const [], diff --git a/lib/pages/send_view/send_view.dart b/lib/pages/send_view/send_view.dart index 83c40943f..12896b87a 100644 --- a/lib/pages/send_view/send_view.dart +++ b/lib/pages/send_view/send_view.dart @@ -980,6 +980,7 @@ class _SendViewState extends ConsumerState { children: [ _addressToggleFlag ? TextFieldIconButton( + label: "Clear Button. Clears The Address Field Input.", key: const Key( "sendViewClearAddressFieldButtonKey"), onTap: () { @@ -996,6 +997,7 @@ class _SendViewState extends ConsumerState { child: const XIcon(), ) : TextFieldIconButton( + label: "Paste Button. Pastes From Clipboard To Address Field Input.", key: const Key( "sendViewPasteAddressFieldButtonKey"), onTap: () async { @@ -1045,6 +1047,7 @@ class _SendViewState extends ConsumerState { ), if (sendToController.text.isEmpty) TextFieldIconButton( + label: "Address Book Button. Opens Address Book For Address Field.", key: const Key( "sendViewAddressBookButtonKey"), onTap: () { @@ -1057,6 +1060,7 @@ class _SendViewState extends ConsumerState { ), if (sendToController.text.isEmpty) TextFieldIconButton( + label: "Scan QR Button. Opens Camera For Scanning QR Code.", key: const Key( "sendViewScanQrButtonKey"), onTap: () async { diff --git a/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart b/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart index ac82fc98c..b1541617c 100644 --- a/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart +++ b/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart @@ -117,58 +117,62 @@ class _RefreshButtonState extends ConsumerState return SizedBox( height: isDesktop ? 22 : 36, width: isDesktop ? 22 : 36, - child: MaterialButton( - color: isDesktop - ? Theme.of(context).extension()!.buttonBackSecondary - : null, - splashColor: Theme.of(context).extension()!.highlight, - onPressed: () { - if (widget.tokenContractAddress == null) { - final managerProvider = ref - .read(walletsChangeNotifierProvider) - .getManagerProvider(widget.walletId); - final isRefreshing = ref.read(managerProvider).isRefreshing; - if (!isRefreshing) { - _spinController?.repeat(); - ref - .read(managerProvider) - .refresh() - .then((_) => _spinController?.stop()); + child: Semantics( + label: "Refresh Button. Refreshes The Values In Page.", + excludeSemantics: true, + child: MaterialButton( + color: isDesktop + ? Theme.of(context).extension()!.buttonBackSecondary + : null, + splashColor: Theme.of(context).extension()!.highlight, + onPressed: () { + if (widget.tokenContractAddress == null) { + final managerProvider = ref + .read(walletsChangeNotifierProvider) + .getManagerProvider(widget.walletId); + final isRefreshing = ref.read(managerProvider).isRefreshing; + if (!isRefreshing) { + _spinController?.repeat(); + ref + .read(managerProvider) + .refresh() + .then((_) => _spinController?.stop()); + } + } else { + if (!ref.read(tokenServiceProvider)!.isRefreshing) { + ref.read(tokenServiceProvider)!.refresh(); + } } - } else { - if (!ref.read(tokenServiceProvider)!.isRefreshing) { - ref.read(tokenServiceProvider)!.refresh(); - } - } - }, - elevation: 0, - highlightElevation: 0, - hoverElevation: 0, - padding: EdgeInsets.zero, - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, + }, + elevation: 0, + highlightElevation: 0, + hoverElevation: 0, + padding: EdgeInsets.zero, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + ), + child: RotationTransition( + turns: _spinAnimation, + child: SvgPicture.asset( + Assets.svg.arrowRotate, + width: isDesktop ? 12 : 24, + height: isDesktop ? 12 : 24, + color: widget.overrideIconColor != null + ? widget.overrideIconColor! + : isDesktop + ? Theme.of(context) + .extension()! + .textFieldDefaultSearchIconRight + : Theme.of(context) + .extension()! + .textFavoriteCard, + ), ), ), - child: RotationTransition( - turns: _spinAnimation, - child: SvgPicture.asset( - Assets.svg.arrowRotate, - width: isDesktop ? 12 : 24, - height: isDesktop ? 12 : 24, - color: widget.overrideIconColor != null - ? widget.overrideIconColor! - : isDesktop - ? Theme.of(context) - .extension()! - .textFieldDefaultSearchIconRight - : Theme.of(context) - .extension()! - .textFavoriteCard, - ), - ), - ), + ) ); } } diff --git a/lib/pages/wallet_view/wallet_view.dart b/lib/pages/wallet_view/wallet_view.dart index 6e39edd9b..7d43acfbd 100644 --- a/lib/pages/wallet_view/wallet_view.dart +++ b/lib/pages/wallet_view/wallet_view.dart @@ -474,6 +474,7 @@ class _WalletViewState extends ConsumerState { child: AspectRatio( aspectRatio: 1, child: AppBarIconButton( + label: "Network Button. Takes To Network Status Page.", key: const Key("walletViewRadioButton"), size: 36, shadows: const [], @@ -503,6 +504,7 @@ class _WalletViewState extends ConsumerState { child: AspectRatio( aspectRatio: 1, child: AppBarIconButton( + label: "Notifications Button. Takes To Notifications Page.", key: const Key("walletViewAlertsButton"), size: 36, shadows: const [], @@ -570,6 +572,7 @@ class _WalletViewState extends ConsumerState { child: AspectRatio( aspectRatio: 1, child: AppBarIconButton( + label: "Settings Button. Takes To Wallet Settings Page.", key: const Key("walletViewSettingsButton"), size: 36, shadows: const [], diff --git a/lib/widgets/custom_buttons/app_bar_icon_button.dart b/lib/widgets/custom_buttons/app_bar_icon_button.dart index 9edc1ca5f..7c3980bb8 100644 --- a/lib/widgets/custom_buttons/app_bar_icon_button.dart +++ b/lib/widgets/custom_buttons/app_bar_icon_button.dart @@ -13,6 +13,7 @@ class AppBarIconButton extends StatelessWidget { // this.circularBorderRadius = 10.0, this.size = 36.0, this.shadows = const [], + this.label = "Button", }) : super(key: key); final Widget icon; @@ -21,6 +22,7 @@ class AppBarIconButton extends StatelessWidget { // final double circularBorderRadius; final double size; final List shadows; + final String label; @override Widget build(BuildContext context) { @@ -32,16 +34,20 @@ class AppBarIconButton extends StatelessWidget { color: color ?? Theme.of(context).extension()!.background, boxShadow: shadows, ), - child: MaterialButton( - splashColor: Theme.of(context).extension()!.highlight, - padding: EdgeInsets.zero, - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(1000), + child: Semantics( + excludeSemantics: true, + label: label, + child: MaterialButton( + splashColor: Theme.of(context).extension()!.highlight, + padding: EdgeInsets.zero, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(1000), + ), + onPressed: onPressed, + child: icon, ), - onPressed: onPressed, - child: icon, - ), + ) ); } } @@ -53,12 +59,14 @@ class AppBarBackButton extends StatelessWidget { this.isCompact = false, this.size, this.iconSize, + this.label = "Back Button. Takes Back To Previous Page.", }) : super(key: key); final VoidCallback? onPressed; final bool isCompact; final double? size; final double? iconSize; + final String label; @override Widget build(BuildContext context) { @@ -71,24 +79,25 @@ class AppBarBackButton extends StatelessWidget { ) : const EdgeInsets.all(10), child: AppBarIconButton( - size: size ?? - (isDesktop - ? isCompact - ? 42 - : 56 - : 32), - color: isDesktop - ? Theme.of(context).extension()!.textFieldDefaultBG - : Theme.of(context).extension()!.background, - shadows: const [], - icon: SvgPicture.asset( - Assets.svg.arrowLeft, - width: iconSize ?? (isCompact ? 18 : 24), - height: iconSize ?? (isCompact ? 18 : 24), - color: Theme.of(context).extension()!.topNavIconPrimary, - ), - onPressed: onPressed ?? Navigator.of(context).pop, - ), + label: label, + size: size ?? + (isDesktop + ? isCompact + ? 42 + : 56 + : 32), + color: isDesktop + ? Theme.of(context).extension()!.textFieldDefaultBG + : Theme.of(context).extension()!.background, + shadows: const [], + icon: SvgPicture.asset( + Assets.svg.arrowLeft, + width: iconSize ?? (isCompact ? 18 : 24), + height: iconSize ?? (isCompact ? 18 : 24), + color: Theme.of(context).extension()!.topNavIconPrimary, + ), + onPressed: onPressed ?? Navigator.of(context).pop, + ) ); } } diff --git a/lib/widgets/custom_pin_put/pin_keyboard.dart b/lib/widgets/custom_pin_put/pin_keyboard.dart index a578f9c17..86c5bddd3 100644 --- a/lib/widgets/custom_pin_put/pin_keyboard.dart +++ b/lib/widgets/custom_pin_put/pin_keyboard.dart @@ -139,15 +139,19 @@ class _BackspaceKeyState extends State { } }); }, - child: Center( - child: SvgPicture.asset( - Assets.svg.delete, - width: 20, - height: 20, - color: - Theme.of(context).extension()!.numpadTextDefault, + child: Semantics( + label: "Backspace Button. Deletes The Last Digit.", + excludeSemantics: true, + child: Center( + child: SvgPicture.asset( + Assets.svg.delete, + width: 20, + height: 20, + color: + Theme.of(context).extension()!.numpadTextDefault, + ), ), - ), + ) ), ); } @@ -197,10 +201,12 @@ class CustomKey extends StatelessWidget { Key? key, required this.onPressed, this.iconAssetName, + this.customKeyLabel = "Button", }) : super(key: key); final VoidCallback onPressed; final String? iconAssetName; + final String customKeyLabel; @override Widget build(BuildContext context) { @@ -212,26 +218,30 @@ class CustomKey extends StatelessWidget { color: Theme.of(context).extension()!.numpadBackDefault, shadows: const [], ), - child: MaterialButton( - // splashColor: Theme.of(context).extension()!.highlight, - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - shape: const StadiumBorder(), - onPressed: () { - onPressed.call(); - }, - child: Center( - child: iconAssetName == null - ? null - : SvgPicture.asset( - iconAssetName!, - width: 20, - height: 20, - color: Theme.of(context) - .extension()! - .numpadTextDefault, - ), + child: Semantics( + label: customKeyLabel, + excludeSemantics: true, + child: MaterialButton( + // splashColor: Theme.of(context).extension()!.highlight, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + shape: const StadiumBorder(), + onPressed: () { + onPressed.call(); + }, + child: Center( + child: iconAssetName == null + ? null + : SvgPicture.asset( + iconAssetName!, + width: 20, + height: 20, + color: Theme.of(context) + .extension()! + .numpadTextDefault, + ), + ), ), - ), + ) ); } } diff --git a/lib/widgets/textfield_icon_button.dart b/lib/widgets/textfield_icon_button.dart index 9375c6f31..9be08ef56 100644 --- a/lib/widgets/textfield_icon_button.dart +++ b/lib/widgets/textfield_icon_button.dart @@ -8,6 +8,7 @@ class TextFieldIconButton extends StatefulWidget { this.onTap, required this.child, this.color = Colors.transparent, + this.label = "Button", }) : super(key: key); final double width; @@ -15,6 +16,7 @@ class TextFieldIconButton extends StatefulWidget { final VoidCallback? onTap; final Widget child; final Color color; + final String label; @override State createState() => _TextFieldIconButtonState(); @@ -36,21 +38,25 @@ class _TextFieldIconButtonState extends State { width: widget.width, child: ClipRRect( borderRadius: BorderRadius.circular(100), - child: RawMaterialButton( - constraints: BoxConstraints( - minWidth: widget.width, - minHeight: widget.height, - ), - onPressed: onTap, - child: Container( - width: widget.width, - height: widget.height, - color: widget.color, - child: Center( - child: widget.child, + child: Semantics( + label: widget.label, + excludeSemantics: true, + child: RawMaterialButton( + constraints: BoxConstraints( + minWidth: widget.width, + minHeight: widget.height, + ), + onPressed: onTap, + child: Container( + width: widget.width, + height: widget.height, + color: widget.color, + child: Center( + child: widget.child, + ), ), ), - ), + ) ), ); } From 4c145e14128d62a5b9a4d34306c883d1d77668db Mon Sep 17 00:00:00 2001 From: detherminal <76167420+detherminal@users.noreply.github.com> Date: Thu, 27 Apr 2023 21:31:54 +0300 Subject: [PATCH 2/3] feat: wrap with semantic widget for talkback --- .../sub_widgets/wallet_refresh_button.dart | 98 ++++++++++--------- 1 file changed, 51 insertions(+), 47 deletions(-) diff --git a/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart b/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart index a4b6a34de..06985cd7c 100644 --- a/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart +++ b/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart @@ -99,56 +99,60 @@ class _RefreshButtonState extends ConsumerState { return SizedBox( height: isDesktop ? 22 : 36, width: isDesktop ? 22 : 36, - child: MaterialButton( - color: isDesktop - ? Theme.of(context).extension()!.buttonBackSecondary - : null, - splashColor: Theme.of(context).extension()!.highlight, - onPressed: () { - if (widget.tokenContractAddress == null) { - final managerProvider = ref - .read(walletsChangeNotifierProvider) - .getManagerProvider(widget.walletId); - final isRefreshing = ref.read(managerProvider).isRefreshing; - if (!isRefreshing) { - _spinController.repeat?.call(); - ref - .read(managerProvider) - .refresh() - .then((_) => _spinController.stop?.call()); + child: Semantics( + label: "Refresh Button. Refreshes The Values In Summary.", + excludeSemantics: true, + child: MaterialButton( + color: isDesktop + ? Theme.of(context).extension()!.buttonBackSecondary + : null, + splashColor: Theme.of(context).extension()!.highlight, + onPressed: () { + if (widget.tokenContractAddress == null) { + final managerProvider = ref + .read(walletsChangeNotifierProvider) + .getManagerProvider(widget.walletId); + final isRefreshing = ref.read(managerProvider).isRefreshing; + if (!isRefreshing) { + _spinController.repeat?.call(); + ref + .read(managerProvider) + .refresh() + .then((_) => _spinController.stop?.call()); + } + } else { + if (!ref.read(tokenServiceProvider)!.isRefreshing) { + ref.read(tokenServiceProvider)!.refresh(); + } } - } else { - if (!ref.read(tokenServiceProvider)!.isRefreshing) { - ref.read(tokenServiceProvider)!.refresh(); - } - } - }, - elevation: 0, - highlightElevation: 0, - hoverElevation: 0, - padding: EdgeInsets.zero, - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, + }, + elevation: 0, + highlightElevation: 0, + hoverElevation: 0, + padding: EdgeInsets.zero, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + ), + child: RotatingArrows( + spinByDefault: widget.initialSyncStatus == WalletSyncStatus.syncing, + width: isDesktop ? 12 : 24, + height: isDesktop ? 12 : 24, + controller: _spinController, + color: widget.overrideIconColor != null + ? widget.overrideIconColor! + : isDesktop + ? Theme.of(context) + .extension()! + .textFieldDefaultSearchIconRight + : Theme.of(context) + .extension()! + .textFavoriteCard, ), ), - child: RotatingArrows( - spinByDefault: widget.initialSyncStatus == WalletSyncStatus.syncing, - width: isDesktop ? 12 : 24, - height: isDesktop ? 12 : 24, - controller: _spinController, - color: widget.overrideIconColor != null - ? widget.overrideIconColor! - : isDesktop - ? Theme.of(context) - .extension()! - .textFieldDefaultSearchIconRight - : Theme.of(context) - .extension()! - .textFavoriteCard, - ), - ), + ) ); } } From cb8de25e08af9b638c3d872b6d0f99b3a6d9b5e9 Mon Sep 17 00:00:00 2001 From: detherminal <76167420+detherminal@users.noreply.github.com> Date: Fri, 28 Apr 2023 21:21:30 +0300 Subject: [PATCH 3/3] feat: rename label to semanticsLabel and correct misspelling --- .../new_wallet_recovery_phrase_view.dart | 2 +- .../new_wallet_recovery_phrase_warning_view.dart | 2 +- .../restore_wallet_view/restore_wallet_view.dart | 4 ++-- lib/pages/home_view/home_view.dart | 4 ++-- lib/pages/pinpad_views/lock_screen_view.dart | 2 +- lib/pages/receive_view/receive_view.dart | 2 +- lib/pages/send_view/send_view.dart | 8 ++++---- lib/pages/wallet_view/wallet_view.dart | 6 +++--- lib/widgets/custom_buttons/app_bar_icon_button.dart | 12 ++++++------ lib/widgets/custom_pin_put/pin_keyboard.dart | 6 +++--- lib/widgets/textfield_icon_button.dart | 6 +++--- 11 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/new_wallet_recovery_phrase_view.dart b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/new_wallet_recovery_phrase_view.dart index f6a3c74a2..5050324ba 100644 --- a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/new_wallet_recovery_phrase_view.dart +++ b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/new_wallet_recovery_phrase_view.dart @@ -140,7 +140,7 @@ class _NewWalletRecoveryPhraseViewState child: AspectRatio( aspectRatio: 1, child: AppBarIconButton( - label: "Copy Button. Copies The Recovery Phrase To Clipboard.", + semanticsLabel: "Copy Button. Copies The Recovery Phrase To Clipboard.", color: Theme.of(context) .extension()! .background, diff --git a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart index 85e1c1063..50c8bc1eb 100644 --- a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart +++ b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart @@ -87,7 +87,7 @@ class _NewWalletRecoveryPhraseWarningViewState right: 10, ), child: AppBarIconButton( - label: "Question Button. Openes A Dialog For Recovery Phrase Explanation.", + semanticsLabel: "Question Button. Opens A Dialog For Recovery Phrase Explanation.", icon: SvgPicture.asset( Assets.svg.circleQuestion, width: 20, diff --git a/lib/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart b/lib/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart index ca3a4f394..7c7ae4523 100644 --- a/lib/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart +++ b/lib/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart @@ -636,7 +636,7 @@ class _RestoreWalletViewState extends ConsumerState { child: AspectRatio( aspectRatio: 1, child: AppBarIconButton( - label: "View QR Code Button. Opens Camera To Scan QR Code For Restoring Wallet.", + semanticsLabel: "View QR Code Button. Opens Camera To Scan QR Code For Restoring Wallet.", key: const Key("restoreWalletViewQrCodeButton"), size: 36, shadows: const [], @@ -663,7 +663,7 @@ class _RestoreWalletViewState extends ConsumerState { child: AspectRatio( aspectRatio: 1, child: AppBarIconButton( - label: "Paste Button. Pastes From Clipboard For Restoring Wallet.", + semanticsLabel: "Paste Button. Pastes From Clipboard For Restoring Wallet.", key: const Key("restoreWalletPasteButton"), size: 36, shadows: const [], diff --git a/lib/pages/home_view/home_view.dart b/lib/pages/home_view/home_view.dart index e9c839452..9e8f7fde1 100644 --- a/lib/pages/home_view/home_view.dart +++ b/lib/pages/home_view/home_view.dart @@ -191,7 +191,7 @@ class _HomeViewState extends ConsumerState { child: AspectRatio( aspectRatio: 1, child: AppBarIconButton( - label: "Notifications Button. Takes To Notifications Page.", + semanticsLabel: "Notifications Button. Takes To Notifications Page.", key: const Key("walletsViewAlertsButton"), size: 36, shadows: const [], @@ -255,7 +255,7 @@ class _HomeViewState extends ConsumerState { child: AspectRatio( aspectRatio: 1, child: AppBarIconButton( - label: "Settings Button. Takes To Settings Page.", + semanticsLabel: "Settings Button. Takes To Settings Page.", key: const Key("walletsViewSettingsButton"), size: 36, shadows: const [], diff --git a/lib/pages/pinpad_views/lock_screen_view.dart b/lib/pages/pinpad_views/lock_screen_view.dart index f99f3ddfc..f0978bd21 100644 --- a/lib/pages/pinpad_views/lock_screen_view.dart +++ b/lib/pages/pinpad_views/lock_screen_view.dart @@ -248,7 +248,7 @@ class _LockscreenViewState extends ConsumerState { ), CustomPinPut( customKey: CustomKey( - customKeyLabel: Platform.isIOS + semanticsLabel: Platform.isIOS ? "Face ID Button. Checks Face ID." : "Fingerprint Button. Checks Fingerprint." , diff --git a/lib/pages/receive_view/receive_view.dart b/lib/pages/receive_view/receive_view.dart index b74dc5a33..9800c9c38 100644 --- a/lib/pages/receive_view/receive_view.dart +++ b/lib/pages/receive_view/receive_view.dart @@ -143,7 +143,7 @@ class _ReceiveViewState extends ConsumerState { child: AspectRatio( aspectRatio: 1, child: AppBarIconButton( - label: "Adress List Pop-up Button. Opens A Pop-up For Adress List Button.", + semanticsLabel: "Address List Pop-up Button. Opens A Pop-up For Adress List Button.", key: const Key("walletNetworkSettingsAddNewNodeViewButton"), size: 36, shadows: const [], diff --git a/lib/pages/send_view/send_view.dart b/lib/pages/send_view/send_view.dart index 479c931ae..6f09a647f 100644 --- a/lib/pages/send_view/send_view.dart +++ b/lib/pages/send_view/send_view.dart @@ -981,7 +981,7 @@ class _SendViewState extends ConsumerState { children: [ _addressToggleFlag ? TextFieldIconButton( - label: "Clear Button. Clears The Address Field Input.", + semanticsLabel: "Clear Button. Clears The Address Field Input.", key: const Key( "sendViewClearAddressFieldButtonKey"), onTap: () { @@ -998,7 +998,7 @@ class _SendViewState extends ConsumerState { child: const XIcon(), ) : TextFieldIconButton( - label: "Paste Button. Pastes From Clipboard To Address Field Input.", + semanticsLabel: "Paste Button. Pastes From Clipboard To Address Field Input.", key: const Key( "sendViewPasteAddressFieldButtonKey"), onTap: () async { @@ -1048,7 +1048,7 @@ class _SendViewState extends ConsumerState { ), if (sendToController.text.isEmpty) TextFieldIconButton( - label: "Address Book Button. Opens Address Book For Address Field.", + semanticsLabel: "Address Book Button. Opens Address Book For Address Field.", key: const Key( "sendViewAddressBookButtonKey"), onTap: () { @@ -1061,7 +1061,7 @@ class _SendViewState extends ConsumerState { ), if (sendToController.text.isEmpty) TextFieldIconButton( - label: "Scan QR Button. Opens Camera For Scanning QR Code.", + semanticsLabel: "Scan QR Button. Opens Camera For Scanning QR Code.", key: const Key( "sendViewScanQrButtonKey"), onTap: () async { diff --git a/lib/pages/wallet_view/wallet_view.dart b/lib/pages/wallet_view/wallet_view.dart index 649464722..de7775629 100644 --- a/lib/pages/wallet_view/wallet_view.dart +++ b/lib/pages/wallet_view/wallet_view.dart @@ -473,7 +473,7 @@ class _WalletViewState extends ConsumerState { child: AspectRatio( aspectRatio: 1, child: AppBarIconButton( - label: "Network Button. Takes To Network Status Page.", + semanticsLabel: "Network Button. Takes To Network Status Page.", key: const Key("walletViewRadioButton"), size: 36, shadows: const [], @@ -503,7 +503,7 @@ class _WalletViewState extends ConsumerState { child: AspectRatio( aspectRatio: 1, child: AppBarIconButton( - label: "Notifications Button. Takes To Notifications Page.", + semanticsLabel: "Notifications Button. Takes To Notifications Page.", key: const Key("walletViewAlertsButton"), size: 36, shadows: const [], @@ -571,7 +571,7 @@ class _WalletViewState extends ConsumerState { child: AspectRatio( aspectRatio: 1, child: AppBarIconButton( - label: "Settings Button. Takes To Wallet Settings Page.", + semanticsLabel: "Settings Button. Takes To Wallet Settings Page.", key: const Key("walletViewSettingsButton"), size: 36, shadows: const [], diff --git a/lib/widgets/custom_buttons/app_bar_icon_button.dart b/lib/widgets/custom_buttons/app_bar_icon_button.dart index 7c3980bb8..71d8910d0 100644 --- a/lib/widgets/custom_buttons/app_bar_icon_button.dart +++ b/lib/widgets/custom_buttons/app_bar_icon_button.dart @@ -13,7 +13,7 @@ class AppBarIconButton extends StatelessWidget { // this.circularBorderRadius = 10.0, this.size = 36.0, this.shadows = const [], - this.label = "Button", + this.semanticsLabel = "Button", }) : super(key: key); final Widget icon; @@ -22,7 +22,7 @@ class AppBarIconButton extends StatelessWidget { // final double circularBorderRadius; final double size; final List shadows; - final String label; + final String semanticsLabel; @override Widget build(BuildContext context) { @@ -36,7 +36,7 @@ class AppBarIconButton extends StatelessWidget { ), child: Semantics( excludeSemantics: true, - label: label, + label: semanticsLabel, child: MaterialButton( splashColor: Theme.of(context).extension()!.highlight, padding: EdgeInsets.zero, @@ -59,14 +59,14 @@ class AppBarBackButton extends StatelessWidget { this.isCompact = false, this.size, this.iconSize, - this.label = "Back Button. Takes Back To Previous Page.", + this.semanticsLabel = "Back Button. Takes Back To Previous Page.", }) : super(key: key); final VoidCallback? onPressed; final bool isCompact; final double? size; final double? iconSize; - final String label; + final String semanticsLabel; @override Widget build(BuildContext context) { @@ -79,7 +79,7 @@ class AppBarBackButton extends StatelessWidget { ) : const EdgeInsets.all(10), child: AppBarIconButton( - label: label, + semanticsLabel: semanticsLabel, size: size ?? (isDesktop ? isCompact diff --git a/lib/widgets/custom_pin_put/pin_keyboard.dart b/lib/widgets/custom_pin_put/pin_keyboard.dart index 954bd257c..fc1c58ea6 100644 --- a/lib/widgets/custom_pin_put/pin_keyboard.dart +++ b/lib/widgets/custom_pin_put/pin_keyboard.dart @@ -202,12 +202,12 @@ class CustomKey extends StatelessWidget { Key? key, required this.onPressed, this.iconAssetName, - this.customKeyLabel = "Button", + this.semanticsLabel = "Button", }) : super(key: key); final VoidCallback onPressed; final String? iconAssetName; - final String customKeyLabel; + final String semanticsLabel; @override Widget build(BuildContext context) { @@ -220,7 +220,7 @@ class CustomKey extends StatelessWidget { shadows: const [], ), child: Semantics( - label: customKeyLabel, + label: semanticsLabel, excludeSemantics: true, child: MaterialButton( // splashColor: Theme.of(context).extension()!.highlight, diff --git a/lib/widgets/textfield_icon_button.dart b/lib/widgets/textfield_icon_button.dart index 9be08ef56..df231a781 100644 --- a/lib/widgets/textfield_icon_button.dart +++ b/lib/widgets/textfield_icon_button.dart @@ -8,7 +8,7 @@ class TextFieldIconButton extends StatefulWidget { this.onTap, required this.child, this.color = Colors.transparent, - this.label = "Button", + this.semanticsLabel = "Button", }) : super(key: key); final double width; @@ -16,7 +16,7 @@ class TextFieldIconButton extends StatefulWidget { final VoidCallback? onTap; final Widget child; final Color color; - final String label; + final String semanticsLabel; @override State createState() => _TextFieldIconButtonState(); @@ -39,7 +39,7 @@ class _TextFieldIconButtonState extends State { child: ClipRRect( borderRadius: BorderRadius.circular(100), child: Semantics( - label: widget.label, + label: widget.semanticsLabel, excludeSemantics: true, child: RawMaterialButton( constraints: BoxConstraints(