This repository was archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[google_maps_flutter] Add heatmap support #5274
Closed
Closed
Changes from 1 commit
Commits
Show all changes
120 commits
Select commit
Hold shift + click to select a range
f2e9806
Worked on platform interface
Rexios80 2203401
Added heatmap layer code to web
Rexios80 bcc8f07
Added web target to example
Rexios80 b179c93
Worked on interface
Rexios80 6ee7ae8
Worked on Android implementation
Rexios80 7f78965
Refactoring
Rexios80 09c1fab
Android works
Rexios80 d5d0726
Merge branch 'master' into feature/google-maps-heatmap
Rexios80 cf29213
Java formatting
Rexios80 b2436f5
Fixed dart analysis
Rexios80 37c58ad
Added copyright text
Rexios80 789cd9a
Web tests
Rexios80 977dfd4
Heatmap updates test
Rexios80 d27c28c
Gradient works
Rexios80 2df83b5
Merge remote-tracking branch 'origin/master' into feature/google-maps…
Rexios80 efb432a
Example app now launches with Google-Maps-iOS-Utils included
Rexios80 5703eeb
Worked on ios implementation
Rexios80 c47d213
iOS kind of works; the gradient is being weird
Rexios80 2361e47
Merge branch 'flutter:main' into feature/google-maps-heatmap
Rexios80 72dd326
Merge remote-tracking branch 'origin/feature/google-maps-heatmap' int…
Rexios80 bc27137
Fixed gradient issue
Rexios80 146ea54
Only use 0 alpha gradient first color on web
Rexios80 5ed26a8
Ran clang-format
Rexios80 bd51355
Ran flutter format
Rexios80 876998f
iOS heatmap rendering is a lot better
Rexios80 d4b3524
Formatting
Rexios80 f6d3050
Merge branch 'flutter:main' into feature/google-maps-heatmap
Rexios80 8415953
Made WeightedLatLng extend LatLng
Rexios80 0a9495c
Resolved issues
Rexios80 65bad90
Fixed web code issue
Rexios80 319f84e
Resolved issues
Rexios80 b2e7e5e
Added heatmap controller to umbrella header
Rexios80 9cb30af
Made min/max zoom intensity configurable from flutter
Rexios80 5039dd1
Made start points and color map size configurable from flutter
Rexios80 177def0
dart formatting
Rexios80 ca94502
Fixed test code
Rexios80 6ee5fed
Merge branch 'master' into feature/google-maps-heatmap
Rexios80 d341949
Better use of null safety
Rexios80 c3e904f
Added web heatmaps tests
Rexios80 5cd2524
Merge branch 'master' into feature/google-maps-heatmap
Rexios80 7ad6e7b
Fixed web tests
Rexios80 7978892
Fixed another web test issue
Rexios80 d76e161
Got NSAssert working
Rexios80 dd3c82f
Removed incorrect doc comment
Rexios80 f89a3f4
Merge remote-tracking branch 'origin/master' into feature/google-maps…
Rexios80 994fd1f
Fixed analysis issues with HeatmapPage in example
Rexios80 f96f844
Merge remote-tracking branch 'origin/master' into feature/google-maps…
Rexios80 3c6c7cd
Fixed analysis issues
Rexios80 f63af88
Formatting
Rexios80 1160e32
Fixed issues
Rexios80 c41b00a
Merge remote-tracking branch 'origin/master' into feature/google-maps…
Rexios80 ead58b8
Added license text to example/web/index.html
Rexios80 d1a8856
Merge remote-tracking branch 'origin/master' into feature/google-maps…
Rexios80 5c78283
Merge branch 'google_map_clean_up' into feature/google-maps-heatmap
Rexios80 b9dd462
Merge branch 'master' into feature/google-maps-heatmap
Rexios80 d1daad1
Formatting
Rexios80 35d8715
Don't know where that came from but okay
Rexios80 ccc9ca2
iOS example changes
Rexios80 ea1975b
Added iOS JSON conversion tests
Rexios80 d39a901
Merge branch 'main' into feature/google-maps-heatmap
Rexios80 89239ab
Fixed issues
Rexios80 e5b4943
Refactored heatmap controllers
Rexios80 3c7d7dc
Merge branch 'main' into feature/google-maps-heatmap
Rexios80 011828d
Added swift version to podspec for CI
Rexios80 c39446b
Removed `use_modular_headers!` from Podfile
Rexios80 4999d14
Merge branch 'master' into feature/google-maps-heatmap
Rexios80 681eae8
Fixed missing things
Rexios80 0bf8dd2
Fixed issues
Rexios80 d011011
Xcode project file changes
Rexios80 b7f4f72
Formatting
Rexios80 906c3f0
Merge branch 'master' into feature/google-maps-heatmap
Rexios80 09467d1
Reverted changes to other packages
Rexios80 a5e1e5f
Fixed umbrella header
Rexios80 686b60a
Formatting
Rexios80 70c8dbe
Fixed issues
Rexios80 4eaa5d3
Reverted changes to pbxproj file
Rexios80 b9d33cd
Merge branch 'main' into feature/google-maps-heatmap
Rexios80 882d3b4
Merge branch 'main' into feature/google-maps-heatmap
Rexios80 9005231
Fixes
Rexios80 0c03dad
Fixes
Rexios80 6d69bed
Fixes
Rexios80 edcede1
Fixes
Rexios80 cd24b9e
Merge remote-tracking branch 'origin/master' into feature/google-maps…
Rexios80 e67b408
Merge branch 'master' into feature/google-maps-heatmap
Rexios80 f4d5c86
Fixed build issues
Rexios80 2f745ab
Fixed web test issues
Rexios80 1ce1595
Fixed analysis issues
Rexios80 b2be041
iOS build changes
Rexios80 60e15ea
Updated example
Rexios80 612e5be
Updated documentation
Rexios80 7c22792
Removed assertion for radius value
Rexios80 1d212eb
Fixed building in google_maps_flutter_ios/example
Rexios80 f1105ad
Formatting
Rexios80 ef7a9d4
Fixed android build issue
Rexios80 8c7c8f0
Merge remote-tracking branch 'origin/master' into feature/google-maps…
Rexios80 43ba954
Merge branch 'master' into feature/google-maps-heatmap
Rexios80 3928a72
Assert that heatmap data is not empty
Rexios80 4d6392b
Merge remote-tracking branch 'origin/master' into feature/google-maps…
Rexios80 5c8839e
Revert "Assert that heatmap data is not empty"
Rexios80 c187469
Working on testing
Rexios80 feeed2c
Refactoring
Rexios80 e7471ea
Wrote some dart code
Rexios80 e779c77
Working on integration tests
Rexios80 aab722a
Fixing things
Rexios80 e08a292
Test passes
Rexios80 20591b0
Working on test
Rexios80 5235dad
Added heatmaps update test
Rexios80 55988cc
Added remove heatmaps test
Rexios80 e6e1af2
Working on Android tests
Rexios80 28468b2
Android tests work
Rexios80 35d12bd
Formatting
Rexios80 5c8ce27
Uncommented other tests
Rexios80 597d065
Merge remote-tracking branch 'origin/master' into feature/google-maps…
Rexios80 115ed7f
Undoing unnecessary changes to example
Rexios80 b3e1d4a
Rewrite tests using `moreOrLessEquals`
Rexios80 38ec627
Fixing issues
Rexios80 3639957
Updated documentation
Rexios80 89a0e20
Platform-specific serialization
Rexios80 88db9ca
...
Rexios80 34deb7d
Merge remote-tracking branch 'origin/master' into feature/google-maps…
Rexios80 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Worked on interface
- Loading branch information
commit b179c93bd54b6f1fe4d4e5636408ecff3c8f453b
There are no files selected for viewing
120 changes: 120 additions & 0 deletions
120
packages/google_maps_flutter/google_maps_flutter/example/lib/heatmap_layer.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| // ignore_for_file: public_member_api_docs | ||
|
|
||
| import 'package:flutter/material.dart'; | ||
| import 'package:google_maps_flutter/google_maps_flutter.dart'; | ||
| import 'package:google_maps_flutter_example/page.dart'; | ||
|
|
||
| class HeatmapLayerPage extends GoogleMapExampleAppPage { | ||
| const HeatmapLayerPage() : super(const Icon(Icons.map), 'Heatmap layer'); | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return const HeatmapLayerBody(); | ||
| } | ||
| } | ||
|
|
||
| class HeatmapLayerBody extends StatefulWidget { | ||
| const HeatmapLayerBody(); | ||
|
|
||
| @override | ||
| State<StatefulWidget> createState() => HeatmapLayerBodyState(); | ||
| } | ||
|
|
||
| class HeatmapLayerBodyState extends State<HeatmapLayerBody> { | ||
| static const LatLng sanFrancisco = LatLng(37.774546, -122.433523); | ||
|
|
||
| List<WeightedLatLng> disabledPoints = <WeightedLatLng>[ | ||
| WeightedLatLng(37.782, -122.447), | ||
| WeightedLatLng(37.782, -122.445), | ||
| WeightedLatLng(37.782, -122.443), | ||
| WeightedLatLng(37.782, -122.441), | ||
| WeightedLatLng(37.782, -122.439), | ||
| WeightedLatLng(37.782, -122.437), | ||
| WeightedLatLng(37.782, -122.435), | ||
| WeightedLatLng(37.785, -122.447), | ||
| WeightedLatLng(37.785, -122.445), | ||
| WeightedLatLng(37.785, -122.443), | ||
| WeightedLatLng(37.785, -122.441), | ||
| WeightedLatLng(37.785, -122.439), | ||
| WeightedLatLng(37.785, -122.437), | ||
| WeightedLatLng(37.785, -122.435) | ||
| ]; | ||
|
|
||
| List<WeightedLatLng> enabledPoints = <WeightedLatLng>[]; | ||
|
|
||
| void _addPoint() { | ||
| if (disabledPoints.isEmpty) { | ||
| return; | ||
| } | ||
|
|
||
| final WeightedLatLng point = disabledPoints.first; | ||
| disabledPoints.removeAt(0); | ||
|
|
||
| setState(() => enabledPoints.add(point)); | ||
| } | ||
|
|
||
| void _removePoint() { | ||
| if (enabledPoints.isEmpty) { | ||
| return; | ||
| } | ||
|
|
||
| final WeightedLatLng point = enabledPoints.first; | ||
| enabledPoints.removeAt(0); | ||
|
|
||
| setState(() => disabledPoints.add(point)); | ||
| } | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return Column( | ||
| mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
| crossAxisAlignment: CrossAxisAlignment.stretch, | ||
| children: <Widget>[ | ||
| Center( | ||
| child: SizedBox( | ||
| width: 350.0, | ||
| height: 300.0, | ||
| child: GoogleMap( | ||
| initialCameraPosition: const CameraPosition( | ||
| target: sanFrancisco, | ||
| zoom: 13, | ||
| ), | ||
| heatmapLayers: <HeatmapLayer>{ | ||
| HeatmapLayer( | ||
| heatmapLayerId: const HeatmapLayerId('test'), | ||
| data: enabledPoints, | ||
| ) | ||
| }), | ||
| ), | ||
| ), | ||
| Expanded( | ||
| child: SingleChildScrollView( | ||
| child: Row( | ||
| mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
| children: <Widget>[ | ||
| Row( | ||
| children: <Widget>[ | ||
| Column( | ||
| children: <Widget>[ | ||
| TextButton( | ||
| child: const Text('Add point'), | ||
| onPressed: | ||
| disabledPoints.isNotEmpty ? _addPoint : null, | ||
| ), | ||
| TextButton( | ||
| child: const Text('Remove point'), | ||
| onPressed: | ||
| enabledPoints.isNotEmpty ? _removePoint : null, | ||
| ), | ||
| ], | ||
| ) | ||
| ], | ||
| ) | ||
| ], | ||
| ), | ||
| ), | ||
| ), | ||
| ], | ||
| ); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -143,7 +143,8 @@ class WeightedLatLng { | |
| final double weight; | ||
|
|
||
| /// Creates a [WeightedLatLng] with the specified [weight] | ||
| WeightedLatLng(this.location, {this.weight = 1.0}); | ||
| WeightedLatLng(double latitude, double longitude, {this.weight = 1.0}) | ||
| : location = LatLng(latitude, longitude); | ||
|
|
||
| /// Converts this object to something serializable in JSON. | ||
| Object toJson() { | ||
|
||
|
|
@@ -157,8 +158,10 @@ class WeightedLatLng { | |
| } | ||
| assert(json is List && json.length == 2); | ||
| final list = json as List; | ||
| final latLng = LatLng.fromJson(list[0])!; | ||
| return WeightedLatLng( | ||
| LatLng.fromJson(list[0])!, | ||
| latLng.latitude, | ||
| latLng.longitude, | ||
| weight: list[1], | ||
| ); | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.