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

[google_maps_flutter_android] Add PlatformCap pigeon type. #7639

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 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,5 +1,6 @@
## NEXT
## 2.9.1

* Updates platform_interface dependency to 2.9.2.
* Updates minimum supported SDK version to Flutter 3.19/Dart 3.3.

## 2.9.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: google_maps_flutter
description: A Flutter plugin for integrating Google Maps in iOS and Android applications.
repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22
version: 2.9.0
version: 2.9.1

environment:
sdk: ^3.4.0
Expand All @@ -23,7 +23,7 @@ dependencies:
sdk: flutter
google_maps_flutter_android: ^2.13.0
google_maps_flutter_ios: ^2.12.0
google_maps_flutter_platform_interface: ^2.9.0
google_maps_flutter_platform_interface: ^2.9.2
google_maps_flutter_web: ^0.5.10

dev_dependencies:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.14.6

* Adds `PlatformCap` for `PlatformPolyline.startCap` and `endCap`.

## 2.14.5

* Converts `JointType` to enum.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -723,8 +723,8 @@ static String interpretPolylineOptions(
float density) {
sink.setConsumeTapEvents(polyline.getConsumesTapEvents());
sink.setColor(polyline.getColor().intValue());
sink.setEndCap(toCap(polyline.getEndCap(), assetManager, density));
sink.setStartCap(toCap(polyline.getStartCap(), assetManager, density));
sink.setEndCap(capFromPigeon(polyline.getEndCap(), assetManager, density));
sink.setStartCap(capFromPigeon(polyline.getStartCap(), assetManager, density));
sink.setGeodesic(polyline.getGeodesic());
sink.setJointType(jointTypeFromPigeon(polyline.getJointType()));
sink.setVisible(polyline.getVisible());
Expand Down Expand Up @@ -899,25 +899,22 @@ private static List<PatternItem> toPattern(Object o) {
return pattern;
}

private static Cap toCap(Object o, AssetManager assetManager, float density) {
final List<?> data = toList(o);
switch (toString(data.get(0))) {
case "buttCap":
private static Cap capFromPigeon(
Messages.PlatformCap cap, AssetManager assetManager, float density) {
switch (cap.getType()) {
case BUTT_CAP:
return new ButtCap();
case "roundCap":
case ROUND_CAP:
return new RoundCap();
case "squareCap":
case SQUARE_CAP:
return new SquareCap();
case "customCap":
if (data.size() == 2) {
return new CustomCap(toBitmapDescriptor(data.get(1), assetManager, density));
} else {
return new CustomCap(
toBitmapDescriptor(data.get(1), assetManager, density), toFloat(data.get(2)));
}
default:
throw new IllegalArgumentException("Cannot interpret " + o + " as Cap");
case CUSTOM_CAP:
assert cap.getRefWidth() != null;
return new CustomCap(
toBitmapDescriptor(cap.getBitmapDescriptor(), assetManager, density),
cap.getRefWidth().floatValue());
}
throw new IllegalArgumentException("Unrecognized Cap type: " + cap.getType().toString());
}

static String interpretTileOverlayOptions(
Expand Down
Loading