mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 11:39:22 +00:00
Cw 567 cant swipe through menus on desktop builds (#1563)
* MaterialApp scrollBehavior * accessibility improvements
This commit is contained in:
parent
9c29dbd6fd
commit
b412d45f0e
7 changed files with 75 additions and 37 deletions
9
lib/app_scroll_behavior.dart
Normal file
9
lib/app_scroll_behavior.dart
Normal 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};
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:cake_wallet/anonpay/anonpay_invoice_info.dart';
|
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/buy/order.dart';
|
||||||
import 'package:cake_wallet/core/auth_service.dart';
|
import 'package:cake_wallet/core/auth_service.dart';
|
||||||
import 'package:cake_wallet/di.dart';
|
import 'package:cake_wallet/di.dart';
|
||||||
|
@ -75,6 +76,7 @@ Future<void> main() async {
|
||||||
runApp(
|
runApp(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
|
scrollBehavior: AppScrollBehavior(),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
child: Container(
|
child: Container(
|
||||||
|
@ -297,6 +299,7 @@ class AppState extends State<App> with SingleTickerProviderStateMixin {
|
||||||
locale: Locale(settingsStore.languageCode),
|
locale: Locale(settingsStore.languageCode),
|
||||||
onGenerateRoute: (settings) => Router.createRoute(settings),
|
onGenerateRoute: (settings) => Router.createRoute(settings),
|
||||||
initialRoute: initialRoute,
|
initialRoute: initialRoute,
|
||||||
|
scrollBehavior: AppScrollBehavior(),
|
||||||
home: _Home(),
|
home: _Home(),
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
|
@ -237,7 +237,11 @@ class _DashboardPageView extends BasePage {
|
||||||
padding: EdgeInsets.only(bottom: 24, top: 10),
|
padding: EdgeInsets.only(bottom: 24, top: 10),
|
||||||
child: Observer(
|
child: Observer(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return ExcludeSemantics(
|
return Semantics(
|
||||||
|
button: false,
|
||||||
|
label: 'Page Indicator',
|
||||||
|
hint: 'Swipe to change page',
|
||||||
|
excludeSemantics: true,
|
||||||
child: SmoothPageIndicator(
|
child: SmoothPageIndicator(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
count: pages.length,
|
count: pages.length,
|
||||||
|
|
|
@ -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:cake_wallet/view_model/dashboard/nft_view_model.dart';
|
||||||
import 'package:cw_core/crypto_currency.dart';
|
import 'package:cw_core/crypto_currency.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
|
@ -469,15 +470,19 @@ class BalanceRowWidget extends StatelessWidget {
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text('${availableBalanceLabel}',
|
Semantics(
|
||||||
style: TextStyle(
|
hint: 'Double tap to see more information',
|
||||||
fontSize: 12,
|
container: true,
|
||||||
fontFamily: 'Lato',
|
child: Text('${availableBalanceLabel}',
|
||||||
fontWeight: FontWeight.w400,
|
style: TextStyle(
|
||||||
color: Theme.of(context)
|
fontSize: 12,
|
||||||
.extension<BalancePageTheme>()!
|
fontFamily: 'Lato',
|
||||||
.labelTextColor,
|
fontWeight: FontWeight.w400,
|
||||||
height: 1)),
|
color: Theme.of(context)
|
||||||
|
.extension<BalancePageTheme>()!
|
||||||
|
.labelTextColor,
|
||||||
|
height: 1)),
|
||||||
|
),
|
||||||
if (hasAdditionalBalance)
|
if (hasAdditionalBalance)
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||||
|
|
|
@ -177,16 +177,22 @@ class WalletRestorePage extends BasePage {
|
||||||
if (_pages.length > 1)
|
if (_pages.length > 1)
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(top: 10),
|
padding: EdgeInsets.only(top: 10),
|
||||||
child: SmoothPageIndicator(
|
child: Semantics(
|
||||||
controller: _controller,
|
button: false,
|
||||||
count: _pages.length,
|
label: 'Page Indicator',
|
||||||
effect: ColorTransitionEffect(
|
hint: 'Swipe to change restore mode',
|
||||||
spacing: 6.0,
|
excludeSemantics: true,
|
||||||
radius: 6.0,
|
child: SmoothPageIndicator(
|
||||||
dotWidth: 6.0,
|
controller: _controller,
|
||||||
dotHeight: 6.0,
|
count: _pages.length,
|
||||||
dotColor: Theme.of(context).hintColor.withOpacity(0.5),
|
effect: ColorTransitionEffect(
|
||||||
activeDotColor: Theme.of(context).hintColor,
|
spacing: 6.0,
|
||||||
|
radius: 6.0,
|
||||||
|
dotWidth: 6.0,
|
||||||
|
dotHeight: 6.0,
|
||||||
|
dotColor: Theme.of(context).hintColor.withOpacity(0.5),
|
||||||
|
activeDotColor: Theme.of(context).hintColor,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -212,7 +212,12 @@ class SendPage extends BasePage {
|
||||||
final count = sendViewModel.outputs.length;
|
final count = sendViewModel.outputs.length;
|
||||||
|
|
||||||
return count > 1
|
return count > 1
|
||||||
? SmoothPageIndicator(
|
? Semantics (
|
||||||
|
label: 'Page Indicator',
|
||||||
|
hint: 'Swipe to change receiver',
|
||||||
|
excludeSemantics: true,
|
||||||
|
child:
|
||||||
|
SmoothPageIndicator(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
count: count,
|
count: count,
|
||||||
effect: ScrollingDotsEffect(
|
effect: ScrollingDotsEffect(
|
||||||
|
@ -226,7 +231,7 @@ class SendPage extends BasePage {
|
||||||
activeDotColor: Theme.of(context)
|
activeDotColor: Theme.of(context)
|
||||||
.extension<SendPageTheme>()!
|
.extension<SendPageTheme>()!
|
||||||
.templateBackgroundColor),
|
.templateBackgroundColor),
|
||||||
)
|
))
|
||||||
: Offstage();
|
: Offstage();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
@ -94,21 +94,27 @@ class SendTemplatePage extends BasePage {
|
||||||
final count = sendTemplateViewModel.recipients.length;
|
final count = sendTemplateViewModel.recipients.length;
|
||||||
|
|
||||||
return count > 1
|
return count > 1
|
||||||
? SmoothPageIndicator(
|
? Semantics(
|
||||||
controller: controller,
|
button: false,
|
||||||
count: count,
|
label: 'Page Indicator',
|
||||||
effect: ScrollingDotsEffect(
|
hint: 'Swipe to change receiver',
|
||||||
spacing: 6.0,
|
excludeSemantics: true,
|
||||||
radius: 6.0,
|
child: SmoothPageIndicator(
|
||||||
dotWidth: 6.0,
|
controller: controller,
|
||||||
dotHeight: 6.0,
|
count: count,
|
||||||
dotColor: Theme.of(context)
|
effect: ScrollingDotsEffect(
|
||||||
.extension<SendPageTheme>()!
|
spacing: 6.0,
|
||||||
.indicatorDotColor,
|
radius: 6.0,
|
||||||
activeDotColor: Theme.of(context)
|
dotWidth: 6.0,
|
||||||
.extension<DashboardPageTheme>()!
|
dotHeight: 6.0,
|
||||||
.indicatorDotTheme
|
dotColor: Theme.of(context)
|
||||||
.activeIndicatorColor))
|
.extension<SendPageTheme>()!
|
||||||
|
.indicatorDotColor,
|
||||||
|
activeDotColor: Theme.of(context)
|
||||||
|
.extension<DashboardPageTheme>()!
|
||||||
|
.indicatorDotTheme
|
||||||
|
.activeIndicatorColor)),
|
||||||
|
)
|
||||||
: Offstage();
|
: Offstage();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue