mirror of
https://github.com/flutter/packages.git
synced 2025-07-01 23:51:55 +08:00
See #3258
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
## 2.4.0
|
||||||
|
|
||||||
|
* Adds options for gesture handling and tilt controls on web.
|
||||||
|
|
||||||
## 2.3.0
|
## 2.3.0
|
||||||
|
|
||||||
* Adds a `cloudMapId` parameter to support cloud-based map styling.
|
* Adds a `cloudMapId` parameter to support cloud-based map styling.
|
||||||
@ -58,7 +62,7 @@
|
|||||||
|
|
||||||
## 2.1.5
|
## 2.1.5
|
||||||
|
|
||||||
Removes dependency on `meta`.
|
* Removes dependency on `meta`.
|
||||||
|
|
||||||
## 2.1.4
|
## 2.1.4
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
import 'ui.dart';
|
import '../../google_maps_flutter_platform_interface.dart';
|
||||||
|
|
||||||
/// Configuration options for the GoogleMaps user interface.
|
/// Configuration options for the GoogleMaps user interface.
|
||||||
@immutable
|
@immutable
|
||||||
@ -15,6 +15,7 @@ class MapConfiguration {
|
|||||||
/// as either a full configuration selection, or an update to an existing
|
/// as either a full configuration selection, or an update to an existing
|
||||||
/// configuration where only non-null values are updated.
|
/// configuration where only non-null values are updated.
|
||||||
const MapConfiguration({
|
const MapConfiguration({
|
||||||
|
this.webGestureHandling,
|
||||||
this.compassEnabled,
|
this.compassEnabled,
|
||||||
this.mapToolbarEnabled,
|
this.mapToolbarEnabled,
|
||||||
this.cameraTargetBounds,
|
this.cameraTargetBounds,
|
||||||
@ -23,6 +24,7 @@ class MapConfiguration {
|
|||||||
this.rotateGesturesEnabled,
|
this.rotateGesturesEnabled,
|
||||||
this.scrollGesturesEnabled,
|
this.scrollGesturesEnabled,
|
||||||
this.tiltGesturesEnabled,
|
this.tiltGesturesEnabled,
|
||||||
|
this.fortyFiveDegreeImageryEnabled,
|
||||||
this.trackCameraPosition,
|
this.trackCameraPosition,
|
||||||
this.zoomControlsEnabled,
|
this.zoomControlsEnabled,
|
||||||
this.zoomGesturesEnabled,
|
this.zoomGesturesEnabled,
|
||||||
@ -36,6 +38,11 @@ class MapConfiguration {
|
|||||||
this.cloudMapId,
|
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.
|
/// True if the compass UI should be shown.
|
||||||
final bool? compassEnabled;
|
final bool? compassEnabled;
|
||||||
|
|
||||||
@ -48,18 +55,25 @@ class MapConfiguration {
|
|||||||
/// The type of the map.
|
/// The type of the map.
|
||||||
final MapType? mapType;
|
final MapType? mapType;
|
||||||
|
|
||||||
/// The prefered zoom range.
|
/// The preferred zoom range.
|
||||||
final MinMaxZoomPreference? minMaxZoomPreference;
|
final MinMaxZoomPreference? minMaxZoomPreference;
|
||||||
|
|
||||||
/// True if rotate gestures should be enabled.
|
/// True if rotate gestures should be enabled.
|
||||||
final bool? rotateGesturesEnabled;
|
final bool? rotateGesturesEnabled;
|
||||||
|
|
||||||
/// True if scroll gestures should be enabled.
|
/// True if scroll gestures should be enabled.
|
||||||
|
///
|
||||||
|
/// Android/iOS only. For web, see [webGestureHandling].
|
||||||
final bool? scrollGesturesEnabled;
|
final bool? scrollGesturesEnabled;
|
||||||
|
|
||||||
/// True if tilt gestures should be enabled.
|
/// True if tilt gestures should be enabled.
|
||||||
final bool? tiltGesturesEnabled;
|
final bool? tiltGesturesEnabled;
|
||||||
|
|
||||||
|
/// True if 45 degree imagery should be enabled.
|
||||||
|
///
|
||||||
|
/// Web only.
|
||||||
|
final bool? fortyFiveDegreeImageryEnabled;
|
||||||
|
|
||||||
/// True if camera position changes should trigger notifications.
|
/// True if camera position changes should trigger notifications.
|
||||||
final bool? trackCameraPosition;
|
final bool? trackCameraPosition;
|
||||||
|
|
||||||
@ -67,6 +81,8 @@ class MapConfiguration {
|
|||||||
final bool? zoomControlsEnabled;
|
final bool? zoomControlsEnabled;
|
||||||
|
|
||||||
/// True if zoom gestures should be enabled.
|
/// True if zoom gestures should be enabled.
|
||||||
|
///
|
||||||
|
/// Android/iOS only. For web, see [webGestureHandling].
|
||||||
final bool? zoomGesturesEnabled;
|
final bool? zoomGesturesEnabled;
|
||||||
|
|
||||||
/// True if the map should use Lite Mode, showing a limited-interactivity
|
/// True if the map should use Lite Mode, showing a limited-interactivity
|
||||||
@ -101,6 +117,9 @@ class MapConfiguration {
|
|||||||
/// that are different from [other].
|
/// that are different from [other].
|
||||||
MapConfiguration diffFrom(MapConfiguration other) {
|
MapConfiguration diffFrom(MapConfiguration other) {
|
||||||
return MapConfiguration(
|
return MapConfiguration(
|
||||||
|
webGestureHandling: webGestureHandling != other.webGestureHandling
|
||||||
|
? webGestureHandling
|
||||||
|
: null,
|
||||||
compassEnabled:
|
compassEnabled:
|
||||||
compassEnabled != other.compassEnabled ? compassEnabled : null,
|
compassEnabled != other.compassEnabled ? compassEnabled : null,
|
||||||
mapToolbarEnabled: mapToolbarEnabled != other.mapToolbarEnabled
|
mapToolbarEnabled: mapToolbarEnabled != other.mapToolbarEnabled
|
||||||
@ -124,6 +143,10 @@ class MapConfiguration {
|
|||||||
tiltGesturesEnabled: tiltGesturesEnabled != other.tiltGesturesEnabled
|
tiltGesturesEnabled: tiltGesturesEnabled != other.tiltGesturesEnabled
|
||||||
? tiltGesturesEnabled
|
? tiltGesturesEnabled
|
||||||
: null,
|
: null,
|
||||||
|
fortyFiveDegreeImageryEnabled:
|
||||||
|
fortyFiveDegreeImageryEnabled != other.fortyFiveDegreeImageryEnabled
|
||||||
|
? fortyFiveDegreeImageryEnabled
|
||||||
|
: null,
|
||||||
trackCameraPosition: trackCameraPosition != other.trackCameraPosition
|
trackCameraPosition: trackCameraPosition != other.trackCameraPosition
|
||||||
? trackCameraPosition
|
? trackCameraPosition
|
||||||
: null,
|
: null,
|
||||||
@ -158,6 +181,7 @@ class MapConfiguration {
|
|||||||
/// replacing the previous values.
|
/// replacing the previous values.
|
||||||
MapConfiguration applyDiff(MapConfiguration diff) {
|
MapConfiguration applyDiff(MapConfiguration diff) {
|
||||||
return MapConfiguration(
|
return MapConfiguration(
|
||||||
|
webGestureHandling: diff.webGestureHandling ?? webGestureHandling,
|
||||||
compassEnabled: diff.compassEnabled ?? compassEnabled,
|
compassEnabled: diff.compassEnabled ?? compassEnabled,
|
||||||
mapToolbarEnabled: diff.mapToolbarEnabled ?? mapToolbarEnabled,
|
mapToolbarEnabled: diff.mapToolbarEnabled ?? mapToolbarEnabled,
|
||||||
cameraTargetBounds: diff.cameraTargetBounds ?? cameraTargetBounds,
|
cameraTargetBounds: diff.cameraTargetBounds ?? cameraTargetBounds,
|
||||||
@ -168,6 +192,8 @@ class MapConfiguration {
|
|||||||
scrollGesturesEnabled:
|
scrollGesturesEnabled:
|
||||||
diff.scrollGesturesEnabled ?? scrollGesturesEnabled,
|
diff.scrollGesturesEnabled ?? scrollGesturesEnabled,
|
||||||
tiltGesturesEnabled: diff.tiltGesturesEnabled ?? tiltGesturesEnabled,
|
tiltGesturesEnabled: diff.tiltGesturesEnabled ?? tiltGesturesEnabled,
|
||||||
|
fortyFiveDegreeImageryEnabled:
|
||||||
|
diff.fortyFiveDegreeImageryEnabled ?? fortyFiveDegreeImageryEnabled,
|
||||||
trackCameraPosition: diff.trackCameraPosition ?? trackCameraPosition,
|
trackCameraPosition: diff.trackCameraPosition ?? trackCameraPosition,
|
||||||
zoomControlsEnabled: diff.zoomControlsEnabled ?? zoomControlsEnabled,
|
zoomControlsEnabled: diff.zoomControlsEnabled ?? zoomControlsEnabled,
|
||||||
zoomGesturesEnabled: diff.zoomGesturesEnabled ?? zoomGesturesEnabled,
|
zoomGesturesEnabled: diff.zoomGesturesEnabled ?? zoomGesturesEnabled,
|
||||||
@ -185,6 +211,7 @@ class MapConfiguration {
|
|||||||
|
|
||||||
/// True if no options are set.
|
/// True if no options are set.
|
||||||
bool get isEmpty =>
|
bool get isEmpty =>
|
||||||
|
webGestureHandling == null &&
|
||||||
compassEnabled == null &&
|
compassEnabled == null &&
|
||||||
mapToolbarEnabled == null &&
|
mapToolbarEnabled == null &&
|
||||||
cameraTargetBounds == null &&
|
cameraTargetBounds == null &&
|
||||||
@ -193,6 +220,7 @@ class MapConfiguration {
|
|||||||
rotateGesturesEnabled == null &&
|
rotateGesturesEnabled == null &&
|
||||||
scrollGesturesEnabled == null &&
|
scrollGesturesEnabled == null &&
|
||||||
tiltGesturesEnabled == null &&
|
tiltGesturesEnabled == null &&
|
||||||
|
fortyFiveDegreeImageryEnabled == null &&
|
||||||
trackCameraPosition == null &&
|
trackCameraPosition == null &&
|
||||||
zoomControlsEnabled == null &&
|
zoomControlsEnabled == null &&
|
||||||
zoomGesturesEnabled == null &&
|
zoomGesturesEnabled == null &&
|
||||||
@ -214,6 +242,7 @@ class MapConfiguration {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return other is MapConfiguration &&
|
return other is MapConfiguration &&
|
||||||
|
webGestureHandling == other.webGestureHandling &&
|
||||||
compassEnabled == other.compassEnabled &&
|
compassEnabled == other.compassEnabled &&
|
||||||
mapToolbarEnabled == other.mapToolbarEnabled &&
|
mapToolbarEnabled == other.mapToolbarEnabled &&
|
||||||
cameraTargetBounds == other.cameraTargetBounds &&
|
cameraTargetBounds == other.cameraTargetBounds &&
|
||||||
@ -222,6 +251,7 @@ class MapConfiguration {
|
|||||||
rotateGesturesEnabled == other.rotateGesturesEnabled &&
|
rotateGesturesEnabled == other.rotateGesturesEnabled &&
|
||||||
scrollGesturesEnabled == other.scrollGesturesEnabled &&
|
scrollGesturesEnabled == other.scrollGesturesEnabled &&
|
||||||
tiltGesturesEnabled == other.tiltGesturesEnabled &&
|
tiltGesturesEnabled == other.tiltGesturesEnabled &&
|
||||||
|
fortyFiveDegreeImageryEnabled == other.fortyFiveDegreeImageryEnabled &&
|
||||||
trackCameraPosition == other.trackCameraPosition &&
|
trackCameraPosition == other.trackCameraPosition &&
|
||||||
zoomControlsEnabled == other.zoomControlsEnabled &&
|
zoomControlsEnabled == other.zoomControlsEnabled &&
|
||||||
zoomGesturesEnabled == other.zoomGesturesEnabled &&
|
zoomGesturesEnabled == other.zoomGesturesEnabled &&
|
||||||
@ -236,7 +266,8 @@ class MapConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(
|
int get hashCode => Object.hashAll(<Object?>[
|
||||||
|
webGestureHandling,
|
||||||
compassEnabled,
|
compassEnabled,
|
||||||
mapToolbarEnabled,
|
mapToolbarEnabled,
|
||||||
cameraTargetBounds,
|
cameraTargetBounds,
|
||||||
@ -245,6 +276,7 @@ class MapConfiguration {
|
|||||||
rotateGesturesEnabled,
|
rotateGesturesEnabled,
|
||||||
scrollGesturesEnabled,
|
scrollGesturesEnabled,
|
||||||
tiltGesturesEnabled,
|
tiltGesturesEnabled,
|
||||||
|
fortyFiveDegreeImageryEnabled,
|
||||||
trackCameraPosition,
|
trackCameraPosition,
|
||||||
zoomControlsEnabled,
|
zoomControlsEnabled,
|
||||||
zoomGesturesEnabled,
|
zoomGesturesEnabled,
|
||||||
@ -256,5 +288,5 @@ class MapConfiguration {
|
|||||||
trafficEnabled,
|
trafficEnabled,
|
||||||
buildingsEnabled,
|
buildingsEnabled,
|
||||||
cloudMapId,
|
cloudMapId,
|
||||||
);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -34,3 +34,4 @@ export 'utils/marker.dart';
|
|||||||
export 'utils/polygon.dart';
|
export 'utils/polygon.dart';
|
||||||
export 'utils/polyline.dart';
|
export 'utils/polyline.dart';
|
||||||
export 'utils/tile_overlay.dart';
|
export 'utils/tile_overlay.dart';
|
||||||
|
export 'web_gesture_handling.dart';
|
||||||
|
@ -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,
|
||||||
|
}
|
@ -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
|
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
|
# 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
|
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
|
||||||
version: 2.3.0
|
version: 2.4.0
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.18.0 <4.0.0"
|
sdk: ">=2.18.0 <4.0.0"
|
||||||
|
@ -12,6 +12,7 @@ void main() {
|
|||||||
group('diffs', () {
|
group('diffs', () {
|
||||||
// A options instance with every field set, to test diffs against.
|
// A options instance with every field set, to test diffs against.
|
||||||
final MapConfiguration diffBase = MapConfiguration(
|
final MapConfiguration diffBase = MapConfiguration(
|
||||||
|
webGestureHandling: WebGestureHandling.auto,
|
||||||
compassEnabled: false,
|
compassEnabled: false,
|
||||||
mapToolbarEnabled: false,
|
mapToolbarEnabled: false,
|
||||||
cameraTargetBounds: CameraTargetBounds(LatLngBounds(
|
cameraTargetBounds: CameraTargetBounds(LatLngBounds(
|
||||||
@ -21,6 +22,7 @@ void main() {
|
|||||||
rotateGesturesEnabled: false,
|
rotateGesturesEnabled: false,
|
||||||
scrollGesturesEnabled: false,
|
scrollGesturesEnabled: false,
|
||||||
tiltGesturesEnabled: false,
|
tiltGesturesEnabled: false,
|
||||||
|
fortyFiveDegreeImageryEnabled: false,
|
||||||
trackCameraPosition: false,
|
trackCameraPosition: false,
|
||||||
zoomControlsEnabled: false,
|
zoomControlsEnabled: false,
|
||||||
zoomGesturesEnabled: false,
|
zoomGesturesEnabled: false,
|
||||||
@ -58,6 +60,23 @@ void main() {
|
|||||||
expect(updated.cloudMapId, null);
|
expect(updated.cloudMapId, null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('handle webGestureHandling', () async {
|
||||||
|
const MapConfiguration diff =
|
||||||
|
MapConfiguration(webGestureHandling: WebGestureHandling.none);
|
||||||
|
|
||||||
|
const MapConfiguration empty = MapConfiguration();
|
||||||
|
final MapConfiguration updated = diffBase.applyDiff(diff);
|
||||||
|
|
||||||
|
// A diff applied to empty options should be the diff itself.
|
||||||
|
expect(empty.applyDiff(diff), diff);
|
||||||
|
// The diff from empty options should be the diff itself.
|
||||||
|
expect(diff.diffFrom(empty), diff);
|
||||||
|
// A diff applied to non-empty options should update that field.
|
||||||
|
expect(updated.webGestureHandling, WebGestureHandling.none);
|
||||||
|
// The hash code should change.
|
||||||
|
expect(empty.hashCode, isNot(diff.hashCode));
|
||||||
|
});
|
||||||
|
|
||||||
test('handle compassEnabled', () async {
|
test('handle compassEnabled', () async {
|
||||||
const MapConfiguration diff = MapConfiguration(compassEnabled: true);
|
const MapConfiguration diff = MapConfiguration(compassEnabled: true);
|
||||||
|
|
||||||
@ -66,8 +85,12 @@ void main() {
|
|||||||
|
|
||||||
// A diff applied to empty options should be the diff itself.
|
// A diff applied to empty options should be the diff itself.
|
||||||
expect(empty.applyDiff(diff), diff);
|
expect(empty.applyDiff(diff), diff);
|
||||||
|
// The diff from empty options should be the diff itself.
|
||||||
|
expect(diff.diffFrom(empty), diff);
|
||||||
// A diff applied to non-empty options should update that field.
|
// A diff applied to non-empty options should update that field.
|
||||||
expect(updated.compassEnabled, true);
|
expect(updated.compassEnabled, true);
|
||||||
|
// The hash code should change.
|
||||||
|
expect(empty.hashCode, isNot(diff.hashCode));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('handle mapToolbarEnabled', () async {
|
test('handle mapToolbarEnabled', () async {
|
||||||
@ -78,8 +101,12 @@ void main() {
|
|||||||
|
|
||||||
// A diff applied to empty options should be the diff itself.
|
// A diff applied to empty options should be the diff itself.
|
||||||
expect(empty.applyDiff(diff), diff);
|
expect(empty.applyDiff(diff), diff);
|
||||||
|
// The diff from empty options should be the diff itself.
|
||||||
|
expect(diff.diffFrom(empty), diff);
|
||||||
// A diff applied to non-empty options should update that field.
|
// A diff applied to non-empty options should update that field.
|
||||||
expect(updated.mapToolbarEnabled, true);
|
expect(updated.mapToolbarEnabled, true);
|
||||||
|
// The hash code should change.
|
||||||
|
expect(empty.hashCode, isNot(diff.hashCode));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('handle cameraTargetBounds', () async {
|
test('handle cameraTargetBounds', () async {
|
||||||
@ -93,8 +120,12 @@ void main() {
|
|||||||
|
|
||||||
// A diff applied to empty options should be the diff itself.
|
// A diff applied to empty options should be the diff itself.
|
||||||
expect(empty.applyDiff(diff), diff);
|
expect(empty.applyDiff(diff), diff);
|
||||||
|
// The diff from empty options should be the diff itself.
|
||||||
|
expect(diff.diffFrom(empty), diff);
|
||||||
// A diff applied to non-empty options should update that field.
|
// A diff applied to non-empty options should update that field.
|
||||||
expect(updated.cameraTargetBounds, newBounds);
|
expect(updated.cameraTargetBounds, newBounds);
|
||||||
|
// The hash code should change.
|
||||||
|
expect(empty.hashCode, isNot(diff.hashCode));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('handle mapType', () async {
|
test('handle mapType', () async {
|
||||||
@ -106,8 +137,12 @@ void main() {
|
|||||||
|
|
||||||
// A diff applied to empty options should be the diff itself.
|
// A diff applied to empty options should be the diff itself.
|
||||||
expect(empty.applyDiff(diff), diff);
|
expect(empty.applyDiff(diff), diff);
|
||||||
|
// The diff from empty options should be the diff itself.
|
||||||
|
expect(diff.diffFrom(empty), diff);
|
||||||
// A diff applied to non-empty options should update that field.
|
// A diff applied to non-empty options should update that field.
|
||||||
expect(updated.mapType, MapType.satellite);
|
expect(updated.mapType, MapType.satellite);
|
||||||
|
// The hash code should change.
|
||||||
|
expect(empty.hashCode, isNot(diff.hashCode));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('handle minMaxZoomPreference', () async {
|
test('handle minMaxZoomPreference', () async {
|
||||||
@ -120,8 +155,12 @@ void main() {
|
|||||||
|
|
||||||
// A diff applied to empty options should be the diff itself.
|
// A diff applied to empty options should be the diff itself.
|
||||||
expect(empty.applyDiff(diff), diff);
|
expect(empty.applyDiff(diff), diff);
|
||||||
|
// The diff from empty options should be the diff itself.
|
||||||
|
expect(diff.diffFrom(empty), diff);
|
||||||
// A diff applied to non-empty options should update that field.
|
// A diff applied to non-empty options should update that field.
|
||||||
expect(updated.minMaxZoomPreference, newZoomPref);
|
expect(updated.minMaxZoomPreference, newZoomPref);
|
||||||
|
// The hash code should change.
|
||||||
|
expect(empty.hashCode, isNot(diff.hashCode));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('handle rotateGesturesEnabled', () async {
|
test('handle rotateGesturesEnabled', () async {
|
||||||
@ -133,8 +172,12 @@ void main() {
|
|||||||
|
|
||||||
// A diff applied to empty options should be the diff itself.
|
// A diff applied to empty options should be the diff itself.
|
||||||
expect(empty.applyDiff(diff), diff);
|
expect(empty.applyDiff(diff), diff);
|
||||||
|
// The diff from empty options should be the diff itself.
|
||||||
|
expect(diff.diffFrom(empty), diff);
|
||||||
// A diff applied to non-empty options should update that field.
|
// A diff applied to non-empty options should update that field.
|
||||||
expect(updated.rotateGesturesEnabled, true);
|
expect(updated.rotateGesturesEnabled, true);
|
||||||
|
// The hash code should change.
|
||||||
|
expect(empty.hashCode, isNot(diff.hashCode));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('handle scrollGesturesEnabled', () async {
|
test('handle scrollGesturesEnabled', () async {
|
||||||
@ -146,8 +189,12 @@ void main() {
|
|||||||
|
|
||||||
// A diff applied to empty options should be the diff itself.
|
// A diff applied to empty options should be the diff itself.
|
||||||
expect(empty.applyDiff(diff), diff);
|
expect(empty.applyDiff(diff), diff);
|
||||||
|
// The diff from empty options should be the diff itself.
|
||||||
|
expect(diff.diffFrom(empty), diff);
|
||||||
// A diff applied to non-empty options should update that field.
|
// A diff applied to non-empty options should update that field.
|
||||||
expect(updated.scrollGesturesEnabled, true);
|
expect(updated.scrollGesturesEnabled, true);
|
||||||
|
// The hash code should change.
|
||||||
|
expect(empty.hashCode, isNot(diff.hashCode));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('handle tiltGesturesEnabled', () async {
|
test('handle tiltGesturesEnabled', () async {
|
||||||
@ -158,8 +205,29 @@ void main() {
|
|||||||
|
|
||||||
// A diff applied to empty options should be the diff itself.
|
// A diff applied to empty options should be the diff itself.
|
||||||
expect(empty.applyDiff(diff), diff);
|
expect(empty.applyDiff(diff), diff);
|
||||||
|
// The diff from empty options should be the diff itself.
|
||||||
|
expect(diff.diffFrom(empty), diff);
|
||||||
// A diff applied to non-empty options should update that field.
|
// A diff applied to non-empty options should update that field.
|
||||||
expect(updated.tiltGesturesEnabled, true);
|
expect(updated.tiltGesturesEnabled, true);
|
||||||
|
// The hash code should change.
|
||||||
|
expect(empty.hashCode, isNot(diff.hashCode));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('handle fortyFiveDegreeImageryEnabled', () async {
|
||||||
|
const MapConfiguration diff =
|
||||||
|
MapConfiguration(fortyFiveDegreeImageryEnabled: true);
|
||||||
|
|
||||||
|
const MapConfiguration empty = MapConfiguration();
|
||||||
|
final MapConfiguration updated = diffBase.applyDiff(diff);
|
||||||
|
|
||||||
|
// A diff applied to empty options should be the diff itself.
|
||||||
|
expect(empty.applyDiff(diff), diff);
|
||||||
|
// The diff from empty options should be the diff itself.
|
||||||
|
expect(diff.diffFrom(empty), diff);
|
||||||
|
// A diff applied to non-empty options should update that field.
|
||||||
|
expect(updated.fortyFiveDegreeImageryEnabled, true);
|
||||||
|
// The hash code should change.
|
||||||
|
expect(empty.hashCode, isNot(diff.hashCode));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('handle trackCameraPosition', () async {
|
test('handle trackCameraPosition', () async {
|
||||||
@ -170,8 +238,12 @@ void main() {
|
|||||||
|
|
||||||
// A diff applied to empty options should be the diff itself.
|
// A diff applied to empty options should be the diff itself.
|
||||||
expect(empty.applyDiff(diff), diff);
|
expect(empty.applyDiff(diff), diff);
|
||||||
|
// The diff from empty options should be the diff itself.
|
||||||
|
expect(diff.diffFrom(empty), diff);
|
||||||
// A diff applied to non-empty options should update that field.
|
// A diff applied to non-empty options should update that field.
|
||||||
expect(updated.trackCameraPosition, true);
|
expect(updated.trackCameraPosition, true);
|
||||||
|
// The hash code should change.
|
||||||
|
expect(empty.hashCode, isNot(diff.hashCode));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('handle zoomControlsEnabled', () async {
|
test('handle zoomControlsEnabled', () async {
|
||||||
@ -182,8 +254,12 @@ void main() {
|
|||||||
|
|
||||||
// A diff applied to empty options should be the diff itself.
|
// A diff applied to empty options should be the diff itself.
|
||||||
expect(empty.applyDiff(diff), diff);
|
expect(empty.applyDiff(diff), diff);
|
||||||
|
// The diff from empty options should be the diff itself.
|
||||||
|
expect(diff.diffFrom(empty), diff);
|
||||||
// A diff applied to non-empty options should update that field.
|
// A diff applied to non-empty options should update that field.
|
||||||
expect(updated.zoomControlsEnabled, true);
|
expect(updated.zoomControlsEnabled, true);
|
||||||
|
// The hash code should change.
|
||||||
|
expect(empty.hashCode, isNot(diff.hashCode));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('handle zoomGesturesEnabled', () async {
|
test('handle zoomGesturesEnabled', () async {
|
||||||
@ -194,8 +270,12 @@ void main() {
|
|||||||
|
|
||||||
// A diff applied to empty options should be the diff itself.
|
// A diff applied to empty options should be the diff itself.
|
||||||
expect(empty.applyDiff(diff), diff);
|
expect(empty.applyDiff(diff), diff);
|
||||||
|
// The diff from empty options should be the diff itself.
|
||||||
|
expect(diff.diffFrom(empty), diff);
|
||||||
// A diff applied to non-empty options should update that field.
|
// A diff applied to non-empty options should update that field.
|
||||||
expect(updated.zoomGesturesEnabled, true);
|
expect(updated.zoomGesturesEnabled, true);
|
||||||
|
// The hash code should change.
|
||||||
|
expect(empty.hashCode, isNot(diff.hashCode));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('handle liteModeEnabled', () async {
|
test('handle liteModeEnabled', () async {
|
||||||
@ -206,8 +286,12 @@ void main() {
|
|||||||
|
|
||||||
// A diff applied to empty options should be the diff itself.
|
// A diff applied to empty options should be the diff itself.
|
||||||
expect(empty.applyDiff(diff), diff);
|
expect(empty.applyDiff(diff), diff);
|
||||||
|
// The diff from empty options should be the diff itself.
|
||||||
|
expect(diff.diffFrom(empty), diff);
|
||||||
// A diff applied to non-empty options should update that field.
|
// A diff applied to non-empty options should update that field.
|
||||||
expect(updated.liteModeEnabled, true);
|
expect(updated.liteModeEnabled, true);
|
||||||
|
// The hash code should change.
|
||||||
|
expect(empty.hashCode, isNot(diff.hashCode));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('handle myLocationEnabled', () async {
|
test('handle myLocationEnabled', () async {
|
||||||
@ -218,8 +302,12 @@ void main() {
|
|||||||
|
|
||||||
// A diff applied to empty options should be the diff itself.
|
// A diff applied to empty options should be the diff itself.
|
||||||
expect(empty.applyDiff(diff), diff);
|
expect(empty.applyDiff(diff), diff);
|
||||||
|
// The diff from empty options should be the diff itself.
|
||||||
|
expect(diff.diffFrom(empty), diff);
|
||||||
// A diff applied to non-empty options should update that field.
|
// A diff applied to non-empty options should update that field.
|
||||||
expect(updated.myLocationEnabled, true);
|
expect(updated.myLocationEnabled, true);
|
||||||
|
// The hash code should change.
|
||||||
|
expect(empty.hashCode, isNot(diff.hashCode));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('handle myLocationButtonEnabled', () async {
|
test('handle myLocationButtonEnabled', () async {
|
||||||
@ -231,8 +319,12 @@ void main() {
|
|||||||
|
|
||||||
// A diff applied to empty options should be the diff itself.
|
// A diff applied to empty options should be the diff itself.
|
||||||
expect(empty.applyDiff(diff), diff);
|
expect(empty.applyDiff(diff), diff);
|
||||||
|
// The diff from empty options should be the diff itself.
|
||||||
|
expect(diff.diffFrom(empty), diff);
|
||||||
// A diff applied to non-empty options should update that field.
|
// A diff applied to non-empty options should update that field.
|
||||||
expect(updated.myLocationButtonEnabled, true);
|
expect(updated.myLocationButtonEnabled, true);
|
||||||
|
// The hash code should change.
|
||||||
|
expect(empty.hashCode, isNot(diff.hashCode));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('handle padding', () async {
|
test('handle padding', () async {
|
||||||
@ -245,8 +337,12 @@ void main() {
|
|||||||
|
|
||||||
// A diff applied to empty options should be the diff itself.
|
// A diff applied to empty options should be the diff itself.
|
||||||
expect(empty.applyDiff(diff), diff);
|
expect(empty.applyDiff(diff), diff);
|
||||||
|
// The diff from empty options should be the diff itself.
|
||||||
|
expect(diff.diffFrom(empty), diff);
|
||||||
// A diff applied to non-empty options should update that field.
|
// A diff applied to non-empty options should update that field.
|
||||||
expect(updated.padding, newPadding);
|
expect(updated.padding, newPadding);
|
||||||
|
// The hash code should change.
|
||||||
|
expect(empty.hashCode, isNot(diff.hashCode));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('handle indoorViewEnabled', () async {
|
test('handle indoorViewEnabled', () async {
|
||||||
@ -257,8 +353,12 @@ void main() {
|
|||||||
|
|
||||||
// A diff applied to empty options should be the diff itself.
|
// A diff applied to empty options should be the diff itself.
|
||||||
expect(empty.applyDiff(diff), diff);
|
expect(empty.applyDiff(diff), diff);
|
||||||
|
// The diff from empty options should be the diff itself.
|
||||||
|
expect(diff.diffFrom(empty), diff);
|
||||||
// A diff applied to non-empty options should update that field.
|
// A diff applied to non-empty options should update that field.
|
||||||
expect(updated.indoorViewEnabled, true);
|
expect(updated.indoorViewEnabled, true);
|
||||||
|
// The hash code should change.
|
||||||
|
expect(empty.hashCode, isNot(diff.hashCode));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('handle trafficEnabled', () async {
|
test('handle trafficEnabled', () async {
|
||||||
@ -269,8 +369,12 @@ void main() {
|
|||||||
|
|
||||||
// A diff applied to empty options should be the diff itself.
|
// A diff applied to empty options should be the diff itself.
|
||||||
expect(empty.applyDiff(diff), diff);
|
expect(empty.applyDiff(diff), diff);
|
||||||
|
// The diff from empty options should be the diff itself.
|
||||||
|
expect(diff.diffFrom(empty), diff);
|
||||||
// A diff applied to non-empty options should update that field.
|
// A diff applied to non-empty options should update that field.
|
||||||
expect(updated.trafficEnabled, true);
|
expect(updated.trafficEnabled, true);
|
||||||
|
// The hash code should change.
|
||||||
|
expect(empty.hashCode, isNot(diff.hashCode));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('handle buildingsEnabled', () async {
|
test('handle buildingsEnabled', () async {
|
||||||
@ -281,8 +385,12 @@ void main() {
|
|||||||
|
|
||||||
// A diff applied to empty options should be the diff itself.
|
// A diff applied to empty options should be the diff itself.
|
||||||
expect(empty.applyDiff(diff), diff);
|
expect(empty.applyDiff(diff), diff);
|
||||||
|
// The diff from empty options should be the diff itself.
|
||||||
|
expect(diff.diffFrom(empty), diff);
|
||||||
// A diff applied to non-empty options should update that field.
|
// A diff applied to non-empty options should update that field.
|
||||||
expect(updated.buildingsEnabled, true);
|
expect(updated.buildingsEnabled, true);
|
||||||
|
// The hash code should change.
|
||||||
|
expect(empty.hashCode, isNot(diff.hashCode));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('handle cloudMapId', () async {
|
test('handle cloudMapId', () async {
|
||||||
@ -293,8 +401,12 @@ void main() {
|
|||||||
|
|
||||||
// A diff applied to empty options should be the diff itself.
|
// A diff applied to empty options should be the diff itself.
|
||||||
expect(empty.applyDiff(diff), diff);
|
expect(empty.applyDiff(diff), diff);
|
||||||
|
// The diff from empty options should be the diff itself.
|
||||||
|
expect(diff.diffFrom(empty), diff);
|
||||||
// A diff applied to non-empty options should update that field.
|
// A diff applied to non-empty options should update that field.
|
||||||
expect(updated.cloudMapId, _kCloudMapId);
|
expect(updated.cloudMapId, _kCloudMapId);
|
||||||
|
// The hash code should change.
|
||||||
|
expect(empty.hashCode, isNot(diff.hashCode));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user