-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[google_maps_flutter] Avoid unnecessary redraws #1933
Conversation
| @@ -1,3 +1,7 @@ | |||
| ## 0.5.20+2 | |||
|
|
|||
| * Don't recreate map elements if they didn't change since las widget build. | |||
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.
last
|
@iskakaushik can you please give it some love? |
|
Can we get this in? It's hurting one of our apps. |
be24d67 to
d7e7cfc
Compare
|
@iskakaushik do you know why is failing build IPAs task? |
|
Looks like it simply couldn't connect. |
|
What do we need to do to push this across the finish line? |
|
Friendly reminder @iskakaushik |
iskakaushik
left a comment
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.
Looks good overall. Left a few comments. I think this deserves a minor version upgrade. Can we change to 0.5.21. Thanks.
| .map(idToCurrentCircle) | ||
| .toSet(); | ||
|
|
||
| bool currentNotEqualsPrevious(Circle _current) { |
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.
- For parameters, we don't need to use
_prefix as they are already scoped. Can we change this toCircle current. - I think the method reads better if we call it:
hasChanged(Circle current). - Add dart-docs for this method, something along the lines of what we compare it against, etc.
Note, this applies for all Polygon/Polyline/Markers etc.
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.
Yeah, hasChanged is a better name. I'll change it.
| expect(addedCircle, equals(c2)); | ||
|
|
||
| expect(platformGoogleMap.circleIdsToRemove.isEmpty, true); | ||
|
|
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.
I think having a test with multiple circles, where we only change a couple of them and compute the updates would be interesting. Same for others too.
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.
Cool, I'll will add some tests.
|
sorry for the delay here. |
d7e7cfc to
0105ecb
Compare
|
LGTM |
|
good job |
|
I think this cause #39737 |
|
@joaquinperaza can you confirm by testing with just this change reverted? |
|
@amirh yes, |
|
Is it really necessary to compare the What do you guys think? |
|
Hi @theochampion, I think that it make sense. I've seen that you already created a pull request. Thanks! |
|
@ppicas Feel free to upvote it to accelerate the review process ;) Also, as you worked on map performance, you might be interested in joining the conversation here flutter/flutter#41731 |
Description
This PR fixes a problem with current
GoogleMapwidget implementation that recreates all map elements every time the widget is built.Related Issues
flutter/flutter#37174
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?