mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 19:49:22 +00:00
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:
parent
9e7009f339
commit
5ad67b62a5
8 changed files with 230 additions and 226 deletions
|
@ -58,19 +58,24 @@ abstract class BasePage extends StatelessWidget {
|
|||
|
||||
bool isMobileView = ResponsiveLayoutUtil.instance.isMobile(context);
|
||||
|
||||
return SizedBox(
|
||||
return MergeSemantics(
|
||||
child: SizedBox(
|
||||
height: isMobileView ? 37 : 45,
|
||||
width: isMobileView ? 37 : 45,
|
||||
child: ButtonTheme(
|
||||
minWidth: double.minPositive,
|
||||
child: Semantics(
|
||||
label: canUseCloseIcon && !isMobileView ? 'Close' : 'Back',
|
||||
child: TextButton(
|
||||
style: ButtonStyle(
|
||||
overlayColor: MaterialStateColor.resolveWith((states) => Colors.transparent),
|
||||
overlayColor: MaterialStateColor.resolveWith(
|
||||
(states) => Colors.transparent),
|
||||
),
|
||||
onPressed: () => onClose(context),
|
||||
child: canUseCloseIcon && !isMobileView
|
||||
? _closeButton
|
||||
: _backButton,
|
||||
child:
|
||||
canUseCloseIcon && !isMobileView ? _closeButton : _backButton,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -104,7 +104,7 @@ class _DashboardPageView extends BasePage {
|
|||
//splashColor: Colors.transparent,
|
||||
//padding: EdgeInsets.all(0),
|
||||
onPressed: () => onOpenEndDrawer(),
|
||||
child: menuButton));
|
||||
child: Semantics(label: 'Menu', child: menuButton)));
|
||||
}
|
||||
|
||||
final DashboardViewModel dashboardViewModel;
|
||||
|
@ -149,7 +149,8 @@ class _DashboardPageView extends BasePage {
|
|||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 24, top: 10),
|
||||
child: Observer(builder: (context) {
|
||||
return SmoothPageIndicator(
|
||||
return ExcludeSemantics(
|
||||
child: SmoothPageIndicator(
|
||||
controller: controller,
|
||||
count: pages.length,
|
||||
effect: ColorTransitionEffect(
|
||||
|
@ -158,8 +159,11 @@ class _DashboardPageView extends BasePage {
|
|||
dotWidth: 6.0,
|
||||
dotHeight: 6.0,
|
||||
dotColor: Theme.of(context).indicatorColor,
|
||||
activeDotColor:
|
||||
Theme.of(context).accentTextTheme!.headline4!.backgroundColor!),
|
||||
activeDotColor: Theme.of(context)
|
||||
.accentTextTheme!
|
||||
.headline4!
|
||||
.backgroundColor!),
|
||||
),
|
||||
);
|
||||
}
|
||||
)),
|
||||
|
@ -184,11 +188,18 @@ class _DashboardPageView extends BasePage {
|
|||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: MainActions.all
|
||||
.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,
|
||||
height: 24,
|
||||
width: 24,
|
||||
color: action.isEnabled?.call(dashboardViewModel) ?? true
|
||||
color: action.isEnabled?.call(
|
||||
dashboardViewModel) ??
|
||||
true
|
||||
? Theme.of(context)
|
||||
.accentTextTheme
|
||||
.headline2!
|
||||
|
@ -198,13 +209,17 @@ class _DashboardPageView extends BasePage {
|
|||
.headline3!
|
||||
.backgroundColor!),
|
||||
title: action.name(context),
|
||||
onClick: () async => await action.onTap(context, dashboardViewModel),
|
||||
textColor: action.isEnabled?.call(dashboardViewModel) ?? true
|
||||
onClick: () async => await action.onTap(
|
||||
context, dashboardViewModel),
|
||||
textColor: action.isEnabled
|
||||
?.call(dashboardViewModel) ??
|
||||
true
|
||||
? null
|
||||
: Theme.of(context)
|
||||
.accentTextTheme
|
||||
.headline3!
|
||||
.backgroundColor!,
|
||||
),
|
||||
))
|
||||
.toList(),
|
||||
),
|
||||
|
@ -222,10 +237,14 @@ class _DashboardPageView extends BasePage {
|
|||
return;
|
||||
}
|
||||
if (dashboardViewModel.shouldShowMarketPlaceInDashboard) {
|
||||
pages.add(MarketPlacePage(dashboardViewModel: dashboardViewModel));
|
||||
pages.add(Semantics(
|
||||
label: 'Marketplace Page',
|
||||
child: MarketPlacePage(dashboardViewModel: dashboardViewModel)));
|
||||
}
|
||||
pages.add(balancePage);
|
||||
pages.add(TransactionsPage(dashboardViewModel: dashboardViewModel));
|
||||
pages.add(Semantics(label: 'Balance Page', child: balancePage));
|
||||
pages.add(Semantics(
|
||||
label: 'Transactions Page',
|
||||
child: TransactionsPage(dashboardViewModel: dashboardViewModel)));
|
||||
_isEffectsInstalled = true;
|
||||
|
||||
autorun((_) async {
|
||||
|
|
|
@ -139,7 +139,9 @@ class _WalletNameFormState extends State<WalletNameForm> {
|
|||
.decorationColor!,
|
||||
width: 1.0),
|
||||
),
|
||||
suffixIcon: IconButton(
|
||||
suffixIcon: Semantics(
|
||||
label: 'Generate Name',
|
||||
child: IconButton(
|
||||
onPressed: () async {
|
||||
final rName = await generateName();
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
|
@ -169,6 +171,7 @@ class _WalletNameFormState extends State<WalletNameForm> {
|
|||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
validator: WalletNameValidator(),
|
||||
),
|
||||
],
|
||||
|
|
|
@ -208,51 +208,20 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
|
|||
const double marginLeft = 15;
|
||||
|
||||
if (index == 9) {
|
||||
// Empty container
|
||||
return Container(
|
||||
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) {
|
||||
index = 0;
|
||||
} else if (index == 11) {
|
||||
return Container(
|
||||
return MergeSemantics(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: marginLeft, right: marginRight),
|
||||
child: Semantics(
|
||||
label: 'Delete',
|
||||
button: true,
|
||||
onTap: () => _pop(),
|
||||
child: TextButton(
|
||||
onPressed: () => _pop(),
|
||||
style: TextButton.styleFrom(
|
||||
|
@ -261,6 +230,8 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
|
|||
),
|
||||
child: deleteIconImage,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
index++;
|
||||
|
|
|
@ -41,26 +41,7 @@ class ReceivePage extends BasePage {
|
|||
final FocusNode _cryptoAmountFocus;
|
||||
|
||||
@override
|
||||
Widget leading(BuildContext context) {
|
||||
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),
|
||||
),
|
||||
);
|
||||
}
|
||||
Color get titleColor => Colors.white;
|
||||
|
||||
@override
|
||||
Widget middle(BuildContext context) {
|
||||
|
@ -93,6 +74,8 @@ class ReceivePage extends BasePage {
|
|||
|
||||
return Material(
|
||||
color: Colors.transparent,
|
||||
child: Semantics(
|
||||
label: 'Share',
|
||||
child: IconButton(
|
||||
padding: EdgeInsets.zero,
|
||||
constraints: BoxConstraints(),
|
||||
|
@ -106,6 +89,7 @@ class ReceivePage extends BasePage {
|
|||
);
|
||||
},
|
||||
icon: shareImage
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -70,11 +70,16 @@ class AddressCell extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
));
|
||||
return Slidable(
|
||||
return Semantics(
|
||||
label: 'Slidable',
|
||||
selected: isCurrent,
|
||||
enabled: !isCurrent,
|
||||
child: Slidable(
|
||||
key: Key(address),
|
||||
startActionPane: _actionPane(context),
|
||||
endActionPane: _actionPane(context),
|
||||
child: cell,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,9 +41,13 @@ class ConnectionSyncPage extends BasePage {
|
|||
handler: (context) => Navigator.of(context).pushNamed(Routes.rescan),
|
||||
),
|
||||
StandardListSeparator(padding: EdgeInsets.symmetric(horizontal: 24)),
|
||||
NodeHeaderListRow(
|
||||
Semantics(
|
||||
button: true,
|
||||
child: NodeHeaderListRow(
|
||||
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)),
|
||||
SizedBox(height: 100),
|
||||
|
@ -60,7 +64,11 @@ class ConnectionSyncPage extends BasePage {
|
|||
itemBuilder: (_, sectionIndex, index) {
|
||||
final node = nodeListViewModel.nodes[index];
|
||||
final isSelected = node.keyIndex == nodeListViewModel.currentNode.keyIndex;
|
||||
final nodeListRow = NodeListRow(
|
||||
final nodeListRow = Semantics(
|
||||
label: 'Slidable',
|
||||
selected: isSelected,
|
||||
enabled: !isSelected,
|
||||
child: NodeListRow(
|
||||
title: node.uriRaw,
|
||||
isSelected: isSelected,
|
||||
isAlive: node.requestNode(),
|
||||
|
@ -73,11 +81,14 @@ class ConnectionSyncPage extends BasePage {
|
|||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithTwoActions(
|
||||
alertTitle: S.of(context).change_current_node_title,
|
||||
alertContent: nodeListViewModel.getAlertContent(node.uriRaw),
|
||||
alertTitle:
|
||||
S.of(context).change_current_node_title,
|
||||
alertContent: nodeListViewModel
|
||||
.getAlertContent(node.uriRaw),
|
||||
leftButtonText: S.of(context).cancel,
|
||||
rightButtonText: S.of(context).change,
|
||||
actionLeftButton: () => Navigator.of(context).pop(),
|
||||
actionLeftButton: () =>
|
||||
Navigator.of(context).pop(),
|
||||
actionRightButton: () async {
|
||||
await nodeListViewModel.setAsCurrent(node);
|
||||
Navigator.of(context).pop();
|
||||
|
@ -85,6 +96,7 @@ class ConnectionSyncPage extends BasePage {
|
|||
);
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
final dismissibleRow = Slidable(
|
||||
|
|
|
@ -33,6 +33,7 @@ class IntroducingCard extends StatelessWidget {
|
|||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: MergeSemantics(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
|
@ -65,8 +66,11 @@ class IntroducingCard extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0,16,16,0),
|
||||
child: Semantics(
|
||||
label: 'Close',
|
||||
child: GestureDetector(
|
||||
onTap: closeCard,
|
||||
child: Container(
|
||||
|
@ -83,6 +87,7 @@ class IntroducingCard extends StatelessWidget {
|
|||
)),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue