diff --git a/lib/src/widgets/bottom_sheet/base_bottom_sheet_widget.dart b/lib/src/widgets/bottom_sheet/base_bottom_sheet_widget.dart index 206780eae..923062c2e 100644 --- a/lib/src/widgets/bottom_sheet/base_bottom_sheet_widget.dart +++ b/lib/src/widgets/bottom_sheet/base_bottom_sheet_widget.dart @@ -33,7 +33,7 @@ abstract class BaseBottomSheet extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ if (titleIconPath != null) - Image.asset(titleIconPath!, height: 24, width: 24) + Image.asset(titleIconPath!, height: 24, width: 24, excludeFromSemantics: true) else Container(), const SizedBox(width: 6), diff --git a/lib/src/widgets/bottom_sheet/confirm_sending_bottom_sheet_widget.dart b/lib/src/widgets/bottom_sheet/confirm_sending_bottom_sheet_widget.dart index f78717fb3..764429bf1 100644 --- a/lib/src/widgets/bottom_sheet/confirm_sending_bottom_sheet_widget.dart +++ b/lib/src/widgets/bottom_sheet/confirm_sending_bottom_sheet_widget.dart @@ -223,6 +223,7 @@ class ConfirmSendingBottomSheet extends BaseBottomSheet { onSlideComplete: onSlideComplete, buttonText: 'Swipe to send', currentTheme: currentTheme, + accessibleNavigationModeButtonText: S.of(context).send, ), ); } @@ -248,24 +249,28 @@ class StandardTile extends StatelessWidget { @override Widget build(BuildContext context) { - return Container( - padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8), - decoration: - BoxDecoration(borderRadius: BorderRadius.circular(10), color: tileBackgroundColor), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text(itemTitle, style: itemTitleTextStyle), - Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text(itemValue, style: itemTitleTextStyle), - itemSubTitle == null - ? Container() - : Text(itemSubTitle!, style: itemSubTitleTextStyle), - ], - ), - ], + return Semantics( + container: true, + label: itemTitle, + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8), + decoration: + BoxDecoration(borderRadius: BorderRadius.circular(10), color: tileBackgroundColor), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(itemTitle, style: itemTitleTextStyle), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text(itemValue, style: itemTitleTextStyle), + itemSubTitle == null + ? Container() + : Text(itemSubTitle!, style: itemSubTitleTextStyle), + ], + ), + ], + ), ), ); } @@ -357,54 +362,58 @@ class AddressExpansionTile extends StatelessWidget { @override Widget build(BuildContext context) { - return Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(10)), - color: tileBackgroundColor, - ), - child: Theme( - data: Theme.of(context).copyWith(dividerColor: Colors.transparent), - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 14, vertical: isBatchSending ? 0 : 8), - child: ExpansionTile( - childrenPadding: isBatchSending ? const EdgeInsets.only(bottom: 8) : EdgeInsets.zero, - tilePadding: EdgeInsets.zero, - dense: true, - visualDensity: VisualDensity.compact, - title: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Text(isBatchSending ? name : contactType, - style: itemTitleTextStyle, softWrap: true)), - Text(isBatchSending ? amount : name, - style: TextStyle( - fontSize: 14, - fontFamily: 'Lato', - fontWeight: FontWeight.w600, - color: Theme.of(context).extension()!.titleColor, - decoration: TextDecoration.none, - )), - ], - ), - children: [ - Row( + return Semantics( + container: true, + label: name, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(10)), + color: tileBackgroundColor, + ), + child: Theme( + data: Theme.of(context).copyWith(dividerColor: Colors.transparent), + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 14, vertical: isBatchSending ? 0 : 8), + child: ExpansionTile( + childrenPadding: isBatchSending ? const EdgeInsets.only(bottom: 8) : EdgeInsets.zero, + tilePadding: EdgeInsets.zero, + dense: true, + visualDensity: VisualDensity.compact, + title: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded( - child: AddressFormatter.buildSegmentedAddress( - address: address, - walletType: walletType, - evenTextStyle: TextStyle( - fontSize: 12, - fontFamily: 'Lato', - fontWeight: FontWeight.w600, - color: Theme.of(context).extension()!.titleColor, - decoration: TextDecoration.none) - ), - ), + child: Text(isBatchSending ? name : contactType, + style: itemTitleTextStyle, softWrap: true)), + Text(isBatchSending ? amount : name, + style: TextStyle( + fontSize: 14, + fontFamily: 'Lato', + fontWeight: FontWeight.w600, + color: Theme.of(context).extension()!.titleColor, + decoration: TextDecoration.none, + )), ], ), - ], + children: [ + Row( + children: [ + Expanded( + child: AddressFormatter.buildSegmentedAddress( + address: address, + walletType: walletType, + evenTextStyle: TextStyle( + fontSize: 12, + fontFamily: 'Lato', + fontWeight: FontWeight.w600, + color: Theme.of(context).extension()!.titleColor, + decoration: TextDecoration.none) + ), + ), + ], + ), + ], + ), ), ), ), diff --git a/lib/src/widgets/standard_slide_button_widget.dart b/lib/src/widgets/standard_slide_button_widget.dart index 57271b6b5..299f6bdf7 100644 --- a/lib/src/widgets/standard_slide_button_widget.dart +++ b/lib/src/widgets/standard_slide_button_widget.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/themes/extensions/cake_text_theme.dart'; import 'package:cake_wallet/themes/extensions/filter_theme.dart'; import 'package:cake_wallet/themes/extensions/menu_theme.dart'; @@ -12,12 +13,14 @@ class StandardSlideButton extends StatefulWidget { this.buttonText = '', this.height = 48.0, required this.currentTheme, + required this.accessibleNavigationModeButtonText, }) : super(key: key); final VoidCallback onSlideComplete; final String buttonText; final double height; final ThemeBase currentTheme; + final String accessibleNavigationModeButtonText; @override _StandardSlideButtonState createState() => _StandardSlideButtonState(); @@ -28,68 +31,77 @@ class _StandardSlideButtonState extends State { @override Widget build(BuildContext context) { - return LayoutBuilder(builder: (context, constraints) { - final double maxWidth = constraints.maxWidth; - const double sideMargin = 4.0; - final double effectiveMaxWidth = maxWidth - 2 * sideMargin; - const double sliderWidth = 42.0; + final bool accessible = MediaQuery.of(context).accessibleNavigation; - final tileBackgroundColor = widget.currentTheme.type == ThemeType.light - ? Theme.of(context).extension()!.syncedBackgroundColor - : widget.currentTheme.type == ThemeType.oled - ? Colors.black.withOpacity(0.5) - : Theme.of(context).extension()!.buttonColor; + final tileBackgroundColor = widget.currentTheme.type == ThemeType.light + ? Theme.of(context).extension()!.syncedBackgroundColor + : widget.currentTheme.type == ThemeType.oled + ? Colors.black.withOpacity(0.5) + : Theme.of(context).extension()!.buttonColor; - return Container( - height: widget.height, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: tileBackgroundColor), - child: Stack( - alignment: Alignment.centerLeft, - children: [ - Center( - child: Text(widget.buttonText, - style: TextStyle( - fontSize: 16, - fontFamily: 'Lato', - fontWeight: FontWeight.w600, - color: Theme.of(context).extension()!.titleColor))), - Positioned( - left: sideMargin + _dragPosition, - child: GestureDetector( - onHorizontalDragUpdate: (details) { - setState(() { - _dragPosition += details.delta.dx; - if (_dragPosition < 0) _dragPosition = 0; - if (_dragPosition > effectiveMaxWidth - sliderWidth) { - _dragPosition = effectiveMaxWidth - sliderWidth; - } - }); - }, - onHorizontalDragEnd: (details) { - if (_dragPosition >= effectiveMaxWidth - sliderWidth - 10) { - widget.onSlideComplete(); - } else { - setState(() => _dragPosition = 0); - } - }, - child: Container( - width: sliderWidth, - height: widget.height - 8, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Theme.of(context).extension()!.titleColor, - ), - alignment: Alignment.center, - child: Icon(Icons.arrow_forward, - color: widget.currentTheme.type == ThemeType.bright ? Theme.of(context).extension()!.backgroundColor : Theme.of(context).extension()!.buttonColor), - ), + return accessible + ? PrimaryButton( + text: widget.accessibleNavigationModeButtonText, + color: Theme.of(context).primaryColor, + textColor: Colors.white, + onPressed: () => widget.onSlideComplete()) + : LayoutBuilder(builder: (context, constraints) { + final double maxWidth = constraints.maxWidth; + const double sideMargin = 4.0; + final double effectiveMaxWidth = maxWidth - 2 * sideMargin; + const double sliderWidth = 42.0; + + return Container( + height: widget.height, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), color: tileBackgroundColor), + child: Stack( + alignment: Alignment.centerLeft, + children: [ + Center( + child: Text(widget.buttonText, + style: TextStyle( + fontSize: 16, + fontFamily: 'Lato', + fontWeight: FontWeight.w600, + color: Theme.of(context).extension()!.titleColor))), + Positioned( + left: sideMargin + _dragPosition, + child: GestureDetector( + onHorizontalDragUpdate: (details) { + setState(() { + _dragPosition += details.delta.dx; + if (_dragPosition < 0) _dragPosition = 0; + if (_dragPosition > effectiveMaxWidth - sliderWidth) { + _dragPosition = effectiveMaxWidth - sliderWidth; + } + }); + }, + onHorizontalDragEnd: (details) { + if (_dragPosition >= effectiveMaxWidth - sliderWidth - 10) { + widget.onSlideComplete(); + } else { + setState(() => _dragPosition = 0); + } + }, + child: Container( + width: sliderWidth, + height: widget.height - 8, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Theme.of(context).extension()!.titleColor, + ), + alignment: Alignment.center, + child: Icon(Icons.arrow_forward, + color: widget.currentTheme.type == ThemeType.bright + ? Theme.of(context).extension()!.backgroundColor + : Theme.of(context).extension()!.buttonColor), + ), + ), + ) + ], ), - ) - ], - ), - ); - }); + ); + }); } }