Limit desktops dragging to debug mode

This commit is contained in:
Shawn 2022-11-08 11:14:31 -07:00
parent 1c033f0763
commit c3034a5f97

View File

@ -1,17 +1,24 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:wonders/logic/common/platform_info.dart';
/// Add mouse drag on desktop for easier responsive testing
class AppScrollBehavior extends ScrollBehavior {
@override
// Add mouse drag on desktop for easier responsive testing
Set<PointerDeviceKind> get dragDevices {
return Set.from(super.dragDevices)..add(PointerDeviceKind.mouse);
final devices = Set<PointerDeviceKind>.from(super.dragDevices);
if (kDebugMode) {
devices.add(PointerDeviceKind.mouse);
}
return devices;
}
// Use bouncing physics on all platforms, better matches the design of the app
@override
ScrollPhysics getScrollPhysics(BuildContext context) => const BouncingScrollPhysics();
// TODO: Finalize scrollbar strategy (Do we use them at all? Where specifically?)
@override
Widget buildScrollbar(BuildContext context, Widget child, ScrollableDetails details) {
return child;