Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 0c9323e

Browse files
authored
Expose GestureSettings on FlutterView (#39997)
1 parent 77bc544 commit 0c9323e

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

lib/ui/fixtures/ui_test.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,8 @@ void hooksTests() async {
624624

625625
expectEquals(window.viewConfiguration.gestureSettings,
626626
GestureSettings(physicalTouchSlop: 11.0));
627+
expectEquals(window.gestureSettings,
628+
GestureSettings(physicalTouchSlop: 11.0));
627629

628630
_callHook(
629631
'_updateWindowMetrics',
@@ -652,6 +654,8 @@ void hooksTests() async {
652654

653655
expectEquals(window.viewConfiguration.gestureSettings,
654656
GestureSettings(physicalTouchSlop: null));
657+
expectEquals(window.gestureSettings,
658+
GestureSettings(physicalTouchSlop: null));
655659

656660
_callHook(
657661
'_updateWindowMetrics',
@@ -680,6 +684,8 @@ void hooksTests() async {
680684

681685
expectEquals(window.viewConfiguration.gestureSettings,
682686
GestureSettings(physicalTouchSlop: 22.0));
687+
expectEquals(window.gestureSettings,
688+
GestureSettings(physicalTouchSlop: 22.0));
683689
});
684690

685691
await test('onLocaleChanged preserves callback zone', () {

lib/ui/window.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,13 @@ class FlutterView {
226226
/// applications.
227227
ViewPadding get padding => viewConfiguration.padding;
228228

229+
/// Additional configuration for touch gestures performed on this view.
230+
///
231+
/// For example, the touch slop defined in physical pixels may be provided
232+
/// by the gesture settings and should be preferred over the framework
233+
/// touch slop constant.
234+
GestureSettings get gestureSettings => viewConfiguration.gestureSettings;
235+
229236
/// {@macro dart.ui.ViewConfiguration.displayFeatures}
230237
///
231238
/// When this changes, [PlatformDispatcher.onMetricsChanged] is called.

lib/web_ui/lib/window.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ abstract class FlutterView {
1515
ViewPadding get viewPadding => viewConfiguration.viewPadding;
1616
ViewPadding get systemGestureInsets => viewConfiguration.systemGestureInsets;
1717
ViewPadding get padding => viewConfiguration.padding;
18+
GestureSettings get gestureSettings => viewConfiguration.gestureSettings;
1819
List<DisplayFeature> get displayFeatures => viewConfiguration.displayFeatures;
1920
void render(Scene scene) => platformDispatcher.render(scene, this);
2021
void updateSemantics(SemanticsUpdate update) => platformDispatcher.updateSemantics(update);

0 commit comments

Comments
 (0)