diff --git a/packages/flutter/lib/src/gestures/converter.dart b/packages/flutter/lib/src/gestures/converter.dart index 561c75320e..0cae6b1cbf 100644 --- a/packages/flutter/lib/src/gestures/converter.dart +++ b/packages/flutter/lib/src/gestures/converter.dart @@ -21,6 +21,8 @@ int _synthesiseDownButtons(int buttons, PointerDeviceKind kind) { case PointerDeviceKind.invertedStylus: return buttons == 0 ? kPrimaryButton : buttons; case PointerDeviceKind.unknown: + default: // ignore: no_default_cases, to allow adding new device types to [PointerDeviceKind] + // TODO(moffatman): Remove after landing https://github.com/flutter/flutter/issues/23604 // We have no information about the device but we know we never want // buttons to be 0 when the pointer is down. return buttons == 0 ? kPrimaryButton : buttons; @@ -207,6 +209,9 @@ class PointerEventConverter { radiusMax: radiusMax, embedderId: datum.embedderId, ); + default: // ignore: no_default_cases, to allow adding new pointer events to [ui.PointerChange] + // TODO(moffatman): Remove after landing https://github.com/flutter/flutter/issues/23604 + throw StateError('Unreachable'); } case ui.PointerSignalKind.scroll: final Offset scrollDelta = diff --git a/packages/flutter/lib/src/gestures/events.dart b/packages/flutter/lib/src/gestures/events.dart index eb7fdf0666..3af55bae98 100644 --- a/packages/flutter/lib/src/gestures/events.dart +++ b/packages/flutter/lib/src/gestures/events.dart @@ -2108,6 +2108,8 @@ double computeHitSlop(PointerDeviceKind kind, DeviceGestureSettings? settings) { case PointerDeviceKind.invertedStylus: case PointerDeviceKind.unknown: case PointerDeviceKind.touch: + default: // ignore: no_default_cases, to allow adding new device types to [PointerDeviceKind] + // TODO(moffatman): Remove after landing https://github.com/flutter/flutter/issues/23604 return settings?.touchSlop ?? kTouchSlop; } } @@ -2121,6 +2123,8 @@ double computePanSlop(PointerDeviceKind kind, DeviceGestureSettings? settings) { case PointerDeviceKind.invertedStylus: case PointerDeviceKind.unknown: case PointerDeviceKind.touch: + default: // ignore: no_default_cases, to allow adding new device types to [PointerDeviceKind] + // TODO(moffatman): Remove after landing https://github.com/flutter/flutter/issues/23604 return settings?.panSlop ?? kPanSlop; } } @@ -2134,6 +2138,8 @@ double computeScaleSlop(PointerDeviceKind kind) { case PointerDeviceKind.invertedStylus: case PointerDeviceKind.unknown: case PointerDeviceKind.touch: + default: // ignore: no_default_cases, to allow adding new device types to [PointerDeviceKind] + // TODO(moffatman): Remove after landing https://github.com/flutter/flutter/issues/23604 return kScaleSlop; } } diff --git a/packages/flutter/lib/src/services/platform_views.dart b/packages/flutter/lib/src/services/platform_views.dart index 897fca8dcd..cc2a5c9f0e 100644 --- a/packages/flutter/lib/src/services/platform_views.dart +++ b/packages/flutter/lib/src/services/platform_views.dart @@ -653,6 +653,8 @@ class _AndroidMotionEventConverter { toolType = AndroidPointerProperties.kToolTypeEraser; break; case PointerDeviceKind.unknown: + default: // ignore: no_default_cases, to allow adding new device types to [PointerDeviceKind] + // TODO(moffatman): Remove after landing https://github.com/flutter/flutter/issues/23604 toolType = AndroidPointerProperties.kToolTypeUnknown; break; } diff --git a/packages/flutter/lib/src/widgets/focus_manager.dart b/packages/flutter/lib/src/widgets/focus_manager.dart index 11111df78a..3a9d39f43b 100644 --- a/packages/flutter/lib/src/widgets/focus_manager.dart +++ b/packages/flutter/lib/src/widgets/focus_manager.dart @@ -1649,6 +1649,8 @@ class FocusManager with DiagnosticableTreeMixin, ChangeNotifier { break; case PointerDeviceKind.mouse: case PointerDeviceKind.unknown: + default: // ignore: no_default_cases, to allow adding new device types to [PointerDeviceKind] + // TODO(moffatman): Remove after landing https://github.com/flutter/flutter/issues/23604 _lastInteractionWasTouch = false; expectedMode = FocusHighlightMode.traditional; break; diff --git a/packages/flutter/lib/src/widgets/scrollbar.dart b/packages/flutter/lib/src/widgets/scrollbar.dart index 12d7dd94b3..24969c6d91 100644 --- a/packages/flutter/lib/src/widgets/scrollbar.dart +++ b/packages/flutter/lib/src/widgets/scrollbar.dart @@ -668,6 +668,8 @@ class ScrollbarPainter extends ChangeNotifier implements CustomPainter { case PointerDeviceKind.stylus: case PointerDeviceKind.invertedStylus: case PointerDeviceKind.unknown: + default: // ignore: no_default_cases, to allow adding new device types to [PointerDeviceKind] + // TODO(moffatman): Remove after landing https://github.com/flutter/flutter/issues/23604 return interactiveRect.contains(position); } } @@ -700,6 +702,8 @@ class ScrollbarPainter extends ChangeNotifier implements CustomPainter { case PointerDeviceKind.stylus: case PointerDeviceKind.invertedStylus: case PointerDeviceKind.unknown: + default: // ignore: no_default_cases, to allow adding new device types to [PointerDeviceKind] + // TODO(moffatman): Remove after landing https://github.com/flutter/flutter/issues/23604 return _thumbRect!.contains(position); } } @@ -1936,6 +1940,8 @@ class RawScrollbarState extends State with TickerProv case PointerDeviceKind.invertedStylus: case PointerDeviceKind.unknown: case PointerDeviceKind.touch: + default: // ignore: no_default_cases, to allow adding new device types to [PointerDeviceKind] + // TODO(moffatman): Remove after landing https://github.com/flutter/flutter/issues/23604 break; } }, @@ -1949,6 +1955,8 @@ class RawScrollbarState extends State with TickerProv case PointerDeviceKind.invertedStylus: case PointerDeviceKind.unknown: case PointerDeviceKind.touch: + default: // ignore: no_default_cases, to allow adding new device types to [PointerDeviceKind] + // TODO(moffatman): Remove after landing https://github.com/flutter/flutter/issues/23604 break; } }, diff --git a/packages/flutter/lib/src/widgets/text_selection.dart b/packages/flutter/lib/src/widgets/text_selection.dart index 4a24bf6279..4c737a70a0 100644 --- a/packages/flutter/lib/src/widgets/text_selection.dart +++ b/packages/flutter/lib/src/widgets/text_selection.dart @@ -1145,6 +1145,8 @@ class TextSelectionGestureDetectorBuilder { break; case PointerDeviceKind.touch: case PointerDeviceKind.unknown: + default: // ignore: no_default_cases, to allow adding new device types to [PointerDeviceKind] + // TODO(moffatman): Remove after landing https://github.com/flutter/flutter/issues/23604 // On macOS/iOS/iPadOS a touch tap places the cursor at the edge // of the word. renderEditable.selectWordEdge(cause: SelectionChangedCause.tap);