Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
612722c
add google_maps_flutter_platform_interface
cylyl Mar 4, 2020
b979907
removed unused_local_variable
cylyl Mar 4, 2020
942a333
format
cylyl Mar 4, 2020
b083e31
format
cylyl Mar 4, 2020
77c3e78
format#
cylyl Mar 4, 2020
6693617
update CHANGELOG
cylyl Mar 4, 2020
e186406
Move MethodChannel code to MethodChannelGoogleMapsFlutter
cylyl Mar 5, 2020
75d8376
Update dependencies
cylyl Mar 5, 2020
47180d6
add buildView method
cylyl Mar 9, 2020
2140abb
update pubspec
cylyl Mar 9, 2020
2908711
bugs fix
cylyl Mar 20, 2020
d1498be
Some adjustments to the PR.
ditman Mar 22, 2020
29fd8c6
dartfmt -w .
ditman Mar 22, 2020
130b187
Expose the MethodChannel so e2e tests are happy.
ditman Mar 23, 2020
aa883eb
Move platform into src so we can create a barrel file to export stuff.
ditman Mar 24, 2020
62dfefa
Create barrel file to export only certain things from src
ditman Mar 24, 2020
eb89c8d
Adjust imports in platform interface
ditman Mar 24, 2020
e864e05
Move LatLng and LagLngBounds to the platform interface package. Reexp…
ditman Mar 24, 2020
a2a4f6f
Move ui.dart to platform_interface. Expose .toJson so it can be used …
ditman Mar 24, 2020
87ae109
Move Polygon and Polyline, and all the related types.
ditman Mar 24, 2020
fca65f7
Move Circle and Marker files to platform_interface.
ditman Mar 24, 2020
891f7d0
Move callbacks, camera and screen cordinate to platform interface. Ex…
ditman Mar 25, 2020
add2755
Adapt controller and map widget to new API. Expose _toX methods as to…
ditman Mar 25, 2020
117c5fa
dartfmt -w .
ditman Mar 25, 2020
bde0b79
Use EntityUpdate classes in the corresponding platform interface
ditman Mar 25, 2020
5dbee85
Modify the platform interface in methods that return map boundaries to
ditman Mar 25, 2020
626b551
Utilize MarkerId instances instead of Strings in the relevant methods.
ditman Mar 25, 2020
41f9915
Return futures from the platform directly, no need to await for those.
ditman Mar 26, 2020
9cb7a45
Make mapId a mandatory parameter on the interface methods.
ditman Mar 27, 2020
2e6c763
Add the 11 native event Streams to the platform interface.
ditman Mar 27, 2020
1cb5fc2
Connect to the streams coming from the platform interface.
ditman Mar 27, 2020
920f2de
Ensure the streams are of the right type.
ditman Mar 27, 2020
071eded
Use stream_transform package to get the whereType extension.
ditman Mar 27, 2020
90515de
Final vars should be final
ditman Mar 27, 2020
75020e8
dartfmt -w .
ditman Mar 28, 2020
d5ba662
Rename test according to what it tests.
ditman Mar 31, 2020
a4e46b2
buildView document
cylyl Mar 31, 2020
a81985a
Move CameraPositionCallback to the platform interface
ditman Mar 31, 2020
0278f99
Move takeSnapshot to platform_interface.
ditman Apr 1, 2020
48cd472
Set google_maps_flutter_platform_interface version to 1.0.0
ditman Apr 1, 2020
f21fb98
Revert changes to the example.
ditman Apr 3, 2020
0eba0f9
Remove .gitignore from example dir
ditman Apr 3, 2020
0aa8f86
Appease the analyzer.
ditman Apr 3, 2020
0143254
Appease analyze some more.
ditman Apr 3, 2020
e2113b1
Rename _controller to _mapEventStreamController
ditman Apr 3, 2020
e04081c
Update some docs on the platform
ditman Apr 3, 2020
7774184
Document MapEvent constructors.
ditman Apr 3, 2020
97ebb01
Document method_channel class
ditman Apr 4, 2020
e7179b5
Revert all changes to core plugin.
ditman Apr 7, 2020
3ccc6c0
Exclude google_maps platform interface and web from the build_all_plu…
ditman Apr 7, 2020
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
@@ -0,0 +1,3 @@
## 1.0.0

* Initial release.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# google_maps_flutter_platform_interface

A common platform interface for the [`google_maps_flutter`][1] plugin.

This interface allows platform-specific implementations of the `google_maps_flutter`
plugin, as well as the plugin itself, to ensure they are supporting the
same interface.

# Usage

To implement a new platform-specific implementation of `google_maps_flutter`, extend
[`GoogleMapsFlutterPlatform`][2] with an implementation that performs the
platform-specific behavior, and when you register your plugin, set the default
`GoogleMapsFlutterPlatform` by calling
`GoogleMapsFlutterPlatform.instance = MyPlatformGoogleMapsFlutter()`.

# Note on breaking changes

Strongly prefer non-breaking changes (such as adding a method to the interface)
over breaking changes for this package.

See https://flutter.dev/go/platform-interface-breaking-changes for a discussion
on why a less-clean interface is preferable to a breaking change.

[1]: ../google_maps_flutter
[2]: lib/google_maps_flutter_platform_interface.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

export 'src/platform_interface/google_maps_flutter_platform.dart';
export 'src/types/types.dart';
export 'src/events/map_event.dart';
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart';
import 'package:google_maps_flutter_platform_interface/src/method_channel/method_channel_google_maps_flutter.dart';

/// Generic Event coming from the native side of Maps.
///
/// All MapEvents contain the `mapId` that originated the event. This should
/// never be `null`.
///
/// The `<T>` on this event represents the type of the `value` that is
/// contained within the event.
///
/// This class is used as a base class for all the events that might be
/// triggered from a Map, but it is never used directly as an event type.
///
/// Do NOT instantiate new events like `MapEvent<ValueType>(mapId, val)` directly,
/// use a specific class instead:
///
/// Do `class NewEvent extend MapEvent<ValueType>` when creating your own events.
/// See below for examples: `CameraMoveStartedEvent`, `MarkerDragEndEvent`...
/// These events are more semantic and pleasant to use than raw generics. They
/// can be (and in fact, are) filtered by the `instanceof`-operator.
///
/// (See [MethodChannelGoogleMapsFlutter.onCameraMoveStarted], for example)
///
/// If your event needs a `position`, alongside the `value`, do
/// `extends _PositionedMapEvent<ValueType>` instead. This adds a `LatLng position`
/// attribute.
///
/// If your event *only* needs a `position`, do `extend _PositionedMapEvent<void>`
/// do NOT `extend MapEvent<LatLng>`. The former lets consumers of these
/// events to access the `.position` property, rather than the more generic `.value`
/// yielded from the latter.
class MapEvent<T> {
/// The ID of the Map this event is associated to.
final int mapId;

/// The value wrapped by this event
final T value;

/// Build a Map Event, that relates a mapId with a given value.
///
/// The `mapId` is the id of the map that triggered the event.
/// `value` may be `null` in events that don't transport any meaningful data.
MapEvent(this.mapId, this.value);
}

/// A `MapEvent` associated to a `position`.
class _PositionedMapEvent<T> extends MapEvent<T> {
/// The position where this event happened.
final LatLng position;

/// Build a Positioned MapEvent, that relates a mapId and a position with a value.
///
/// The `mapId` is the id of the map that triggered the event.
/// `value` may be `null` in events that don't transport any meaningful data.
_PositionedMapEvent(int mapId, this.position, T value) : super(mapId, value);
}

// The following events are the ones exposed to the end user. They are semantic extensions
// of the two base classes above.
//
// These events are used to create the appropriate [Stream] objects, with information
// coming from the native side.

/// An event fired when the Camera of a [mapId] starts moving.
class CameraMoveStartedEvent extends MapEvent<void> {
/// Build a CameraMoveStarted Event triggered from the map represented by `mapId`.
CameraMoveStartedEvent(int mapId) : super(mapId, null);
}

/// An event fired while the Camera of a [mapId] moves.
class CameraMoveEvent extends MapEvent<CameraPosition> {
/// Build a CameraMove Event triggered from the map represented by `mapId`.
///
/// The `value` of this event is a [CameraPosition] object with the current position of the Camera.
CameraMoveEvent(int mapId, CameraPosition position) : super(mapId, position);
}

/// An event fired when the Camera of a [mapId] becomes idle.
class CameraIdleEvent extends MapEvent<void> {
/// Build a CameraIdle Event triggered from the map represented by `mapId`.
CameraIdleEvent(int mapId) : super(mapId, null);
}

/// An event fired when a [Marker] is tapped.
class MarkerTapEvent extends MapEvent<MarkerId> {
/// Build a MarkerTap Event triggered from the map represented by `mapId`.
///
/// The `value` of this event is a [MarkerId] object that represents the tapped Marker.
MarkerTapEvent(int mapId, MarkerId markerId) : super(mapId, markerId);
}

/// An event fired when an [InfoWindow] is tapped.
class InfoWindowTapEvent extends MapEvent<MarkerId> {
/// Build an InfoWindowTap Event triggered from the map represented by `mapId`.
///
/// The `value` of this event is a [MarkerId] object that represents the tapped InfoWindow.
InfoWindowTapEvent(int mapId, MarkerId markerId) : super(mapId, markerId);
}

/// An event fired when a [Marker] is dragged to a new [LatLng].
class MarkerDragEndEvent extends _PositionedMapEvent<MarkerId> {
/// Build a MarkerDragEnd Event triggered from the map represented by `mapId`.
///
/// The `position` on this event is the [LatLng] on which the Marker was dropped.
/// The `value` of this event is a [MarkerId] object that represents the moved Marker.
MarkerDragEndEvent(int mapId, LatLng position, MarkerId markerId)
: super(mapId, position, markerId);
}

/// An event fired when a [Polyline] is tapped.
class PolylineTapEvent extends MapEvent<PolylineId> {
/// Build an PolylineTap Event triggered from the map represented by `mapId`.
///
/// The `value` of this event is a [PolylineId] object that represents the tapped Polyline.
PolylineTapEvent(int mapId, PolylineId polylineId) : super(mapId, polylineId);
}

/// An event fired when a [Polygon] is tapped.
class PolygonTapEvent extends MapEvent<PolygonId> {
/// Build an PolygonTap Event triggered from the map represented by `mapId`.
///
/// The `value` of this event is a [PolygonId] object that represents the tapped Polygon.
PolygonTapEvent(int mapId, PolygonId polygonId) : super(mapId, polygonId);
}

/// An event fired when a [Circle] is tapped.
class CircleTapEvent extends MapEvent<CircleId> {
/// Build an CircleTap Event triggered from the map represented by `mapId`.
///
/// The `value` of this event is a [CircleId] object that represents the tapped Circle.
CircleTapEvent(int mapId, CircleId circleId) : super(mapId, circleId);
}

/// An event fired when a Map is tapped.
class MapTapEvent extends _PositionedMapEvent<void> {
/// Build an MapTap Event triggered from the map represented by `mapId`.
///
/// The `position` of this event is the LatLng where the Map was tapped.
MapTapEvent(int mapId, LatLng position) : super(mapId, position, null);
}

/// An event fired when a Map is long pressed.
class MapLongPressEvent extends _PositionedMapEvent<void> {
/// Build an MapTap Event triggered from the map represented by `mapId`.
///
/// The `position` of this event is the LatLng where the Map was long pressed.
MapLongPressEvent(int mapId, LatLng position) : super(mapId, position, null);
}
Loading