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 9 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
4 changes: 4 additions & 0 deletions packages/google_maps_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.21

* Breaking change fix for BitmapDescriptor scaling override

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add an optional param mipmaps for BitmapDescriptor. fromAssetImage .


## 0.5.20

* Add map toolbar support
Expand Down
16 changes: 16 additions & 0 deletions packages/google_maps_flutter/example/test_driver/google_maps.dart
Original file line number Diff line number Diff line change
Expand Up @@ -539,4 +539,20 @@ void main() {
final GoogleMapController controller = await controllerCompleter.future;
await controller.setMapStyle(null);
});

test("fromAssetImage", () async {
final Iterable<Future<bool>> futures = <double>[1, 2, 3].map((double pixelRatio) async {
final ImageConfiguration imageConfiguration =
ImageConfiguration(devicePixelRatio: pixelRatio);
final BitmapDescriptor mip = await BitmapDescriptor.fromAssetImage(
imageConfiguration, 'red_square.png');
final BitmapDescriptor scaled = await BitmapDescriptor.fromAssetImage(
imageConfiguration, 'red_square.png', mipmaps: false);
mip.toJson().forEach((dynamic x)=>print(x));
scaled.toJson().forEach((dynamic x)=>print(x));
return Future<bool>.value(true);
});

Future.wait(futures);
});
}
6 changes: 5 additions & 1 deletion packages/google_maps_flutter/lib/src/bitmap.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ class BitmapDescriptor {
String assetName, {
AssetBundle bundle,
String package,
bool mipmaps = true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it possible to make it a non-breaking change by defaulting the mipmaps to false?

This comment has been minimized.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since the ecosystem might have already adopted the last change, compares to the latest code base, setting mipmaps to true would be a breaking change, right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please also add dart doc to explain this param.

This comment has been minimized.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Something like:
///
/// Set mipmaps to ... to allow ...., mipmaps is ... by default.

}) async {
if (configuration.devicePixelRatio != null) {
if (!mipmaps && configuration.devicePixelRatio != null) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

!mipmaps would be false by default and we changed the behavior here right? I think you meant to set mipmaps to false by default?

This comment has been minimized.

return BitmapDescriptor._(<dynamic>[
'fromAssetImage',
assetName,
Expand All @@ -85,5 +86,8 @@ class BitmapDescriptor {

final dynamic _json;

@visibleForTesting
dynamic toJson() => _json;

dynamic _toJson() => _json;
}
2 changes: 1 addition & 1 deletion packages/google_maps_flutter/pubspec.yaml
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.
author: Flutter Team <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter
version: 0.5.20
version: 0.5.20+1
Comment thread
duzenko marked this conversation as resolved.
Outdated

dependencies:
flutter:
Expand Down