Cw 567 cant swipe through menus on desktop builds (#1563)

* MaterialApp scrollBehavior

* accessibility improvements
This commit is contained in:
Serhii 2024-08-10 01:21:26 +03:00 committed by GitHub
parent 9c29dbd6fd
commit b412d45f0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 75 additions and 37 deletions

View file

@ -0,0 +1,9 @@
import 'dart:ui';
import 'package:flutter/material.dart';
class AppScrollBehavior extends MaterialScrollBehavior {
@override
Set<PointerDeviceKind> get dragDevices =>
{PointerDeviceKind.touch, PointerDeviceKind.mouse, PointerDeviceKind.trackpad};
}

View file

@ -1,5 +1,6 @@
import 'dart:async';
import 'package:cake_wallet/anonpay/anonpay_invoice_info.dart';
import 'package:cake_wallet/app_scroll_behavior.dart';
import 'package:cake_wallet/buy/order.dart';
import 'package:cake_wallet/core/auth_service.dart';
import 'package:cake_wallet/di.dart';
@ -75,6 +76,7 @@ Future<void> main() async {
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
scrollBehavior: AppScrollBehavior(),
home: Scaffold(
body: SingleChildScrollView(
child: Container(
@ -297,6 +299,7 @@ class AppState extends State<App> with SingleTickerProviderStateMixin {
locale: Locale(settingsStore.languageCode),
onGenerateRoute: (settings) => Router.createRoute(settings),
initialRoute: initialRoute,
scrollBehavior: AppScrollBehavior(),
home: _Home(),
));
});

View file

@ -237,7 +237,11 @@ class _DashboardPageView extends BasePage {
padding: EdgeInsets.only(bottom: 24, top: 10),
child: Observer(
builder: (context) {
return ExcludeSemantics(
return Semantics(
button: false,
label: 'Page Indicator',
hint: 'Swipe to change page',
excludeSemantics: true,
child: SmoothPageIndicator(
controller: controller,
count: pages.length,

View file

@ -23,6 +23,7 @@ import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:cake_wallet/view_model/dashboard/nft_view_model.dart';
import 'package:cw_core/crypto_currency.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:url_launcher/url_launcher.dart';
@ -469,7 +470,10 @@ class BalanceRowWidget extends StatelessWidget {
children: [
Row(
children: [
Text('${availableBalanceLabel}',
Semantics(
hint: 'Double tap to see more information',
container: true,
child: Text('${availableBalanceLabel}',
style: TextStyle(
fontSize: 12,
fontFamily: 'Lato',
@ -478,6 +482,7 @@ class BalanceRowWidget extends StatelessWidget {
.extension<BalancePageTheme>()!
.labelTextColor,
height: 1)),
),
if (hasAdditionalBalance)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),

View file

@ -177,6 +177,11 @@ class WalletRestorePage extends BasePage {
if (_pages.length > 1)
Padding(
padding: EdgeInsets.only(top: 10),
child: Semantics(
button: false,
label: 'Page Indicator',
hint: 'Swipe to change restore mode',
excludeSemantics: true,
child: SmoothPageIndicator(
controller: _controller,
count: _pages.length,
@ -190,6 +195,7 @@ class WalletRestorePage extends BasePage {
),
),
),
),
Padding(
padding: EdgeInsets.only(top: 20, bottom: 24, left: 24, right: 24),
child: Column(

View file

@ -212,7 +212,12 @@ class SendPage extends BasePage {
final count = sendViewModel.outputs.length;
return count > 1
? SmoothPageIndicator(
? Semantics (
label: 'Page Indicator',
hint: 'Swipe to change receiver',
excludeSemantics: true,
child:
SmoothPageIndicator(
controller: controller,
count: count,
effect: ScrollingDotsEffect(
@ -226,7 +231,7 @@ class SendPage extends BasePage {
activeDotColor: Theme.of(context)
.extension<SendPageTheme>()!
.templateBackgroundColor),
)
))
: Offstage();
},
),

View file

@ -94,7 +94,12 @@ class SendTemplatePage extends BasePage {
final count = sendTemplateViewModel.recipients.length;
return count > 1
? SmoothPageIndicator(
? Semantics(
button: false,
label: 'Page Indicator',
hint: 'Swipe to change receiver',
excludeSemantics: true,
child: SmoothPageIndicator(
controller: controller,
count: count,
effect: ScrollingDotsEffect(
@ -108,7 +113,8 @@ class SendTemplatePage extends BasePage {
activeDotColor: Theme.of(context)
.extension<DashboardPageTheme>()!
.indicatorDotTheme
.activeIndicatorColor))
.activeIndicatorColor)),
)
: Offstage();
},
),