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
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/google_maps_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.25

* Add an optional param `mipmaps` for `BitmapDescriptor.fromAssetImage`.

## 0.5.24+1

* Make the pedantic dev_dependency explicit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -823,4 +823,19 @@ void main() {
iwVisibleStatus = await controller.isMarkerInfoWindowShown(marker.markerId);
expect(iwVisibleStatus, false);
});

testWidgets("fromAssetImage", (WidgetTester tester) async {
double pixelRatio = 2;
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);
// ignore: invalid_use_of_visible_for_testing_member
expect(mip.toJson()[2], 1);
// ignore: invalid_use_of_visible_for_testing_member
expect(scaled.toJson()[2], 2);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,15 @@ class BitmapDescriptor {
/// https://flutter.dev/docs/development/ui/assets-and-images#declaring-resolution-aware-image-assets
/// This method takes into consideration various asset resolutions
/// and scales the images to the right resolution depending on the dpi.
/// Set `mipmaps` to false to load the exact dpi version of the image, `mipmap` is true by default.
static Future<BitmapDescriptor> fromAssetImage(
ImageConfiguration configuration,
String assetName, {
AssetBundle bundle,
String package,
bool mipmaps = true,
}) async {
if (configuration.devicePixelRatio != null) {
if (!mipmaps && configuration.devicePixelRatio != null) {
return BitmapDescriptor._(<dynamic>[
'fromAssetImage',
assetName,
Expand All @@ -104,5 +106,10 @@ class BitmapDescriptor {

final dynamic _json;

/// Convert the object to a Json format.
/// Used for testing only.
@visibleForTesting
dynamic toJson() => _json;

dynamic _toJson() => _json;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: google_maps_flutter
description: A Flutter plugin for integrating Google Maps in iOS and Android applications.
homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter/google_maps_flutter
version: 0.5.24+1
version: 0.5.25

dependencies:
flutter:
Expand Down