[go: nahoru, domu]

Skip to content

Commit

Permalink
Expose GestureSettings on FlutterView (flutter#39997)
Browse files Browse the repository at this point in the history
  • Loading branch information
goderbauer committed Mar 2, 2023
1 parent 77bc544 commit 0c9323e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/ui/fixtures/ui_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,8 @@ void hooksTests() async {

expectEquals(window.viewConfiguration.gestureSettings,
GestureSettings(physicalTouchSlop: 11.0));
expectEquals(window.gestureSettings,
GestureSettings(physicalTouchSlop: 11.0));

_callHook(
'_updateWindowMetrics',
Expand Down Expand Up @@ -652,6 +654,8 @@ void hooksTests() async {

expectEquals(window.viewConfiguration.gestureSettings,
GestureSettings(physicalTouchSlop: null));
expectEquals(window.gestureSettings,
GestureSettings(physicalTouchSlop: null));

_callHook(
'_updateWindowMetrics',
Expand Down Expand Up @@ -680,6 +684,8 @@ void hooksTests() async {

expectEquals(window.viewConfiguration.gestureSettings,
GestureSettings(physicalTouchSlop: 22.0));
expectEquals(window.gestureSettings,
GestureSettings(physicalTouchSlop: 22.0));
});

await test('onLocaleChanged preserves callback zone', () {
Expand Down
7 changes: 7 additions & 0 deletions lib/ui/window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@ class FlutterView {
/// applications.
ViewPadding get padding => viewConfiguration.padding;

/// Additional configuration for touch gestures performed on this view.
///
/// For example, the touch slop defined in physical pixels may be provided
/// by the gesture settings and should be preferred over the framework
/// touch slop constant.
GestureSettings get gestureSettings => viewConfiguration.gestureSettings;

/// {@macro dart.ui.ViewConfiguration.displayFeatures}
///
/// When this changes, [PlatformDispatcher.onMetricsChanged] is called.
Expand Down
1 change: 1 addition & 0 deletions lib/web_ui/lib/window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ abstract class FlutterView {
ViewPadding get viewPadding => viewConfiguration.viewPadding;
ViewPadding get systemGestureInsets => viewConfiguration.systemGestureInsets;
ViewPadding get padding => viewConfiguration.padding;
GestureSettings get gestureSettings => viewConfiguration.gestureSettings;
List<DisplayFeature> get displayFeatures => viewConfiguration.displayFeatures;
void render(Scene scene) => platformDispatcher.render(scene, this);
void updateSemantics(SemanticsUpdate update) => platformDispatcher.updateSemantics(update);
Expand Down

0 comments on commit 0c9323e

Please sign in to comment.