-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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] Add heatmap support #3257
base: main
Are you sure you want to change the base?
Conversation
Thank you for your contribution. It looks like the tests are failing. Before we review the PR, please see what you can do to resolve the test failures. If you are unsure how to proceed, please reach out for help on the #hackers-new channel. |
@reidbaker The actions seem to only be failing due to the required dependency overrides since this PR requires changes to the platform interface. Until we are ready to split out the platform interface changes into their own PR and get that merged, the actions will continue to fail on this PR. |
...le_maps_flutter/google_maps_flutter/example/android/gradle/wrapper/gradle-wrapper.properties
Outdated
Show resolved
Hide resolved
packages/google_maps_flutter/google_maps_flutter/example/lib/heatmap.dart
Outdated
Show resolved
Hide resolved
packages/google_maps_flutter/google_maps_flutter/example/lib/heatmap.dart
Outdated
Show resolved
Hide resolved
@stuartmorgan The example ios app Podfile needs to specify |
Why do you need the latest version? It looks like building and testing are passing as-is; doesn't that mean the APIs you are using are available back to the oldest version that supports 11.0? |
I don't necessarily need it, but since we were seeing behavior changes between versions on Android I thought it might be good to make sure the example app is actually using the latest. |
The heatmaps are not buildable without the radius, which is defined (even if it does nothing), however every time I try to use it with the heatmap it throws an undefined specifically for the HeatmapRadius. The Heatmap and even the HeatmapId work fine. Attempting to define it myself suddenly lets the compiler know that it is actually defined already, but as soon I remove my definition it goes back to not being defined. The method 'HeatmapRadius' isn't defined for the type 'ReportsModel'.
I can get it working by just setting a default value for radius in the Heatmap class and removing the required keyword for what its worth. |
@trevor-nomadik There is no un-named constructor for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately we're still waiting on a usable version of the Utils pod.
@@ -204,6 +205,262 @@ void runTests() { | |||
}, | |||
); | |||
}, skip: isWeb /* Tiles not supported on the web */); | |||
|
|||
/// Check that two lists of [WeightedLatLng] are more or less equal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is missing a period.
} | ||
} | ||
|
||
/// Check that two [HeatmapGradient]s are more or less equal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same.
void expectHeatmapEquals(Heatmap heatmap1, Heatmap heatmap2) { | ||
expectHeatmapDataMoreOrLessEquals(heatmap1.data, heatmap2.data); | ||
expectHeatmapGradientMoreOrLessEquals(heatmap1.gradient, heatmap2.gradient); | ||
if (Platform.isAndroid) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please comment here and below as to why equality would depend on the platform; that seems very counter-intuitive.
|
||
expectHeatmapEquals(heatmap1New, heatmapInfo1); | ||
}, | ||
skip: isAndroid, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please repeat the comment on each skip
so it's not relying on someone knowing to go look at another test (and on that test still being there, and being the only reason any test in the file might skip Android).
import com.google.maps.android.heatmaps.WeightedLatLng; | ||
import java.util.List; | ||
|
||
public class HeatmapController implements HeatmapOptionsSink { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please comment classes and public methods (applies throughout the PR).
/// The radius in pixels derived from [radius]. | ||
/// | ||
/// In the future, this will convert [radius] to the current platform's | ||
/// expected value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment implies that the behavior of this method will change in the future; that's not the case. The purpose of the factory constructors is that it's the factories that will have different behavior, not this. Changing this method would be breaking, and avoiding that is the whole point of making HeatmapRadius
in the first place.
this.dissipating = true, | ||
this.gradient, | ||
this.maxIntensity, | ||
this.opacity = 0.7, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where did this magic number come from?
this.opacity = 0.7, | ||
required this.radius, | ||
this.minimumZoomIntensity = 0, | ||
this.maximumZoomIntensity = 21, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question here.
/// This list must not be empty. | ||
final List<WeightedLatLng> data; | ||
|
||
/// Specifies whether heatmaps dissipate on zoom. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"the heatmap" rather than "heatmaps". An instance of this class is only one heatmap.
|
||
/// The data points to display. | ||
/// | ||
/// This list must not be empty. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please assert this in the constructor if it's a requirement.
Transferred from flutter/plugins#5274
Adds heatmap support for web, iOS, and Android
List which issues are fixed by this PR. You must list at least one issue.
Fixes #33586
Fixes #86811
If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
IF YOU WANT TO USE THIS NOW
pubspec.yaml:
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.