Accessibility fixes (#1128)

This commit is contained in:
Serhii
2023-10-19 01:08:29 +03:00
committed by GitHub
parent 2a3b5644d7
commit 8889f09509
5 changed files with 163 additions and 147 deletions
@@ -99,19 +99,22 @@ class AddressPage extends BasePage {
Widget? trailing(BuildContext context) { Widget? trailing(BuildContext context) {
return Material( return Material(
color: Colors.transparent, color: Colors.transparent,
child: IconButton( child: Semantics(
padding: EdgeInsets.zero, label: S.of(context).share,
constraints: BoxConstraints(), child: IconButton(
highlightColor: Colors.transparent, padding: EdgeInsets.zero,
splashColor: Colors.transparent, constraints: BoxConstraints(),
iconSize: 25, highlightColor: Colors.transparent,
onPressed: () { splashColor: Colors.transparent,
ShareUtil.share( iconSize: 25,
text: addressListViewModel.uri.toString(), onPressed: () {
context: context, ShareUtil.share(
); text: addressListViewModel.uri.toString(),
}, context: context,
icon: Icon(Icons.share, size: 20, color: pageIconColor(context)), );
},
icon: Icon(Icons.share, size: 20, color: pageIconColor(context)),
),
), ),
); );
} }
@@ -31,21 +31,29 @@ class HeaderRow extends StatelessWidget {
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor), color: Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor),
), ),
GestureDetector( Semantics(
onTap: () { container: true,
showPopUp<void>( child: GestureDetector(
context: context, onTap: () {
builder: (context) => showPopUp<void>(
FilterWidget(dashboardViewModel: dashboardViewModel) context: context,
); builder: (context) => FilterWidget(dashboardViewModel: dashboardViewModel),
}, );
child: Container( },
height: 36, child: Semantics(
width: 36, label: 'Transaction Filter',
decoration: BoxDecoration( button: true,
shape: BoxShape.circle, enabled: true,
color: Theme.of(context).extension<FilterTheme>()!.buttonColor), child: Container(
child: filterIcon, height: 36,
width: 36,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).extension<FilterTheme>()!.buttonColor,
),
child: filterIcon,
),
),
), ),
) )
], ],
@@ -1,5 +1,5 @@
import 'package:cake_wallet/src/widgets/alert_close_button.dart';
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart'; import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/screens/ionia/widgets/rounded_checkbox.dart'; import 'package:cake_wallet/src/screens/ionia/widgets/rounded_checkbox.dart';
import 'package:cake_wallet/src/widgets/alert_background.dart'; import 'package:cake_wallet/src/widgets/alert_background.dart';
import 'package:cake_wallet/typography.dart'; import 'package:cake_wallet/typography.dart';
@@ -71,77 +71,69 @@ class PresentReceiveOptionPicker extends StatelessWidget {
builder: (BuildContext popUpContext) => Scaffold( builder: (BuildContext popUpContext) => Scaffold(
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
body: AlertBackground( body: Stack(
child: Column( alignment: AlignmentDirectional.center,
mainAxisSize: MainAxisSize.min, children:[ AlertBackground(
mainAxisAlignment: MainAxisAlignment.center, child: Column(
children: [ mainAxisSize: MainAxisSize.min,
Spacer(), mainAxisAlignment: MainAxisAlignment.center,
Container( children: [
margin: EdgeInsets.symmetric(horizontal: 24), Spacer(),
decoration: BoxDecoration( Container(
borderRadius: BorderRadius.circular(30), margin: EdgeInsets.symmetric(horizontal: 24),
color: Theme.of(context).colorScheme.background, decoration: BoxDecoration(
), borderRadius: BorderRadius.circular(30),
child: Padding( color: Theme.of(context).colorScheme.background,
padding: const EdgeInsets.only(top: 24, bottom: 24), ),
child: (ListView.separated( child: Padding(
padding: EdgeInsets.zero, padding: const EdgeInsets.only(top: 24, bottom: 24),
shrinkWrap: true, child: (ListView.separated(
itemCount: receiveOptionViewModel.options.length, padding: EdgeInsets.zero,
itemBuilder: (_, index) { shrinkWrap: true,
final option = receiveOptionViewModel.options[index]; itemCount: receiveOptionViewModel.options.length,
return InkWell( itemBuilder: (_, index) {
onTap: () { final option = receiveOptionViewModel.options[index];
Navigator.pop(popUpContext); return InkWell(
onTap: () {
Navigator.pop(popUpContext);
receiveOptionViewModel.selectReceiveOption(option); receiveOptionViewModel.selectReceiveOption(option);
}, },
child: Padding( child: Padding(
padding: const EdgeInsets.only(left: 24, right: 24), padding: const EdgeInsets.only(left: 24, right: 24),
child: Observer(builder: (_) { child: Observer(builder: (_) {
final value = receiveOptionViewModel.selectedReceiveOption; final value = receiveOptionViewModel.selectedReceiveOption;
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text(option.toString(), Text(option.toString(),
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: textSmall( style: textSmall(
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor, color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
).copyWith( ).copyWith(
fontWeight: fontWeight:
value == option ? FontWeight.w800 : FontWeight.w500, value == option ? FontWeight.w800 : FontWeight.w500,
)), )),
RoundedCheckbox( RoundedCheckbox(
value: value == option, value: value == option,
) )
], ],
); );
}), }),
), ),
); );
}, },
separatorBuilder: (_, index) => SizedBox(height: 30), separatorBuilder: (_, index) => SizedBox(height: 30),
)), )),
),
),
Spacer(),
Container(
margin: EdgeInsets.only(bottom: 40),
child: InkWell(
onTap: () => Navigator.pop(popUpContext),
child: CircleAvatar(
child: Icon(
Icons.close,
color: Palette.darkBlueCraiola,
),
backgroundColor: Colors.white,
), ),
), ),
) Spacer()
], ],
),
), ),
AlertCloseButton(onTap: () => Navigator.of(popUpContext).pop(), bottom: 40)
],
), ),
), ),
context: context, context: context,
@@ -416,37 +416,40 @@ class ExchangeCardState extends State<ExchangeCard> {
width: 34, width: 34,
height: 34, height: 34,
padding: EdgeInsets.only(top: 0), padding: EdgeInsets.only(top: 0),
child: InkWell( child: Semantics(
onTap: () async { label: S.of(context).address_book,
final contact = child: InkWell(
await Navigator.of(context) onTap: () async {
.pushNamed( final contact =
Routes.pickerAddressBook, await Navigator.of(context)
arguments: widget.initialCurrency, .pushNamed(
); Routes.pickerAddressBook,
arguments: widget.initialCurrency,
);
if (contact is ContactBase && if (contact is ContactBase &&
contact.address != null) { contact.address != null) {
setState(() => setState(() =>
addressController.text = addressController.text =
contact.address); contact.address);
widget.onPushAddressBookButton widget.onPushAddressBookButton
?.call(context); ?.call(context);
} }
}, },
child: Container( child: Container(
padding: EdgeInsets.all(8), padding: EdgeInsets.all(8),
decoration: BoxDecoration( decoration: BoxDecoration(
color: widget color: widget
.addressButtonsColor, .addressButtonsColor,
borderRadius: borderRadius:
BorderRadius.all( BorderRadius.all(
Radius.circular( Radius.circular(
6))), 6))),
child: Image.asset( child: Image.asset(
'assets/images/open_book.png', 'assets/images/open_book.png',
color: Theme.of(context).extension<SendPageTheme>()!.textFieldButtonIconColor, color: Theme.of(context).extension<SendPageTheme>()!.textFieldButtonIconColor,
)), )),
),
)), )),
), ),
Padding( Padding(
@@ -455,22 +458,25 @@ class ExchangeCardState extends State<ExchangeCard> {
width: 34, width: 34,
height: 34, height: 34,
padding: EdgeInsets.only(top: 0), padding: EdgeInsets.only(top: 0),
child: InkWell( child: Semantics(
onTap: () { label: S.of(context).copy_address,
Clipboard.setData(ClipboardData( child: InkWell(
text: addressController onTap: () {
.text)); Clipboard.setData(ClipboardData(
showBar<void>( text: addressController
context, .text));
S showBar<void>(
.of(context) context,
.copied_to_clipboard); S
}, .of(context)
child: Container( .copied_to_clipboard);
padding: EdgeInsets.fromLTRB( },
8, 8, 0, 8), child: Container(
color: Colors.transparent, padding: EdgeInsets.fromLTRB(
child: copyImage), 8, 8, 0, 8),
color: Colors.transparent,
child: copyImage),
),
))) )))
]))) ])))
])), ])),
+13 -6
View File
@@ -1,8 +1,10 @@
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/palette.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class AlertCloseButton extends StatelessWidget { class AlertCloseButton extends StatelessWidget {
AlertCloseButton({this.image, this.bottom, this.onTap}); AlertCloseButton({this.image, this.bottom, this.onTap});
final VoidCallback? onTap; final VoidCallback? onTap;
final Image? image; final Image? image;
@@ -19,12 +21,17 @@ class AlertCloseButton extends StatelessWidget {
bottom: bottom ?? 60, bottom: bottom ?? 60,
child: GestureDetector( child: GestureDetector(
onTap: onTap ?? () => Navigator.of(context).pop(), onTap: onTap ?? () => Navigator.of(context).pop(),
child: Container( child: Semantics(
height: 42, label: S.of(context).close,
width: 42, button: true,
decoration: BoxDecoration(color: Colors.white, shape: BoxShape.circle), enabled: true,
child: Center( child: Container(
child: image ?? closeButton, height: 42,
width: 42,
decoration: BoxDecoration(color: Colors.white, shape: BoxShape.circle),
child: Center(
child: image ?? closeButton,
),
), ),
), ),
), ),