Skip to content

Commit 870aeea

Browse files
Remove absorbPanEventsOnScrollables option (#1455)
* Remove absorbPanEventsOnScrollables option The only reason this has been kept around is because some plugins which used drag gestures relied on it. It turns out if those plugins detect vertical/horizontal drag instead of pan this flag is not necessary. * Remove unnecessary comments
1 parent ac15548 commit 870aeea

File tree

3 files changed

+7
-43
lines changed

3 files changed

+7
-43
lines changed

example/lib/pages/map_inside_listview.dart

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ class MapInsideListViewPage extends StatelessWidget {
2323
height: 300,
2424
child: FlutterMap(
2525
options: MapOptions(
26-
absorbPanEventsOnScrollables: true,
2726
center: LatLng(51.5, -0.09),
2827
zoom: 5,
2928
),

lib/flutter_map.dart

-3
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,6 @@ class MapOptions {
251251
/// see [InteractiveFlag] for custom settings
252252
final int interactiveFlags;
253253

254-
final bool absorbPanEventsOnScrollables;
255-
256254
final TapCallback? onTap;
257255
final TapCallback? onSecondaryTap;
258256
final LongPressCallback? onLongPress;
@@ -293,7 +291,6 @@ class MapOptions {
293291
final bool keepAlive;
294292

295293
MapOptions({
296-
this.absorbPanEventsOnScrollables = true,
297294
this.crs = const Epsg3857(),
298295
LatLng? center,
299296
this.bounds,

lib/src/map/flutter_map_state.dart

+7-39
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
import 'dart:math' as math;
2+
13
import 'package:flutter/gestures.dart';
24
import 'package:flutter/material.dart';
35
import 'package:flutter/widgets.dart';
46
import 'package:flutter_map/flutter_map.dart';
7+
import 'package:flutter_map/src/core/bounds.dart';
58
import 'package:flutter_map/src/gestures/gestures.dart';
69
import 'package:flutter_map/src/map/map.dart';
710
import 'package:flutter_map/src/map/map_state_widget.dart';
811
import 'package:latlong2/latlong.dart';
9-
import 'dart:math' as math;
10-
import 'package:flutter_map/src/core/bounds.dart';
1112

1213
class FlutterMapState extends MapGestureMixin
1314
with AutomaticKeepAliveClientMixin {
@@ -72,14 +73,6 @@ class FlutterMapState extends MapGestureMixin
7273
..onTap = _positionedTapController.onTap
7374
..onSecondaryTap = _positionedTapController.onSecondaryTap
7475
..onSecondaryTapDown = _positionedTapController.onTapDown;
75-
// ..onTapCancel = onTapCancel
76-
// ..onSecondaryTapUp = onSecondaryTapUp
77-
// ..onSecondaryTapCancel = onSecondaryTapCancel
78-
// ..onTertiaryTapDown = onTertiaryTapDown
79-
// ..onTertiaryTapUp = onTertiaryTapUp
80-
// ..onTertiaryTapCancel = onTertiaryTapCancel
81-
// ..gestureSettings = gestureSettings;
82-
// instance.team = _team;
8376
},
8477
);
8578

@@ -88,42 +81,18 @@ class FlutterMapState extends MapGestureMixin
8881
() => LongPressGestureRecognizer(debugOwner: this),
8982
(LongPressGestureRecognizer instance) {
9083
instance.onLongPress = _positionedTapController.onLongPress;
91-
// ..onLongPressDown = onLongPressDown
92-
// ..onLongPressCancel = onLongPressCancel
93-
// ..onLongPressStart = onLongPressStart
94-
// ..onLongPressMoveUpdate = onLongPressMoveUpdate
95-
// ..onLongPressUp = onLongPressUp
96-
// ..onLongPressEnd = onLongPressEnd
97-
// ..onSecondaryLongPressDown = onSecondaryLongPressDown
98-
// ..onSecondaryLongPressCancel = onSecondaryLongPressCancel
99-
// ..onSecondaryLongPress = onSecondaryLongPress
100-
// ..onSecondaryLongPressStart = onSecondaryLongPressStart
101-
// ..onSecondaryLongPressMoveUpdate = onSecondaryLongPressMoveUpdate
102-
// ..onSecondaryLongPressUp = onSecondaryLongPressUp
103-
// ..onSecondaryLongPressEnd = onSecondaryLongPressEnd
104-
// ..onTertiaryLongPressDown = onTertiaryLongPressDown
105-
// ..onTertiaryLongPressCancel = onTertiaryLongPressCancel
106-
// ..onTertiaryLongPress = onTertiaryLongPress
107-
// ..onTertiaryLongPressStart = onTertiaryLongPressStart
108-
// ..onTertiaryLongPressMoveUpdate = onTertiaryLongPressMoveUpdate
109-
// ..onTertiaryLongPressUp = onTertiaryLongPressUp
110-
// ..onTertiaryLongPressEnd = onTertiaryLongPressEnd
111-
// ..gestureSettings = gestureSettings;
112-
// instance.team = _team;
11384
},
11485
);
11586

116-
if (options.absorbPanEventsOnScrollables &&
117-
InteractiveFlag.hasFlag(
118-
options.interactiveFlags, InteractiveFlag.drag)) {
87+
if (InteractiveFlag.hasFlag(
88+
options.interactiveFlags, InteractiveFlag.drag)) {
11989
gestures[VerticalDragGestureRecognizer] =
12090
GestureRecognizerFactoryWithHandlers<VerticalDragGestureRecognizer>(
12191
() => VerticalDragGestureRecognizer(debugOwner: this),
12292
(VerticalDragGestureRecognizer instance) {
12393
instance.onUpdate = (details) {
124-
//Absorbing vertical drags
94+
// Absorbing vertical drags
12595
};
126-
// ..dragStartBehavior = dragStartBehavior
12796
instance.gestureSettings = gestureSettings;
12897
instance.team ??= _team;
12998
},
@@ -133,9 +102,8 @@ class FlutterMapState extends MapGestureMixin
133102
() => HorizontalDragGestureRecognizer(debugOwner: this),
134103
(HorizontalDragGestureRecognizer instance) {
135104
instance.onUpdate = (details) {
136-
//Absorbing horizontal drags
105+
// Absorbing horizontal drags
137106
};
138-
// ..dragStartBehavior = dragStartBehavior
139107
instance.gestureSettings = gestureSettings;
140108
instance.team ??= _team;
141109
},

0 commit comments

Comments
 (0)