Cw 304 enhance talkback (#887)

* fix(#536): add talkback support to missing main and common elements

* fix(#564): add talkback support for slidable node items & addresses page

* fix: add missing delete button from add pin widget
This commit is contained in:
Rafael Saes 2023-04-18 17:36:56 +00:00 committed by GitHub
parent 9e7009f339
commit 5ad67b62a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 230 additions and 226 deletions

View file

@ -58,19 +58,24 @@ abstract class BasePage extends StatelessWidget {
bool isMobileView = ResponsiveLayoutUtil.instance.isMobile(context); bool isMobileView = ResponsiveLayoutUtil.instance.isMobile(context);
return SizedBox( return MergeSemantics(
child: SizedBox(
height: isMobileView ? 37 : 45, height: isMobileView ? 37 : 45,
width: isMobileView ? 37 : 45, width: isMobileView ? 37 : 45,
child: ButtonTheme( child: ButtonTheme(
minWidth: double.minPositive, minWidth: double.minPositive,
child: Semantics(
label: canUseCloseIcon && !isMobileView ? 'Close' : 'Back',
child: TextButton( child: TextButton(
style: ButtonStyle( style: ButtonStyle(
overlayColor: MaterialStateColor.resolveWith((states) => Colors.transparent), overlayColor: MaterialStateColor.resolveWith(
(states) => Colors.transparent),
), ),
onPressed: () => onClose(context), onPressed: () => onClose(context),
child: canUseCloseIcon && !isMobileView child:
? _closeButton canUseCloseIcon && !isMobileView ? _closeButton : _backButton,
: _backButton, ),
),
), ),
), ),
); );

View file

@ -104,7 +104,7 @@ class _DashboardPageView extends BasePage {
//splashColor: Colors.transparent, //splashColor: Colors.transparent,
//padding: EdgeInsets.all(0), //padding: EdgeInsets.all(0),
onPressed: () => onOpenEndDrawer(), onPressed: () => onOpenEndDrawer(),
child: menuButton)); child: Semantics(label: 'Menu', child: menuButton)));
} }
final DashboardViewModel dashboardViewModel; final DashboardViewModel dashboardViewModel;
@ -149,7 +149,8 @@ class _DashboardPageView extends BasePage {
Padding( Padding(
padding: EdgeInsets.only(bottom: 24, top: 10), padding: EdgeInsets.only(bottom: 24, top: 10),
child: Observer(builder: (context) { child: Observer(builder: (context) {
return SmoothPageIndicator( return ExcludeSemantics(
child: SmoothPageIndicator(
controller: controller, controller: controller,
count: pages.length, count: pages.length,
effect: ColorTransitionEffect( effect: ColorTransitionEffect(
@ -158,8 +159,11 @@ class _DashboardPageView extends BasePage {
dotWidth: 6.0, dotWidth: 6.0,
dotHeight: 6.0, dotHeight: 6.0,
dotColor: Theme.of(context).indicatorColor, dotColor: Theme.of(context).indicatorColor,
activeDotColor: activeDotColor: Theme.of(context)
Theme.of(context).accentTextTheme!.headline4!.backgroundColor!), .accentTextTheme!
.headline4!
.backgroundColor!),
),
); );
} }
)), )),
@ -184,11 +188,18 @@ class _DashboardPageView extends BasePage {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: MainActions.all children: MainActions.all
.where((element) => element.canShow?.call(dashboardViewModel) ?? true) .where((element) => element.canShow?.call(dashboardViewModel) ?? true)
.map((action) => ActionButton( .map((action) => Semantics(
button: true,
enabled: (action.isEnabled
?.call(dashboardViewModel) ??
true),
child: ActionButton(
image: Image.asset(action.image, image: Image.asset(action.image,
height: 24, height: 24,
width: 24, width: 24,
color: action.isEnabled?.call(dashboardViewModel) ?? true color: action.isEnabled?.call(
dashboardViewModel) ??
true
? Theme.of(context) ? Theme.of(context)
.accentTextTheme .accentTextTheme
.headline2! .headline2!
@ -198,13 +209,17 @@ class _DashboardPageView extends BasePage {
.headline3! .headline3!
.backgroundColor!), .backgroundColor!),
title: action.name(context), title: action.name(context),
onClick: () async => await action.onTap(context, dashboardViewModel), onClick: () async => await action.onTap(
textColor: action.isEnabled?.call(dashboardViewModel) ?? true context, dashboardViewModel),
textColor: action.isEnabled
?.call(dashboardViewModel) ??
true
? null ? null
: Theme.of(context) : Theme.of(context)
.accentTextTheme .accentTextTheme
.headline3! .headline3!
.backgroundColor!, .backgroundColor!,
),
)) ))
.toList(), .toList(),
), ),
@ -222,10 +237,14 @@ class _DashboardPageView extends BasePage {
return; return;
} }
if (dashboardViewModel.shouldShowMarketPlaceInDashboard) { if (dashboardViewModel.shouldShowMarketPlaceInDashboard) {
pages.add(MarketPlacePage(dashboardViewModel: dashboardViewModel)); pages.add(Semantics(
label: 'Marketplace Page',
child: MarketPlacePage(dashboardViewModel: dashboardViewModel)));
} }
pages.add(balancePage); pages.add(Semantics(label: 'Balance Page', child: balancePage));
pages.add(TransactionsPage(dashboardViewModel: dashboardViewModel)); pages.add(Semantics(
label: 'Transactions Page',
child: TransactionsPage(dashboardViewModel: dashboardViewModel)));
_isEffectsInstalled = true; _isEffectsInstalled = true;
autorun((_) async { autorun((_) async {

View file

@ -139,7 +139,9 @@ class _WalletNameFormState extends State<WalletNameForm> {
.decorationColor!, .decorationColor!,
width: 1.0), width: 1.0),
), ),
suffixIcon: IconButton( suffixIcon: Semantics(
label: 'Generate Name',
child: IconButton(
onPressed: () async { onPressed: () async {
final rName = await generateName(); final rName = await generateName();
FocusManager.instance.primaryFocus?.unfocus(); FocusManager.instance.primaryFocus?.unfocus();
@ -169,6 +171,7 @@ class _WalletNameFormState extends State<WalletNameForm> {
), ),
), ),
), ),
),
validator: WalletNameValidator(), validator: WalletNameValidator(),
), ),
], ],

View file

@ -208,51 +208,20 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
const double marginLeft = 15; const double marginLeft = 15;
if (index == 9) { if (index == 9) {
// Empty container
return Container( return Container(
margin: EdgeInsets.only(left: marginLeft, right: marginRight), margin: EdgeInsets.only(left: marginLeft, right: marginRight),
child: TextButton(
onPressed: () => null,
// (widget.hasLengthSwitcher ||
// !settingsStore
// .allowBiometricalAuthentication)
// ? null
// : () {
// FIXME
// if (authStore != null) {
// WidgetsBinding.instance.addPostFrameCallback((_) {
// final biometricAuth = BiometricAuth();
// biometricAuth.isAuthenticated().then(
// (isAuth) {
// if (isAuth) {
// authStore.biometricAuth();
// _key.currentState.showSnackBar(
// SnackBar(
// content: Text(S.of(context).authenticated),
// backgroundColor: Colors.green,
// ),
// );
// }
// }
// );
// });
// }
// },
// FIX-ME: Style
//color: Theme.of(context).backgroundColor,
//shape: CircleBorder(),
child: Container()
// (widget.hasLengthSwitcher ||
// !settingsStore
// .allowBiometricalAuthentication)
// ? Offstage()
// : faceImage,
),
); );
} else if (index == 10) { } else if (index == 10) {
index = 0; index = 0;
} else if (index == 11) { } else if (index == 11) {
return Container( return MergeSemantics(
child: Container(
margin: EdgeInsets.only(left: marginLeft, right: marginRight), margin: EdgeInsets.only(left: marginLeft, right: marginRight),
child: Semantics(
label: 'Delete',
button: true,
onTap: () => _pop(),
child: TextButton( child: TextButton(
onPressed: () => _pop(), onPressed: () => _pop(),
style: TextButton.styleFrom( style: TextButton.styleFrom(
@ -261,6 +230,8 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
), ),
child: deleteIconImage, child: deleteIconImage,
), ),
),
),
); );
} else { } else {
index++; index++;

View file

@ -41,26 +41,7 @@ class ReceivePage extends BasePage {
final FocusNode _cryptoAmountFocus; final FocusNode _cryptoAmountFocus;
@override @override
Widget leading(BuildContext context) { Color get titleColor => Colors.white;
final _backButton = Icon(Icons.arrow_back_ios,
color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!,
size: 16,);
return SizedBox(
height: 37,
width: 37,
child: ButtonTheme(
minWidth: double.minPositive,
child: TextButton(
// FIX-ME: Style
//highlightColor: Colors.transparent,
//splashColor: Colors.transparent,
//padding: EdgeInsets.all(0),
onPressed: () => onClose(context),
child: _backButton),
),
);
}
@override @override
Widget middle(BuildContext context) { Widget middle(BuildContext context) {
@ -93,6 +74,8 @@ class ReceivePage extends BasePage {
return Material( return Material(
color: Colors.transparent, color: Colors.transparent,
child: Semantics(
label: 'Share',
child: IconButton( child: IconButton(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
constraints: BoxConstraints(), constraints: BoxConstraints(),
@ -106,6 +89,7 @@ class ReceivePage extends BasePage {
); );
}, },
icon: shareImage icon: shareImage
),
) )
); );
} }

View file

@ -70,11 +70,16 @@ class AddressCell extends StatelessWidget {
), ),
), ),
)); ));
return Slidable( return Semantics(
label: 'Slidable',
selected: isCurrent,
enabled: !isCurrent,
child: Slidable(
key: Key(address), key: Key(address),
startActionPane: _actionPane(context), startActionPane: _actionPane(context),
endActionPane: _actionPane(context), endActionPane: _actionPane(context),
child: cell, child: cell,
),
); );
} }

View file

@ -41,9 +41,13 @@ class ConnectionSyncPage extends BasePage {
handler: (context) => Navigator.of(context).pushNamed(Routes.rescan), handler: (context) => Navigator.of(context).pushNamed(Routes.rescan),
), ),
StandardListSeparator(padding: EdgeInsets.symmetric(horizontal: 24)), StandardListSeparator(padding: EdgeInsets.symmetric(horizontal: 24)),
NodeHeaderListRow( Semantics(
button: true,
child: NodeHeaderListRow(
title: S.of(context).add_new_node, title: S.of(context).add_new_node,
onTap: (_) async => await Navigator.of(context).pushNamed(Routes.newNode), onTap: (_) async =>
await Navigator.of(context).pushNamed(Routes.newNode),
),
), ),
StandardListSeparator(padding: EdgeInsets.symmetric(horizontal: 24)), StandardListSeparator(padding: EdgeInsets.symmetric(horizontal: 24)),
SizedBox(height: 100), SizedBox(height: 100),
@ -60,7 +64,11 @@ class ConnectionSyncPage extends BasePage {
itemBuilder: (_, sectionIndex, index) { itemBuilder: (_, sectionIndex, index) {
final node = nodeListViewModel.nodes[index]; final node = nodeListViewModel.nodes[index];
final isSelected = node.keyIndex == nodeListViewModel.currentNode.keyIndex; final isSelected = node.keyIndex == nodeListViewModel.currentNode.keyIndex;
final nodeListRow = NodeListRow( final nodeListRow = Semantics(
label: 'Slidable',
selected: isSelected,
enabled: !isSelected,
child: NodeListRow(
title: node.uriRaw, title: node.uriRaw,
isSelected: isSelected, isSelected: isSelected,
isAlive: node.requestNode(), isAlive: node.requestNode(),
@ -73,11 +81,14 @@ class ConnectionSyncPage extends BasePage {
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertWithTwoActions( return AlertWithTwoActions(
alertTitle: S.of(context).change_current_node_title, alertTitle:
alertContent: nodeListViewModel.getAlertContent(node.uriRaw), S.of(context).change_current_node_title,
alertContent: nodeListViewModel
.getAlertContent(node.uriRaw),
leftButtonText: S.of(context).cancel, leftButtonText: S.of(context).cancel,
rightButtonText: S.of(context).change, rightButtonText: S.of(context).change,
actionLeftButton: () => Navigator.of(context).pop(), actionLeftButton: () =>
Navigator.of(context).pop(),
actionRightButton: () async { actionRightButton: () async {
await nodeListViewModel.setAsCurrent(node); await nodeListViewModel.setAsCurrent(node);
Navigator.of(context).pop(); Navigator.of(context).pop();
@ -85,6 +96,7 @@ class ConnectionSyncPage extends BasePage {
); );
}); });
}, },
),
); );
final dismissibleRow = Slidable( final dismissibleRow = Slidable(

View file

@ -33,6 +33,7 @@ class IntroducingCard extends StatelessWidget {
children: [ children: [
Expanded( Expanded(
flex: 1, flex: 1,
child: MergeSemantics(
child: Padding( child: Padding(
padding: const EdgeInsets.all(24), padding: const EdgeInsets.all(24),
child: Column( child: Column(
@ -65,8 +66,11 @@ class IntroducingCard extends StatelessWidget {
), ),
), ),
), ),
),
Padding( Padding(
padding: const EdgeInsets.fromLTRB(0,16,16,0), padding: const EdgeInsets.fromLTRB(0,16,16,0),
child: Semantics(
label: 'Close',
child: GestureDetector( child: GestureDetector(
onTap: closeCard, onTap: closeCard,
child: Container( child: Container(
@ -83,6 +87,7 @@ class IntroducingCard extends StatelessWidget {
)), )),
), ),
), ),
),
) )
], ],
), ),