Allow unknown device kind to scroll scrollables (#100800)
This commit is contained in:
parent
91bcf4200e
commit
000f4d1590
@ -19,6 +19,9 @@ const Set<PointerDeviceKind> _kTouchLikeDeviceTypes = <PointerDeviceKind>{
|
|||||||
PointerDeviceKind.touch,
|
PointerDeviceKind.touch,
|
||||||
PointerDeviceKind.stylus,
|
PointerDeviceKind.stylus,
|
||||||
PointerDeviceKind.invertedStylus,
|
PointerDeviceKind.invertedStylus,
|
||||||
|
// The VoiceAccess sends pointer events with unknown type when scrolling
|
||||||
|
// scrollables.
|
||||||
|
PointerDeviceKind.unknown,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The default overscroll indicator applied on [TargetPlatform.android].
|
/// The default overscroll indicator applied on [TargetPlatform.android].
|
||||||
|
@ -134,6 +134,7 @@ void main() {
|
|||||||
PointerDeviceKind.touch,
|
PointerDeviceKind.touch,
|
||||||
PointerDeviceKind.stylus,
|
PointerDeviceKind.stylus,
|
||||||
PointerDeviceKind.invertedStylus,
|
PointerDeviceKind.invertedStylus,
|
||||||
|
PointerDeviceKind.unknown,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Use copyWith to modify drag devices
|
// Use copyWith to modify drag devices
|
||||||
|
@ -1273,6 +1273,35 @@ void main() {
|
|||||||
expect(tester.takeException(), null);
|
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: <Widget>[
|
||||||
|
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>{ TargetPlatform.iOS, TargetPlatform.macOS, TargetPlatform.android }));
|
||||||
|
|
||||||
testWidgets('Does not scroll with mouse pointer drag when behavior is configured to ignore them', (WidgetTester tester) async {
|
testWidgets('Does not scroll with mouse pointer drag when behavior is configured to ignore them', (WidgetTester tester) async {
|
||||||
await pumpTest(tester, debugDefaultTargetPlatformOverride, enableMouseDrag: false);
|
await pumpTest(tester, debugDefaultTargetPlatformOverride, enableMouseDrag: false);
|
||||||
final TestGesture gesture = await tester.startGesture(tester.getCenter(find.byType(Scrollable), warnIfMissed: true), kind: ui.PointerDeviceKind.mouse);
|
final TestGesture gesture = await tester.startGesture(tester.getCenter(find.byType(Scrollable), warnIfMissed: true), kind: ui.PointerDeviceKind.mouse);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user