Skip to content
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
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.4.0

* Adds options for gesture handling and tilt controls on web.
Comment thread
Rexios80 marked this conversation as resolved.

## 2.3.0

* Adds a `cloudMapId` parameter to support cloud-based map styling.
Expand Down Expand Up @@ -58,7 +62,7 @@

## 2.1.5

Removes dependency on `meta`.
* Removes dependency on `meta`.

## 2.1.4

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import 'package:flutter/widgets.dart';

import 'ui.dart';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing import 'ui.dart'; is great, thanks!

import '../../google_maps_flutter_platform_interface.dart';
Comment thread
Rexios80 marked this conversation as resolved.

/// Configuration options for the GoogleMaps user interface.
@immutable
Expand All @@ -15,6 +15,7 @@ class MapConfiguration {
/// as either a full configuration selection, or an update to an existing
/// configuration where only non-null values are updated.
const MapConfiguration({
this.webGestureHandling,
this.compassEnabled,
this.mapToolbarEnabled,
this.cameraTargetBounds,
Expand All @@ -23,6 +24,7 @@ class MapConfiguration {
this.rotateGesturesEnabled,
this.scrollGesturesEnabled,
this.tiltGesturesEnabled,
this.fortyFiveDegreeImageryEnabled,
this.trackCameraPosition,
this.zoomControlsEnabled,
this.zoomGesturesEnabled,
Expand All @@ -36,6 +38,11 @@ class MapConfiguration {
this.cloudMapId,
});

/// This setting controls how the API handles gestures on the map. Web only.
///
/// See [WebGestureHandling] for more details.
final WebGestureHandling? webGestureHandling;

/// True if the compass UI should be shown.
final bool? compassEnabled;

Expand All @@ -48,25 +55,34 @@ class MapConfiguration {
/// The type of the map.
final MapType? mapType;

/// The prefered zoom range.
/// The preferred zoom range.
final MinMaxZoomPreference? minMaxZoomPreference;

/// True if rotate gestures should be enabled.
final bool? rotateGesturesEnabled;

/// True if scroll gestures should be enabled.
///
/// Android/iOS only. For web, see [webGestureHandling].
final bool? scrollGesturesEnabled;

/// True if tilt gestures should be enabled.
final bool? tiltGesturesEnabled;

/// True if 45 degree imagery should be enabled.
///
/// Web only.
final bool? fortyFiveDegreeImageryEnabled;

/// True if camera position changes should trigger notifications.
final bool? trackCameraPosition;

/// True if zoom controls should be displayed.
final bool? zoomControlsEnabled;

/// True if zoom gestures should be enabled.
///
/// Android/iOS only. For web, see [webGestureHandling].
final bool? zoomGesturesEnabled;

/// True if the map should use Lite Mode, showing a limited-interactivity
Expand Down Expand Up @@ -101,6 +117,9 @@ class MapConfiguration {
/// that are different from [other].
MapConfiguration diffFrom(MapConfiguration other) {
return MapConfiguration(
webGestureHandling: webGestureHandling != other.webGestureHandling
? webGestureHandling
: null,
compassEnabled:
compassEnabled != other.compassEnabled ? compassEnabled : null,
mapToolbarEnabled: mapToolbarEnabled != other.mapToolbarEnabled
Expand All @@ -124,6 +143,10 @@ class MapConfiguration {
tiltGesturesEnabled: tiltGesturesEnabled != other.tiltGesturesEnabled
? tiltGesturesEnabled
: null,
fortyFiveDegreeImageryEnabled:
fortyFiveDegreeImageryEnabled != other.fortyFiveDegreeImageryEnabled
? fortyFiveDegreeImageryEnabled
: null,
trackCameraPosition: trackCameraPosition != other.trackCameraPosition
? trackCameraPosition
: null,
Expand Down Expand Up @@ -158,6 +181,7 @@ class MapConfiguration {
/// replacing the previous values.
MapConfiguration applyDiff(MapConfiguration diff) {
return MapConfiguration(
webGestureHandling: diff.webGestureHandling ?? webGestureHandling,
compassEnabled: diff.compassEnabled ?? compassEnabled,
mapToolbarEnabled: diff.mapToolbarEnabled ?? mapToolbarEnabled,
cameraTargetBounds: diff.cameraTargetBounds ?? cameraTargetBounds,
Expand All @@ -168,6 +192,8 @@ class MapConfiguration {
scrollGesturesEnabled:
diff.scrollGesturesEnabled ?? scrollGesturesEnabled,
tiltGesturesEnabled: diff.tiltGesturesEnabled ?? tiltGesturesEnabled,
fortyFiveDegreeImageryEnabled:
diff.fortyFiveDegreeImageryEnabled ?? fortyFiveDegreeImageryEnabled,
trackCameraPosition: diff.trackCameraPosition ?? trackCameraPosition,
zoomControlsEnabled: diff.zoomControlsEnabled ?? zoomControlsEnabled,
zoomGesturesEnabled: diff.zoomGesturesEnabled ?? zoomGesturesEnabled,
Expand All @@ -185,6 +211,7 @@ class MapConfiguration {

/// True if no options are set.
bool get isEmpty =>
webGestureHandling == null &&
compassEnabled == null &&
mapToolbarEnabled == null &&
cameraTargetBounds == null &&
Expand All @@ -193,6 +220,7 @@ class MapConfiguration {
rotateGesturesEnabled == null &&
scrollGesturesEnabled == null &&
tiltGesturesEnabled == null &&
fortyFiveDegreeImageryEnabled == null &&
trackCameraPosition == null &&
zoomControlsEnabled == null &&
zoomGesturesEnabled == null &&
Expand All @@ -214,6 +242,7 @@ class MapConfiguration {
return false;
}
return other is MapConfiguration &&
webGestureHandling == other.webGestureHandling &&
compassEnabled == other.compassEnabled &&
mapToolbarEnabled == other.mapToolbarEnabled &&
cameraTargetBounds == other.cameraTargetBounds &&
Expand All @@ -222,6 +251,7 @@ class MapConfiguration {
rotateGesturesEnabled == other.rotateGesturesEnabled &&
scrollGesturesEnabled == other.scrollGesturesEnabled &&
tiltGesturesEnabled == other.tiltGesturesEnabled &&
fortyFiveDegreeImageryEnabled == other.fortyFiveDegreeImageryEnabled &&
trackCameraPosition == other.trackCameraPosition &&
zoomControlsEnabled == other.zoomControlsEnabled &&
zoomGesturesEnabled == other.zoomGesturesEnabled &&
Expand All @@ -236,7 +266,8 @@ class MapConfiguration {
}

@override
int get hashCode => Object.hash(
int get hashCode => Object.hashAll(<Object?>[
webGestureHandling,
compassEnabled,
mapToolbarEnabled,
cameraTargetBounds,
Expand All @@ -245,6 +276,7 @@ class MapConfiguration {
rotateGesturesEnabled,
scrollGesturesEnabled,
tiltGesturesEnabled,
fortyFiveDegreeImageryEnabled,
trackCameraPosition,
zoomControlsEnabled,
zoomGesturesEnabled,
Expand All @@ -256,5 +288,5 @@ class MapConfiguration {
trafficEnabled,
buildingsEnabled,
cloudMapId,
);
]);
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ export 'utils/marker.dart';
export 'utils/polygon.dart';
export 'utils/polyline.dart';
export 'utils/tile_overlay.dart';
export 'web_gesture_handling.dart';
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// This setting controls how the API handles gestures on the map
enum WebGestureHandling {
/// Scroll events and one-finger touch gestures scroll the page, and do not
/// zoom or pan the map. Two-finger touch gestures pan and zoom the map.
/// Scroll events with a ctrl key or ⌘ key pressed zoom the map. In this mode
/// the map cooperates with the page.
cooperative,

/// All touch gestures and scroll events pan or zoom the map.
greedy,

/// The map cannot be panned or zoomed by user gestures.
none,

/// (default) Gesture handling is either cooperative or greedy, depending on
/// whether the page is scrollable or in an iframe.
auto,
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/google_maps_f
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 2.3.0
version: 2.4.0

environment:
sdk: ">=2.18.0 <4.0.0"
Expand Down
Loading