Migrate to FlutterView.gestureSettings (#121749)

This commit is contained in:
Michael Goderbauer
2023-03-02 10:17:29 -08:00
committed by GitHub
parent 5cf1e5f773
commit 92a1a8ba09
4 changed files with 25 additions and 11 deletions

View File

@@ -143,6 +143,20 @@ class TestWindow implements ui.SingletonFlutterWindow {
onMetricsChanged?.call();
}
@override
ui.GestureSettings get gestureSettings => _gestureSettings ?? _window.gestureSettings;
ui.GestureSettings? _gestureSettings;
/// Hides the real gesture settings and reports the given [gestureSettingsTestValue] instead.
set gestureSettingsTestValue(ui.GestureSettings gestureSettingsTestValue) { // ignore: avoid_setters_without_getters
_gestureSettings = gestureSettingsTestValue;
onMetricsChanged?.call();
}
/// Deletes any existing test gesture settings and returns to using the real gesture settings.
void clearGestureSettingsTestValue() {
_paddingTestValue = null;
onMetricsChanged?.call();
}
@override
List<ui.DisplayFeature> get displayFeatures => _displayFeaturesTestValue ?? _window.displayFeatures;
List<ui.DisplayFeature>? _displayFeaturesTestValue;
@@ -508,6 +522,7 @@ class TestWindow implements ui.SingletonFlutterWindow {
void clearAllTestValues() {
clearDevicePixelRatioTestValue();
clearPaddingTestValue();
clearGestureSettingsTestValue();
clearDisplayFeaturesTestValue();
clearPhysicalSizeTestValue();
clearViewInsetsTestValue();