From baa45a1718e732d0df317766f879f3e7d1b8de2a Mon Sep 17 00:00:00 2001 From: chunhtai <47866232+chunhtai@users.noreply.github.com> Date: Thu, 31 Mar 2022 10:45:41 -0700 Subject: [PATCH] Revert "Allow unknown device kind to scroll scrollables (#100800)" (#101129) This reverts commit 000f4d1590322cc229072a6e9616051cab074286. --- .../lib/src/widgets/scroll_configuration.dart | 3 -- .../test/widgets/scroll_behavior_test.dart | 1 - .../flutter/test/widgets/scrollable_test.dart | 29 ------------------- 3 files changed, 33 deletions(-) diff --git a/packages/flutter/lib/src/widgets/scroll_configuration.dart b/packages/flutter/lib/src/widgets/scroll_configuration.dart index 947efaac38..7b0a85b5ef 100644 --- a/packages/flutter/lib/src/widgets/scroll_configuration.dart +++ b/packages/flutter/lib/src/widgets/scroll_configuration.dart @@ -19,9 +19,6 @@ const Set _kTouchLikeDeviceTypes = { PointerDeviceKind.touch, PointerDeviceKind.stylus, PointerDeviceKind.invertedStylus, - // The VoiceAccess sends pointer events with unknown type when scrolling - // scrollables. - PointerDeviceKind.unknown, }; /// The default overscroll indicator applied on [TargetPlatform.android]. diff --git a/packages/flutter/test/widgets/scroll_behavior_test.dart b/packages/flutter/test/widgets/scroll_behavior_test.dart index 99a97a8c17..a1f6afa0a2 100644 --- a/packages/flutter/test/widgets/scroll_behavior_test.dart +++ b/packages/flutter/test/widgets/scroll_behavior_test.dart @@ -134,7 +134,6 @@ void main() { PointerDeviceKind.touch, PointerDeviceKind.stylus, PointerDeviceKind.invertedStylus, - PointerDeviceKind.unknown, }); // Use copyWith to modify drag devices diff --git a/packages/flutter/test/widgets/scrollable_test.dart b/packages/flutter/test/widgets/scrollable_test.dart index 99082034bd..1e21d2ba87 100644 --- a/packages/flutter/test/widgets/scrollable_test.dart +++ b/packages/flutter/test/widgets/scrollable_test.dart @@ -1273,35 +1273,6 @@ void main() { expect(tester.takeException(), null); }); - testWidgets('Accepts drag with unknown device kind by default', (WidgetTester tester) async { - // Regression test for https://github.com/flutter/flutter/issues/90912. - await tester.pumpWidget( - const MaterialApp( - home: CustomScrollView( - slivers: [ - SliverToBoxAdapter(child: SizedBox(height: 2000.0)), - ], - ), - ) - ); - final TestGesture gesture = await tester.startGesture(tester.getCenter(find.byType(Scrollable), warnIfMissed: true), kind: ui.PointerDeviceKind.unknown); - expect(getScrollOffset(tester), 0.0); - await gesture.moveBy(const Offset(0.0, -200)); - await tester.pump(); - await tester.pumpAndSettle(); - - expect(getScrollOffset(tester), 200); - - await gesture.moveBy(const Offset(0.0, 200)); - await tester.pump(); - await tester.pumpAndSettle(); - - expect(getScrollOffset(tester), 0.0); - - await gesture.removePointer(); - await tester.pump(); - }, variant: const TargetPlatformVariant({ TargetPlatform.iOS, TargetPlatform.macOS, TargetPlatform.android })); - testWidgets('Does not scroll with mouse pointer drag when behavior is configured to ignore them', (WidgetTester tester) async { await pumpTest(tester, debugDefaultTargetPlatformOverride, enableMouseDrag: false); final TestGesture gesture = await tester.startGesture(tester.getCenter(find.byType(Scrollable), warnIfMissed: true), kind: ui.PointerDeviceKind.mouse);