Accessibility fixes (#1128)
Serhii committed
Oct 19, 2023 at 01:08 UTC
8889f09509045531c3fb9f4c5aed172c1930f69d
5 files changed
+163
-147
lib/src/screens/dashboard/widgets/address_page.dart
+16
-13
@@ -99,19 +99,22 @@ class AddressPage extends BasePage {
99
Widget? trailing(BuildContext context) {
100
return Material(
101
color: Colors.transparent,
102
- child: IconButton(
103
- padding: EdgeInsets.zero,
104
- constraints: BoxConstraints(),
105
- highlightColor: Colors.transparent,
106
- splashColor: Colors.transparent,
107
- iconSize: 25,
108
- onPressed: () {
109
- ShareUtil.share(
110
- text: addressListViewModel.uri.toString(),
111
- context: context,
112
- );
113
- },
114
- icon: Icon(Icons.share, size: 20, color: pageIconColor(context)),
102
+ child: Semantics(
103
+ label: S.of(context).share,
104
+ child: IconButton(
105
+ padding: EdgeInsets.zero,
106
+ constraints: BoxConstraints(),
107
+ highlightColor: Colors.transparent,
108
+ splashColor: Colors.transparent,
109
+ iconSize: 25,
110
+ onPressed: () {
111
+ ShareUtil.share(
112
+ text: addressListViewModel.uri.toString(),
113
+ context: context,
114
+ );
115
+ },
116
+ icon: Icon(Icons.share, size: 20, color: pageIconColor(context)),
117
+ ),
118
),
119
);
120
}
lib/src/screens/dashboard/widgets/header_row.dart
+23
-15
@@ -31,21 +31,29 @@ class HeaderRow extends StatelessWidget {
31
fontWeight: FontWeight.w500,
32
color: Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor),
33
),
34
- GestureDetector(
35
- onTap: () {
36
- showPopUp<void>(
37
- context: context,
38
- builder: (context) =>
39
- FilterWidget(dashboardViewModel: dashboardViewModel)
40
- );
41
- },
42
- child: Container(
43
- height: 36,
44
- width: 36,
45
- decoration: BoxDecoration(
46
- shape: BoxShape.circle,
47
- color: Theme.of(context).extension<FilterTheme>()!.buttonColor),
48
- child: filterIcon,
34
+ Semantics(
35
+ container: true,
36
+ child: GestureDetector(
37
+ onTap: () {
38
+ showPopUp<void>(
39
+ context: context,
40
+ builder: (context) => FilterWidget(dashboardViewModel: dashboardViewModel),
41
+ );
42
+ },
43
+ child: Semantics(
44
+ label: 'Transaction Filter',
45
+ button: true,
46
+ enabled: true,
47
+ child: Container(
48
+ height: 36,
49
+ width: 36,
50
+ decoration: BoxDecoration(
51
+ shape: BoxShape.circle,
52
+ color: Theme.of(context).extension<FilterTheme>()!.buttonColor,
53
+ ),
54
+ child: filterIcon,
55
+ ),
56
+ ),
57
),
58
)
59
],
lib/src/screens/dashboard/widgets/present_receive_option_picker.dart
+59
-67
@@ -1,5 +1,5 @@
1
+import 'package:cake_wallet/src/widgets/alert_close_button.dart';
2
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
2
-import 'package:cake_wallet/palette.dart';
3
import 'package:cake_wallet/src/screens/ionia/widgets/rounded_checkbox.dart';
4
import 'package:cake_wallet/src/widgets/alert_background.dart';
5
import 'package:cake_wallet/typography.dart';
@@ -71,77 +71,69 @@ class PresentReceiveOptionPicker extends StatelessWidget {
71
builder: (BuildContext popUpContext) => Scaffold(
72
resizeToAvoidBottomInset: false,
73
backgroundColor: Colors.transparent,
74
- body: AlertBackground(
75
- child: Column(
76
- mainAxisSize: MainAxisSize.min,
77
- mainAxisAlignment: MainAxisAlignment.center,
78
- children: [
79
- Spacer(),
80
- Container(
81
- margin: EdgeInsets.symmetric(horizontal: 24),
82
- decoration: BoxDecoration(
83
- borderRadius: BorderRadius.circular(30),
84
- color: Theme.of(context).colorScheme.background,
85
- ),
86
- child: Padding(
87
- padding: const EdgeInsets.only(top: 24, bottom: 24),
88
- child: (ListView.separated(
89
- padding: EdgeInsets.zero,
90
- shrinkWrap: true,
91
- itemCount: receiveOptionViewModel.options.length,
92
- itemBuilder: (_, index) {
93
- final option = receiveOptionViewModel.options[index];
94
- return InkWell(
95
- onTap: () {
96
- Navigator.pop(popUpContext);
74
+ body: Stack(
75
+ alignment: AlignmentDirectional.center,
76
+ children:[ AlertBackground(
77
+ child: Column(
78
+ mainAxisSize: MainAxisSize.min,
79
+ mainAxisAlignment: MainAxisAlignment.center,
80
+ children: [
81
+ Spacer(),
82
+ Container(
83
+ margin: EdgeInsets.symmetric(horizontal: 24),
84
+ decoration: BoxDecoration(
85
+ borderRadius: BorderRadius.circular(30),
86
+ color: Theme.of(context).colorScheme.background,
87
+ ),
88
+ child: Padding(
89
+ padding: const EdgeInsets.only(top: 24, bottom: 24),
90
+ child: (ListView.separated(
91
+ padding: EdgeInsets.zero,
92
+ shrinkWrap: true,
93
+ itemCount: receiveOptionViewModel.options.length,
94
+ itemBuilder: (_, index) {
95
+ final option = receiveOptionViewModel.options[index];
96
+ return InkWell(
97
+ onTap: () {
98
+ Navigator.pop(popUpContext);
99
98
- receiveOptionViewModel.selectReceiveOption(option);
99
- },
100
- child: Padding(
101
- padding: const EdgeInsets.only(left: 24, right: 24),
102
- child: Observer(builder: (_) {
103
- final value = receiveOptionViewModel.selectedReceiveOption;
100
+ receiveOptionViewModel.selectReceiveOption(option);
101
+ },
102
+ child: Padding(
103
+ padding: const EdgeInsets.only(left: 24, right: 24),
104
+ child: Observer(builder: (_) {
105
+ final value = receiveOptionViewModel.selectedReceiveOption;
106
105
- return Row(
106
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
107
- children: [
108
- Text(option.toString(),
109
- textAlign: TextAlign.left,
110
- style: textSmall(
111
- color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
112
- ).copyWith(
113
- fontWeight:
114
- value == option ? FontWeight.w800 : FontWeight.w500,
115
- )),
116
- RoundedCheckbox(
117
- value: value == option,
118
- )
119
- ],
120
- );
121
- }),
122
- ),
123
- );
124
- },
125
- separatorBuilder: (_, index) => SizedBox(height: 30),
126
- )),
127
- ),
128
- ),
129
- Spacer(),
130
- Container(
131
- margin: EdgeInsets.only(bottom: 40),
132
- child: InkWell(
133
- onTap: () => Navigator.pop(popUpContext),
134
- child: CircleAvatar(
135
- child: Icon(
136
- Icons.close,
137
- color: Palette.darkBlueCraiola,
138
- ),
139
- backgroundColor: Colors.white,
107
+ return Row(
108
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
109
+ children: [
110
+ Text(option.toString(),
111
+ textAlign: TextAlign.left,
112
+ style: textSmall(
113
+ color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
114
+ ).copyWith(
115
+ fontWeight:
116
+ value == option ? FontWeight.w800 : FontWeight.w500,
117
+ )),
118
+ RoundedCheckbox(
119
+ value: value == option,
120
+ )
121
+ ],
122
+ );
123
+ }),
124
+ ),
125
+ );
126
+ },
127
+ separatorBuilder: (_, index) => SizedBox(height: 30),
128
+ )),
129
),
130
),
142
- )
143
- ],
131
+ Spacer()
132
+ ],
133
+ ),
134
),
135
+ AlertCloseButton(onTap: () => Navigator.of(popUpContext).pop(), bottom: 40)
136
+ ],
137
),
138
),
139
context: context,
lib/src/screens/exchange/widgets/exchange_card.dart
+52
-46
@@ -416,37 +416,40 @@ class ExchangeCardState extends State<ExchangeCard> {
416
width: 34,
417
height: 34,
418
padding: EdgeInsets.only(top: 0),
419
- child: InkWell(
420
- onTap: () async {
421
- final contact =
422
- await Navigator.of(context)
423
- .pushNamed(
424
- Routes.pickerAddressBook,
425
- arguments: widget.initialCurrency,
426
- );
419
+ child: Semantics(
420
+ label: S.of(context).address_book,
421
+ child: InkWell(
422
+ onTap: () async {
423
+ final contact =
424
+ await Navigator.of(context)
425
+ .pushNamed(
426
+ Routes.pickerAddressBook,
427
+ arguments: widget.initialCurrency,
428
+ );
429
428
- if (contact is ContactBase &&
429
- contact.address != null) {
430
- setState(() =>
431
- addressController.text =
432
- contact.address);
433
- widget.onPushAddressBookButton
434
- ?.call(context);
435
- }
436
- },
437
- child: Container(
438
- padding: EdgeInsets.all(8),
439
- decoration: BoxDecoration(
440
- color: widget
441
- .addressButtonsColor,
442
- borderRadius:
443
- BorderRadius.all(
444
- Radius.circular(
445
- 6))),
446
- child: Image.asset(
447
- 'assets/images/open_book.png',
448
- color: Theme.of(context).extension<SendPageTheme>()!.textFieldButtonIconColor,
449
- )),
430
+ if (contact is ContactBase &&
431
+ contact.address != null) {
432
+ setState(() =>
433
+ addressController.text =
434
+ contact.address);
435
+ widget.onPushAddressBookButton
436
+ ?.call(context);
437
+ }
438
+ },
439
+ child: Container(
440
+ padding: EdgeInsets.all(8),
441
+ decoration: BoxDecoration(
442
+ color: widget
443
+ .addressButtonsColor,
444
+ borderRadius:
445
+ BorderRadius.all(
446
+ Radius.circular(
447
+ 6))),
448
+ child: Image.asset(
449
+ 'assets/images/open_book.png',
450
+ color: Theme.of(context).extension<SendPageTheme>()!.textFieldButtonIconColor,
451
+ )),
452
+ ),
453
)),
454
),
455
Padding(
@@ -455,22 +458,25 @@ class ExchangeCardState extends State<ExchangeCard> {
458
width: 34,
459
height: 34,
460
padding: EdgeInsets.only(top: 0),
458
- child: InkWell(
459
- onTap: () {
460
- Clipboard.setData(ClipboardData(
461
- text: addressController
462
- .text));
463
- showBar<void>(
464
- context,
465
- S
466
- .of(context)
467
- .copied_to_clipboard);
468
- },
469
- child: Container(
470
- padding: EdgeInsets.fromLTRB(
471
- 8, 8, 0, 8),
472
- color: Colors.transparent,
473
- child: copyImage),
461
+ child: Semantics(
462
+ label: S.of(context).copy_address,
463
+ child: InkWell(
464
+ onTap: () {
465
+ Clipboard.setData(ClipboardData(
466
+ text: addressController
467
+ .text));
468
+ showBar<void>(
469
+ context,
470
+ S
471
+ .of(context)
472
+ .copied_to_clipboard);
473
+ },
474
+ child: Container(
475
+ padding: EdgeInsets.fromLTRB(
476
+ 8, 8, 0, 8),
477
+ color: Colors.transparent,
478
+ child: copyImage),
479
+ ),
480
)))
481
])))
482
])),
lib/src/widgets/alert_close_button.dart
+13
-6
@@ -1,8 +1,10 @@
1
+import 'package:cake_wallet/generated/i18n.dart';
2
import 'package:cake_wallet/palette.dart';
3
import 'package:flutter/material.dart';
4
5
class AlertCloseButton extends StatelessWidget {
6
AlertCloseButton({this.image, this.bottom, this.onTap});
7
+
8
final VoidCallback? onTap;
9
10
final Image? image;
@@ -19,12 +21,17 @@ class AlertCloseButton extends StatelessWidget {
21
bottom: bottom ?? 60,
22
child: GestureDetector(
23
onTap: onTap ?? () => Navigator.of(context).pop(),
22
- child: Container(
23
- height: 42,
24
- width: 42,
25
- decoration: BoxDecoration(color: Colors.white, shape: BoxShape.circle),
26
- child: Center(
27
- child: image ?? closeButton,
24
+ child: Semantics(
25
+ label: S.of(context).close,
26
+ button: true,
27
+ enabled: true,
28
+ child: Container(
29
+ height: 42,
30
+ width: 42,
31
+ decoration: BoxDecoration(color: Colors.white, shape: BoxShape.circle),
32
+ child: Center(
33
+ child: image ?? closeButton,
34
+ ),
35
),
36
),
37
),