Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: document MapPosition/PositionCallback.hasGesture in-code #1973

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/src/map/options/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ typedef PointerHoverCallback = void Function(
);

/// Callback that gets called when the viewport of the map changes.
///
/// {@macro map_position.has_gesture}
typedef PositionCallback = void Function(MapCamera camera, bool hasGesture);

/// All options for the [FlutterMap] widget.
Expand Down
12 changes: 12 additions & 0 deletions lib/src/misc/position.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ class MapPosition {
final LatLng? center;
final LatLngBounds? bounds;
final double? zoom;

/// {@template map_position.has_gesture}
/// [hasGesture] determines if the change was caused by a user gesture (interaction with the map) or not.
///
/// For example, if the user panned out the map, then [hasGesture] would be true because the change was
/// caused by a user gesture. On the other hand, if the map's position was changed using the map's
/// controller, then [hasGesture] would be false because the change was not caused by a user gesture,
/// but programmatically.
/// {@endtemplate}
final bool hasGesture;

const MapPosition({
Expand All @@ -29,4 +38,7 @@ class MapPosition {
other.zoom == zoom;
}

/// Callback that gets called when the map's position changes.
///
/// {@macro map_position.has_gesture}
typedef PositionCallback = void Function(MapPosition position, bool hasGesture);
Loading