├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── assets └── images │ ├── m1.png │ ├── m2.png │ ├── m3.png │ ├── m4.png │ ├── m5.png │ ├── m6.png │ └── m7.png ├── clustering_google_maps.iml ├── example.gif ├── example ├── .gitignore ├── .metadata ├── README.md ├── android │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── juanito21 │ │ │ │ │ └── example │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── assets │ └── map_point.json ├── ios │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Podfile │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ └── contents.xcworkspacedata │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h ├── lib │ ├── app_db.dart │ ├── fake_point.dart │ ├── home.dart │ ├── main.dart │ ├── splash.dart │ └── splash_bloc.dart ├── pubspec.lock └── pubspec.yaml ├── lib ├── clustering_google_maps.dart └── src │ ├── aggregated_points.dart │ ├── aggregation_setup.dart │ ├── clustering_helper.dart │ ├── db_helper.dart │ └── lat_lang_geohash.dart ├── pubspec.lock └── pubspec.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | ios/.generated/ 9 | ios/Flutter/Generated.xcconfig 10 | ios/Runner/GeneratedPluginRegistrant.* 11 | ios/.symlinks 12 | 13 | #api key files 14 | **/example/android/app/src/main/res/values/strings.xml 15 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 06b979c4d5e1b499745422269f01a00341257058 8 | channel: dev 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.1.2 2 | 3 | * Migrate to google_maps_flutter: 0.5.21+3 4 | * Remove print in releaseMode 5 | 6 | ## 0.1.0+19 7 | 8 | * Migrate to google_maps_flutter: 0.5.19 9 | * Performance improvement: now sql query and memory filter are made in visible bounding box 10 | * New bitmap descriptor from bytes of canvas image 11 | * Now the count of aggregation points is showed on marker 12 | * Now you can setup your configuration: colors, aggregation range, zoom aggregation limits 13 | 14 | 15 | ## 0.0.5+16 16 | 17 | * Migrate to google_maps_flutter: 0.5.16 18 | * Update path_provider package to 1.1.0 19 | 20 | ## 0.0.5+13 21 | 22 | * Migrate to google_maps_flutter: 0.5.13 23 | 24 | ## 0.0.4+2 25 | 26 | * Add secure MarkerId to marker 27 | 28 | 29 | ## 0.0.4+1 30 | 31 | * Add memory clustering fuction, now you can use clustering with a list of LatLngAndGeohash object 32 | * Add memory clustering to example 33 | * Now you can update the map during the user move or zoom the map (NOT RECOMMENDED) 34 | * Update Readme 35 | 36 | ## 0.0.4 37 | 38 | * Migrate to google_maps_flutter: 0.4.0 39 | * Remove rangeZoomUpdate properties (now the map will update with onMoveIdle callback) 40 | 41 | ## 0.0.3 42 | 43 | * Add optional WHERE clause for SQL query 44 | 45 | ## 0.0.2 46 | 47 | * Migrate to google_maps_flutter: 0.3.0+2 48 | 49 | ## 0.0.1+2 50 | 51 | * Add new marker for new level of aggregation. 52 | * Fix level for aggregation/disgregation 53 | * Add InfoWindowText on aggregated marker with number of points 54 | 55 | ## 0.0.1 56 | 57 | * Initial developers preview release. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Gian Marco Di Francesco 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Clustering for Flutter Google Maps 2 | 3 | [![pub package](https://img.shields.io/pub/v/clustering_google_maps.svg)](https://pub.dartlang.org/packages/clustering_google_maps) 4 | 5 | A Flutter package that recreate clustering technique in a [Google Maps](https://developers.google.com/maps/) widget. 6 | 7 |
8 | 12 |
9 | 10 | 11 |
13 | 14 | ## Developers Preview Status 15 | The package recreate the CLUSTERING technique in a Google Maps. 16 | It's work with data recordered in a dababase SQLite. I use [sqflite](https://pub.dartlang.org/packages/sqflite) (DB TECHNIQUE) 17 | It's work with a list of LatLngAndGeohash object. (MEMORY TECHNIQUE) 18 | 19 | ## Usage 20 | 21 | To use this package, add `clustering_google_maps` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/). 22 | 23 | For a better performance, at every zoom variation on the map, the package performs 24 | a specific query on the SQLite database, but you can force update with updateMap() method. 25 | 26 | ## Getting Started 27 | 28 | ### DB TECHNIQUE 29 | To work properly, you must have the data of the points saved in a SQLite database. 30 | Latitude, longitude and the string of geohash. These three parameters are necessary for correct operation. 31 | If you have not saved the [GEOHASH](https://pub.dartlang.org/packages/geohash), I suggest you install [GEOHASH](https://pub.dartlang.org/packages/geohash) 32 | plugin and save the value of Geohash in the points table of db. 33 | 34 | For this solution you must use the db constructor of ClusteringHelper: 35 | 36 | ```dart 37 | ClusteringHelper.forDB(...); 38 | ``` 39 | 40 | ### MEMORY TECHNIQUE 41 | 42 | To work properly you must have a list of LatLngAndGeohash object. LatLngAndGeohash is a simple object with Location 43 | and Geohash property, the last is generated automatically; you need only location of the point. 44 | 45 | For this solution you must use the MEMORY constructor of ClusteringHelper: 46 | 47 | ```dart 48 | ClusteringHelper.forMemory(...); 49 | ``` 50 | 51 | ### Aggregation Setup 52 | 53 | Yuo can customize color, range count and zoom limit of aggregation. 54 | See this class: [AggregationSetup](https://github.com/giandifra/clustering_google_maps/blob/master/lib/src/aggregation_setup.dart). 55 | 56 | ## Future Implementations 57 | 58 | - ~~To further improve performance I am creating a way to perform sql queries only on the latlng bounding box displayed on the map.~~ 59 | - ~~I will insert custom marker with number of points.~~ 60 | 61 | ## Quick Example for both solution 62 | 63 | ```dart 64 | import 'package:example/app_db.dart'; 65 | import 'package:example/fake_point.dart'; 66 | import 'package:flutter/material.dart'; 67 | import 'package:google_maps_flutter/google_maps_flutter.dart'; 68 | import 'package:clustering_google_maps/clustering_google_maps.dart'; 69 | 70 | class HomeScreen extends StatefulWidget { 71 | final List list; 72 | 73 | HomeScreen({Key key, this.list}) : super(key: key); 74 | 75 | @override 76 | _HomeScreenState createState() => _HomeScreenState(); 77 | } 78 | 79 | class _HomeScreenState extends State { 80 | ClusteringHelper clusteringHelper; 81 | final CameraPosition initialCameraPosition = 82 | CameraPosition(target: LatLng(0.000000, 0.000000), zoom: 0.0); 83 | 84 | Set markers = Set(); 85 | 86 | void _onMapCreated(GoogleMapController mapController) async { 87 | print("onMapCreated"); 88 | clusteringHelper.mapController = mapController; 89 | if (widget.list == null) { 90 | clusteringHelper.database = await AppDatabase.get().getDb(); 91 | } 92 | clusteringHelper.updateMap(); 93 | } 94 | 95 | updateMarkers(Set markers) { 96 | setState(() { 97 | this.markers = markers; 98 | }); 99 | } 100 | 101 | @override 102 | void initState() { 103 | if (widget.list != null) { 104 | initMemoryClustering(); 105 | } else { 106 | initDatabaseClustering(); 107 | } 108 | 109 | super.initState(); 110 | } 111 | 112 | // For db solution 113 | initDatabaseClustering() { 114 | clusteringHelper = ClusteringHelper.forDB( 115 | dbGeohashColumn: FakePoint.dbGeohash, 116 | dbLatColumn: FakePoint.dbLat, 117 | dbLongColumn: FakePoint.dbLong, 118 | dbTable: FakePoint.tblFakePoints, 119 | updateMarkers: updateMarkers, 120 | aggregationSetup: AggregationSetup(), 121 | ); 122 | } 123 | 124 | // For memory solution 125 | initMemoryClustering() { 126 | clusteringHelper = ClusteringHelper.forMemory( 127 | list: widget.list, 128 | updateMarkers: updateMarkers, 129 | aggregationSetup: AggregationSetup(markerSize: 150), 130 | ); 131 | } 132 | 133 | @override 134 | Widget build(BuildContext context) { 135 | return Scaffold( 136 | appBar: AppBar( 137 | title: Text("Clustering Example"), 138 | ), 139 | body: GoogleMap( 140 | onMapCreated: _onMapCreated, 141 | initialCameraPosition: initialCameraPosition, 142 | markers: markers, 143 | onCameraMove: (newPosition) => 144 | clusteringHelper.onCameraMove(newPosition, forceUpdate: false), 145 | onCameraIdle: clusteringHelper.onMapIdle, 146 | ), 147 | floatingActionButton: FloatingActionButton( 148 | child: 149 | widget.list == null ? Icon(Icons.content_cut) : Icon(Icons.update), 150 | onPressed: () { 151 | if (widget.list == null) { 152 | //Test WHERE CLAUSE 153 | clusteringHelper.whereClause = "WHERE ${FakePoint.dbLat} > 42.6"; 154 | } 155 | //Force map update 156 | clusteringHelper.updateMap(); 157 | }, 158 | ), 159 | ); 160 | } 161 | } 162 | ``` 163 | 164 | See the `example` directory for a complete sample app. 165 | -------------------------------------------------------------------------------- /assets/images/m1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/assets/images/m1.png -------------------------------------------------------------------------------- /assets/images/m2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/assets/images/m2.png -------------------------------------------------------------------------------- /assets/images/m3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/assets/images/m3.png -------------------------------------------------------------------------------- /assets/images/m4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/assets/images/m4.png -------------------------------------------------------------------------------- /assets/images/m5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/assets/images/m5.png -------------------------------------------------------------------------------- /assets/images/m6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/assets/images/m6.png -------------------------------------------------------------------------------- /assets/images/m7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/assets/images/m7.png -------------------------------------------------------------------------------- /clustering_google_maps.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /example.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example.gif -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # Visual Studio Code related 19 | .vscode/ 20 | 21 | # Flutter/Dart/Pub related 22 | **/doc/api/ 23 | .dart_tool/ 24 | .flutter-plugins 25 | .packages 26 | .pub-cache/ 27 | .pub/ 28 | build/ 29 | 30 | # Android related 31 | **/android/**/gradle-wrapper.jar 32 | **/android/.gradle 33 | **/android/captures/ 34 | **/android/gradlew 35 | **/android/gradlew.bat 36 | **/android/local.properties 37 | **/android/**/GeneratedPluginRegistrant.java 38 | 39 | # iOS/XCode related 40 | **/ios/**/*.mode1v3 41 | **/ios/**/*.mode2v3 42 | **/ios/**/*.moved-aside 43 | **/ios/**/*.pbxuser 44 | **/ios/**/*.perspectivev3 45 | **/ios/**/*sync/ 46 | **/ios/**/.sconsign.dblite 47 | **/ios/**/.tags* 48 | **/ios/**/.vagrant/ 49 | **/ios/**/DerivedData/ 50 | **/ios/**/Icon? 51 | **/ios/**/Pods/ 52 | **/ios/**/.symlinks/ 53 | **/ios/**/profile 54 | **/ios/**/xcuserdata 55 | **/ios/.generated/ 56 | **/ios/Flutter/App.framework 57 | **/ios/Flutter/Flutter.framework 58 | **/ios/Flutter/Generated.xcconfig 59 | **/ios/Flutter/app.flx 60 | **/ios/Flutter/app.zip 61 | **/ios/Flutter/flutter_assets/ 62 | **/ios/ServiceDefinitions.json 63 | **/ios/Runner/GeneratedPluginRegistrant.* 64 | 65 | # Exceptions to above rules. 66 | !**/ios/**/default.mode1v3 67 | !**/ios/**/default.mode2v3 68 | !**/ios/**/default.pbxuser 69 | !**/ios/**/default.perspectivev3 70 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 71 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 06b979c4d5e1b499745422269f01a00341257058 8 | channel: dev 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A new Flutter application. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.io/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.juanito21.example" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 47 | } 48 | 49 | buildTypes { 50 | release { 51 | // TODO: Add your own signing config for the release build. 52 | // Signing with the debug keys for now, so `flutter run --release` works. 53 | signingConfig signingConfigs.debug 54 | } 55 | } 56 | } 57 | 58 | flutter { 59 | source '../..' 60 | } 61 | 62 | dependencies { 63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 64 | androidTestImplementation 'androidx.test:runner:1.1.1' 65 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 66 | } 67 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 13 | 20 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/juanito21/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.juanito21.example 2 | 3 | import android.os.Bundle 4 | 5 | import io.flutter.app.FlutterActivity 6 | import io.flutter.plugins.GeneratedPluginRegistrant 7 | 8 | class MainActivity: FlutterActivity() { 9 | override fun onCreate(savedInstanceState: Bundle?) { 10 | super.onCreate(savedInstanceState) 11 | GeneratedPluginRegistrant.registerWith(this) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.41' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.3.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableJetifier=true 3 | android.useAndroidX=true 4 | android.enableR8=true 5 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def parse_KV_file(file, separator='=') 14 | file_abs_path = File.expand_path(file) 15 | if !File.exists? file_abs_path 16 | return []; 17 | end 18 | pods_ary = [] 19 | skip_line_start_symbols = ["#", "/"] 20 | File.foreach(file_abs_path) { |line| 21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } 22 | plugin = line.split(pattern=separator) 23 | if plugin.length == 2 24 | podname = plugin[0].strip() 25 | path = plugin[1].strip() 26 | podpath = File.expand_path("#{path}", file_abs_path) 27 | pods_ary.push({:name => podname, :path => podpath}); 28 | else 29 | puts "Invalid plugin specification: #{line}" 30 | end 31 | } 32 | return pods_ary 33 | end 34 | 35 | target 'Runner' do 36 | use_frameworks! 37 | 38 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock 39 | # referring to absolute paths on developers' machines. 40 | system('rm -rf .symlinks') 41 | system('mkdir -p .symlinks/plugins') 42 | 43 | # Flutter Pods 44 | generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') 45 | if generated_xcode_build_settings.empty? 46 | puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." 47 | end 48 | generated_xcode_build_settings.map { |p| 49 | if p[:name] == 'FLUTTER_FRAMEWORK_DIR' 50 | symlink = File.join('.symlinks', 'flutter') 51 | File.symlink(File.dirname(p[:path]), symlink) 52 | pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) 53 | end 54 | } 55 | 56 | # Plugin Pods 57 | plugin_pods = parse_KV_file('../.flutter-plugins') 58 | plugin_pods.map { |p| 59 | symlink = File.join('.symlinks', 'plugins', p[:name]) 60 | File.symlink(p[:path], symlink) 61 | pod p[:name], :path => File.join(symlink, 'ios') 62 | } 63 | end 64 | 65 | post_install do |installer| 66 | installer.pods_project.targets.each do |target| 67 | target.build_configurations.each do |config| 68 | config.build_settings['ENABLE_BITCODE'] = 'NO' 69 | end 70 | end 71 | end 72 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 15 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 16 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 17 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 18 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 19 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 20 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXCopyFilesBuildPhase section */ 24 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 25 | isa = PBXCopyFilesBuildPhase; 26 | buildActionMask = 2147483647; 27 | dstPath = ""; 28 | dstSubfolderSpec = 10; 29 | files = ( 30 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 31 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 32 | ); 33 | name = "Embed Frameworks"; 34 | runOnlyForDeploymentPostprocessing = 0; 35 | }; 36 | /* End PBXCopyFilesBuildPhase section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 40 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 41 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 42 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 43 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 44 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 45 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 46 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 47 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 48 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 49 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 51 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 52 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 53 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | /* End PBXFileReference section */ 55 | 56 | /* Begin PBXFrameworksBuildPhase section */ 57 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 62 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | /* End PBXFrameworksBuildPhase section */ 67 | 68 | /* Begin PBXGroup section */ 69 | 9740EEB11CF90186004384FC /* Flutter */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | 3B80C3931E831B6300D905FE /* App.framework */, 73 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 74 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 75 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 76 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 77 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 78 | ); 79 | name = Flutter; 80 | sourceTree = ""; 81 | }; 82 | 97C146E51CF9000F007C117D = { 83 | isa = PBXGroup; 84 | children = ( 85 | 9740EEB11CF90186004384FC /* Flutter */, 86 | 97C146F01CF9000F007C117D /* Runner */, 87 | 97C146EF1CF9000F007C117D /* Products */, 88 | ); 89 | sourceTree = ""; 90 | }; 91 | 97C146EF1CF9000F007C117D /* Products */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 97C146EE1CF9000F007C117D /* Runner.app */, 95 | ); 96 | name = Products; 97 | sourceTree = ""; 98 | }; 99 | 97C146F01CF9000F007C117D /* Runner */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 103 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 104 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 105 | 97C147021CF9000F007C117D /* Info.plist */, 106 | 97C146F11CF9000F007C117D /* Supporting Files */, 107 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 108 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 109 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 110 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 111 | ); 112 | path = Runner; 113 | sourceTree = ""; 114 | }; 115 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | ); 119 | name = "Supporting Files"; 120 | sourceTree = ""; 121 | }; 122 | /* End PBXGroup section */ 123 | 124 | /* Begin PBXNativeTarget section */ 125 | 97C146ED1CF9000F007C117D /* Runner */ = { 126 | isa = PBXNativeTarget; 127 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 128 | buildPhases = ( 129 | 9740EEB61CF901F6004384FC /* Run Script */, 130 | 97C146EA1CF9000F007C117D /* Sources */, 131 | 97C146EB1CF9000F007C117D /* Frameworks */, 132 | 97C146EC1CF9000F007C117D /* Resources */, 133 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 134 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 135 | ); 136 | buildRules = ( 137 | ); 138 | dependencies = ( 139 | ); 140 | name = Runner; 141 | productName = Runner; 142 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 143 | productType = "com.apple.product-type.application"; 144 | }; 145 | /* End PBXNativeTarget section */ 146 | 147 | /* Begin PBXProject section */ 148 | 97C146E61CF9000F007C117D /* Project object */ = { 149 | isa = PBXProject; 150 | attributes = { 151 | LastUpgradeCheck = 0910; 152 | ORGANIZATIONNAME = "The Chromium Authors"; 153 | TargetAttributes = { 154 | 97C146ED1CF9000F007C117D = { 155 | CreatedOnToolsVersion = 7.3.1; 156 | LastSwiftMigration = 0910; 157 | }; 158 | }; 159 | }; 160 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 161 | compatibilityVersion = "Xcode 3.2"; 162 | developmentRegion = English; 163 | hasScannedForEncodings = 0; 164 | knownRegions = ( 165 | en, 166 | Base, 167 | ); 168 | mainGroup = 97C146E51CF9000F007C117D; 169 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 170 | projectDirPath = ""; 171 | projectRoot = ""; 172 | targets = ( 173 | 97C146ED1CF9000F007C117D /* Runner */, 174 | ); 175 | }; 176 | /* End PBXProject section */ 177 | 178 | /* Begin PBXResourcesBuildPhase section */ 179 | 97C146EC1CF9000F007C117D /* Resources */ = { 180 | isa = PBXResourcesBuildPhase; 181 | buildActionMask = 2147483647; 182 | files = ( 183 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 184 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 185 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 186 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 187 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 188 | ); 189 | runOnlyForDeploymentPostprocessing = 0; 190 | }; 191 | /* End PBXResourcesBuildPhase section */ 192 | 193 | /* Begin PBXShellScriptBuildPhase section */ 194 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 195 | isa = PBXShellScriptBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | ); 199 | inputPaths = ( 200 | ); 201 | name = "Thin Binary"; 202 | outputPaths = ( 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | shellPath = /bin/sh; 206 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 207 | }; 208 | 9740EEB61CF901F6004384FC /* Run Script */ = { 209 | isa = PBXShellScriptBuildPhase; 210 | buildActionMask = 2147483647; 211 | files = ( 212 | ); 213 | inputPaths = ( 214 | ); 215 | name = "Run Script"; 216 | outputPaths = ( 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | shellPath = /bin/sh; 220 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 221 | }; 222 | /* End PBXShellScriptBuildPhase section */ 223 | 224 | /* Begin PBXSourcesBuildPhase section */ 225 | 97C146EA1CF9000F007C117D /* Sources */ = { 226 | isa = PBXSourcesBuildPhase; 227 | buildActionMask = 2147483647; 228 | files = ( 229 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 230 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | }; 234 | /* End PBXSourcesBuildPhase section */ 235 | 236 | /* Begin PBXVariantGroup section */ 237 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 238 | isa = PBXVariantGroup; 239 | children = ( 240 | 97C146FB1CF9000F007C117D /* Base */, 241 | ); 242 | name = Main.storyboard; 243 | sourceTree = ""; 244 | }; 245 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 246 | isa = PBXVariantGroup; 247 | children = ( 248 | 97C147001CF9000F007C117D /* Base */, 249 | ); 250 | name = LaunchScreen.storyboard; 251 | sourceTree = ""; 252 | }; 253 | /* End PBXVariantGroup section */ 254 | 255 | /* Begin XCBuildConfiguration section */ 256 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 257 | isa = XCBuildConfiguration; 258 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 259 | buildSettings = { 260 | ALWAYS_SEARCH_USER_PATHS = NO; 261 | CLANG_ANALYZER_NONNULL = YES; 262 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 263 | CLANG_CXX_LIBRARY = "libc++"; 264 | CLANG_ENABLE_MODULES = YES; 265 | CLANG_ENABLE_OBJC_ARC = YES; 266 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 267 | CLANG_WARN_BOOL_CONVERSION = YES; 268 | CLANG_WARN_COMMA = YES; 269 | CLANG_WARN_CONSTANT_CONVERSION = YES; 270 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 271 | CLANG_WARN_EMPTY_BODY = YES; 272 | CLANG_WARN_ENUM_CONVERSION = YES; 273 | CLANG_WARN_INFINITE_RECURSION = YES; 274 | CLANG_WARN_INT_CONVERSION = YES; 275 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 276 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 277 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 278 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 279 | CLANG_WARN_STRICT_PROTOTYPES = YES; 280 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 281 | CLANG_WARN_UNREACHABLE_CODE = YES; 282 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 283 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 284 | COPY_PHASE_STRIP = NO; 285 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 286 | ENABLE_NS_ASSERTIONS = NO; 287 | ENABLE_STRICT_OBJC_MSGSEND = YES; 288 | GCC_C_LANGUAGE_STANDARD = gnu99; 289 | GCC_NO_COMMON_BLOCKS = YES; 290 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 291 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 292 | GCC_WARN_UNDECLARED_SELECTOR = YES; 293 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 294 | GCC_WARN_UNUSED_FUNCTION = YES; 295 | GCC_WARN_UNUSED_VARIABLE = YES; 296 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 297 | MTL_ENABLE_DEBUG_INFO = NO; 298 | SDKROOT = iphoneos; 299 | TARGETED_DEVICE_FAMILY = "1,2"; 300 | VALIDATE_PRODUCT = YES; 301 | }; 302 | name = Profile; 303 | }; 304 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 305 | isa = XCBuildConfiguration; 306 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 307 | buildSettings = { 308 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 309 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 310 | DEVELOPMENT_TEAM = S8QB4VV633; 311 | ENABLE_BITCODE = NO; 312 | FRAMEWORK_SEARCH_PATHS = ( 313 | "$(inherited)", 314 | "$(PROJECT_DIR)/Flutter", 315 | ); 316 | INFOPLIST_FILE = Runner/Info.plist; 317 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 318 | LIBRARY_SEARCH_PATHS = ( 319 | "$(inherited)", 320 | "$(PROJECT_DIR)/Flutter", 321 | ); 322 | PRODUCT_BUNDLE_IDENTIFIER = com.juanito21.example; 323 | PRODUCT_NAME = "$(TARGET_NAME)"; 324 | SWIFT_VERSION = 4.0; 325 | VERSIONING_SYSTEM = "apple-generic"; 326 | }; 327 | name = Profile; 328 | }; 329 | 97C147031CF9000F007C117D /* Debug */ = { 330 | isa = XCBuildConfiguration; 331 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 332 | buildSettings = { 333 | ALWAYS_SEARCH_USER_PATHS = NO; 334 | CLANG_ANALYZER_NONNULL = YES; 335 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 336 | CLANG_CXX_LIBRARY = "libc++"; 337 | CLANG_ENABLE_MODULES = YES; 338 | CLANG_ENABLE_OBJC_ARC = YES; 339 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 340 | CLANG_WARN_BOOL_CONVERSION = YES; 341 | CLANG_WARN_COMMA = YES; 342 | CLANG_WARN_CONSTANT_CONVERSION = YES; 343 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 344 | CLANG_WARN_EMPTY_BODY = YES; 345 | CLANG_WARN_ENUM_CONVERSION = YES; 346 | CLANG_WARN_INFINITE_RECURSION = YES; 347 | CLANG_WARN_INT_CONVERSION = YES; 348 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 349 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 350 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 351 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 352 | CLANG_WARN_STRICT_PROTOTYPES = YES; 353 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 354 | CLANG_WARN_UNREACHABLE_CODE = YES; 355 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 356 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 357 | COPY_PHASE_STRIP = NO; 358 | DEBUG_INFORMATION_FORMAT = dwarf; 359 | ENABLE_STRICT_OBJC_MSGSEND = YES; 360 | ENABLE_TESTABILITY = YES; 361 | GCC_C_LANGUAGE_STANDARD = gnu99; 362 | GCC_DYNAMIC_NO_PIC = NO; 363 | GCC_NO_COMMON_BLOCKS = YES; 364 | GCC_OPTIMIZATION_LEVEL = 0; 365 | GCC_PREPROCESSOR_DEFINITIONS = ( 366 | "DEBUG=1", 367 | "$(inherited)", 368 | ); 369 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 370 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 371 | GCC_WARN_UNDECLARED_SELECTOR = YES; 372 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 373 | GCC_WARN_UNUSED_FUNCTION = YES; 374 | GCC_WARN_UNUSED_VARIABLE = YES; 375 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 376 | MTL_ENABLE_DEBUG_INFO = YES; 377 | ONLY_ACTIVE_ARCH = YES; 378 | SDKROOT = iphoneos; 379 | TARGETED_DEVICE_FAMILY = "1,2"; 380 | }; 381 | name = Debug; 382 | }; 383 | 97C147041CF9000F007C117D /* Release */ = { 384 | isa = XCBuildConfiguration; 385 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 386 | buildSettings = { 387 | ALWAYS_SEARCH_USER_PATHS = NO; 388 | CLANG_ANALYZER_NONNULL = YES; 389 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 390 | CLANG_CXX_LIBRARY = "libc++"; 391 | CLANG_ENABLE_MODULES = YES; 392 | CLANG_ENABLE_OBJC_ARC = YES; 393 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 394 | CLANG_WARN_BOOL_CONVERSION = YES; 395 | CLANG_WARN_COMMA = YES; 396 | CLANG_WARN_CONSTANT_CONVERSION = YES; 397 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 398 | CLANG_WARN_EMPTY_BODY = YES; 399 | CLANG_WARN_ENUM_CONVERSION = YES; 400 | CLANG_WARN_INFINITE_RECURSION = YES; 401 | CLANG_WARN_INT_CONVERSION = YES; 402 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 403 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 404 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 405 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 406 | CLANG_WARN_STRICT_PROTOTYPES = YES; 407 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 408 | CLANG_WARN_UNREACHABLE_CODE = YES; 409 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 410 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 411 | COPY_PHASE_STRIP = NO; 412 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 413 | ENABLE_NS_ASSERTIONS = NO; 414 | ENABLE_STRICT_OBJC_MSGSEND = YES; 415 | GCC_C_LANGUAGE_STANDARD = gnu99; 416 | GCC_NO_COMMON_BLOCKS = YES; 417 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 418 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 419 | GCC_WARN_UNDECLARED_SELECTOR = YES; 420 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 421 | GCC_WARN_UNUSED_FUNCTION = YES; 422 | GCC_WARN_UNUSED_VARIABLE = YES; 423 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 424 | MTL_ENABLE_DEBUG_INFO = NO; 425 | SDKROOT = iphoneos; 426 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 427 | TARGETED_DEVICE_FAMILY = "1,2"; 428 | VALIDATE_PRODUCT = YES; 429 | }; 430 | name = Release; 431 | }; 432 | 97C147061CF9000F007C117D /* Debug */ = { 433 | isa = XCBuildConfiguration; 434 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 435 | buildSettings = { 436 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 437 | CLANG_ENABLE_MODULES = YES; 438 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 439 | ENABLE_BITCODE = NO; 440 | FRAMEWORK_SEARCH_PATHS = ( 441 | "$(inherited)", 442 | "$(PROJECT_DIR)/Flutter", 443 | ); 444 | INFOPLIST_FILE = Runner/Info.plist; 445 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 446 | LIBRARY_SEARCH_PATHS = ( 447 | "$(inherited)", 448 | "$(PROJECT_DIR)/Flutter", 449 | ); 450 | PRODUCT_BUNDLE_IDENTIFIER = com.juanito21.example; 451 | PRODUCT_NAME = "$(TARGET_NAME)"; 452 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 453 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 454 | SWIFT_SWIFT3_OBJC_INFERENCE = On; 455 | SWIFT_VERSION = 4.0; 456 | VERSIONING_SYSTEM = "apple-generic"; 457 | }; 458 | name = Debug; 459 | }; 460 | 97C147071CF9000F007C117D /* Release */ = { 461 | isa = XCBuildConfiguration; 462 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 463 | buildSettings = { 464 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 465 | CLANG_ENABLE_MODULES = YES; 466 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 467 | ENABLE_BITCODE = NO; 468 | FRAMEWORK_SEARCH_PATHS = ( 469 | "$(inherited)", 470 | "$(PROJECT_DIR)/Flutter", 471 | ); 472 | INFOPLIST_FILE = Runner/Info.plist; 473 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 474 | LIBRARY_SEARCH_PATHS = ( 475 | "$(inherited)", 476 | "$(PROJECT_DIR)/Flutter", 477 | ); 478 | PRODUCT_BUNDLE_IDENTIFIER = com.juanito21.example; 479 | PRODUCT_NAME = "$(TARGET_NAME)"; 480 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 481 | SWIFT_SWIFT3_OBJC_INFERENCE = On; 482 | SWIFT_VERSION = 4.0; 483 | VERSIONING_SYSTEM = "apple-generic"; 484 | }; 485 | name = Release; 486 | }; 487 | /* End XCBuildConfiguration section */ 488 | 489 | /* Begin XCConfigurationList section */ 490 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 491 | isa = XCConfigurationList; 492 | buildConfigurations = ( 493 | 97C147031CF9000F007C117D /* Debug */, 494 | 97C147041CF9000F007C117D /* Release */, 495 | 249021D3217E4FDB00AE95B9 /* Profile */, 496 | ); 497 | defaultConfigurationIsVisible = 0; 498 | defaultConfigurationName = Release; 499 | }; 500 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 501 | isa = XCConfigurationList; 502 | buildConfigurations = ( 503 | 97C147061CF9000F007C117D /* Debug */, 504 | 97C147071CF9000F007C117D /* Release */, 505 | 249021D4217E4FDB00AE95B9 /* Profile */, 506 | ); 507 | defaultConfigurationIsVisible = 0; 508 | defaultConfigurationName = Release; 509 | }; 510 | /* End XCConfigurationList section */ 511 | 512 | }; 513 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 514 | } 515 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giandifra/clustering_google_maps/ce69f59935b2cdbd2ccaee7f23dd64d2d9e4fe1f/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" -------------------------------------------------------------------------------- /example/lib/app_db.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io'; 3 | import 'package:example/fake_point.dart'; 4 | import 'package:path/path.dart'; 5 | import 'package:sqflite/sqflite.dart'; 6 | import 'package:path_provider/path_provider.dart'; 7 | import 'package:synchronized/synchronized.dart'; 8 | 9 | class AppDatabase { 10 | static final AppDatabase _appDatabase = new AppDatabase._internal(); 11 | 12 | AppDatabase._internal(); 13 | 14 | Database _database; 15 | 16 | static AppDatabase get() { 17 | return _appDatabase; 18 | } 19 | 20 | final _lock = new Lock(); 21 | 22 | Future getDb() async { 23 | if (_database == null) { 24 | await _lock.synchronized(() async { 25 | // Check again once entering the synchronized block 26 | if (_database == null) { 27 | await _init(); 28 | } 29 | }); 30 | } 31 | return _database; 32 | } 33 | 34 | Future _init() async { 35 | print("AppDatabase: init database"); 36 | // Get a location using path_provider 37 | Directory documentsDirectory = await getApplicationDocumentsDirectory(); 38 | String path = join(documentsDirectory.path, "clustering.db"); 39 | _database = await openDatabase(path, version: 1, 40 | onCreate: (Database db, int version) async { 41 | // When creating the db, create the table 42 | await _createFakePointsTable(db); 43 | }, onUpgrade: (Database db, int oldVersion, int newVersion) async { 44 | await db.execute("DROP TABLE ${FakePoint.tblFakePoints}"); 45 | await _createFakePointsTable(db); 46 | }); 47 | } 48 | 49 | Future _createFakePointsTable(Database db) { 50 | return db.execute("CREATE TABLE ${FakePoint.tblFakePoints} (" 51 | "${FakePoint.dbId} INTEGER PRIMARY KEY AUTOINCREMENT," 52 | "${FakePoint.dbGeohash} TEXT," 53 | "${FakePoint.dbLat} LONG," 54 | "${FakePoint.dbLong} LONG);"); 55 | } 56 | 57 | Future closeDatabase() async { 58 | if (_database != null && _database.isOpen) { 59 | await _database.close(); 60 | _database = null; 61 | print("database closed"); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /example/lib/fake_point.dart: -------------------------------------------------------------------------------- 1 | import 'package:geohash/geohash.dart'; 2 | import 'package:google_maps_flutter/google_maps_flutter.dart' show LatLng; 3 | 4 | class FakePoint{ 5 | static final tblFakePoints = "fakePoints"; 6 | static final dbId = "id"; 7 | static final dbLat = "latitude"; 8 | static final dbLong = "longitude"; 9 | static final dbGeohash = "geohash"; 10 | 11 | LatLng location; 12 | int id; 13 | String geohash; 14 | 15 | FakePoint({this.location, this.id}) { 16 | this.geohash = 17 | Geohash.encode(this.location.latitude, this.location.longitude); 18 | } 19 | 20 | FakePoint.fromMap(Map map) 21 | : id = map[dbId], 22 | location = LatLng(map[dbLat], map[dbLong]) { 23 | this.geohash = 24 | Geohash.encode(this.location.latitude, this.location.longitude); 25 | } 26 | 27 | Map toJson() { 28 | final Map data = new Map(); 29 | data[dbId] = this.id; 30 | data[dbLat] = this.location.latitude; 31 | data[dbLat] = this.location.longitude; 32 | return data; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /example/lib/home.dart: -------------------------------------------------------------------------------- 1 | import 'package:example/app_db.dart'; 2 | import 'package:example/fake_point.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:google_maps_flutter/google_maps_flutter.dart'; 5 | import 'package:clustering_google_maps/clustering_google_maps.dart' show LatLngAndGeohash,ClusteringHelper,AggregationSetup; 6 | 7 | class HomeScreen extends StatefulWidget { 8 | final List list; 9 | 10 | HomeScreen({Key key, this.list}) : super(key: key); 11 | 12 | @override 13 | _HomeScreenState createState() => _HomeScreenState(); 14 | } 15 | 16 | class _HomeScreenState extends State { 17 | ClusteringHelper clusteringHelper; 18 | final CameraPosition initialCameraPosition = 19 | CameraPosition(target: LatLng(0.000000, 0.000000), zoom: 0.0); 20 | 21 | Set markers = Set(); 22 | 23 | void _onMapCreated(GoogleMapController mapController) async { 24 | print("onMapCreated"); 25 | clusteringHelper.mapController = mapController; 26 | if (widget.list == null) { 27 | clusteringHelper.database = await AppDatabase.get().getDb(); 28 | } 29 | clusteringHelper.updateMap(); 30 | } 31 | 32 | updateMarkers(Set markers) { 33 | setState(() { 34 | this.markers = markers; 35 | }); 36 | } 37 | 38 | @override 39 | void initState() { 40 | if (widget.list != null) { 41 | initMemoryClustering(); 42 | } else { 43 | initDatabaseClustering(); 44 | } 45 | 46 | super.initState(); 47 | } 48 | 49 | // For db solution 50 | initDatabaseClustering() { 51 | clusteringHelper = ClusteringHelper.forDB( 52 | dbGeohashColumn: FakePoint.dbGeohash, 53 | dbLatColumn: FakePoint.dbLat, 54 | dbLongColumn: FakePoint.dbLong, 55 | dbTable: FakePoint.tblFakePoints, 56 | updateMarkers: updateMarkers, 57 | aggregationSetup: AggregationSetup(), 58 | ); 59 | } 60 | 61 | // For memory solution 62 | initMemoryClustering() { 63 | clusteringHelper = ClusteringHelper.forMemory( 64 | list: widget.list, 65 | updateMarkers: updateMarkers, 66 | aggregationSetup: AggregationSetup(markerSize: 150), 67 | ); 68 | } 69 | 70 | @override 71 | Widget build(BuildContext context) { 72 | return Scaffold( 73 | appBar: AppBar( 74 | title: Text("Clustering Example"), 75 | ), 76 | body: GoogleMap( 77 | onMapCreated: _onMapCreated, 78 | initialCameraPosition: initialCameraPosition, 79 | markers: markers, 80 | onCameraMove: (newPosition) => 81 | clusteringHelper.onCameraMove(newPosition, forceUpdate: false), 82 | onCameraIdle: clusteringHelper.onMapIdle, 83 | ), 84 | floatingActionButton: FloatingActionButton( 85 | child: 86 | widget.list == null ? Icon(Icons.content_cut) : Icon(Icons.update), 87 | onPressed: () { 88 | if (widget.list == null) { 89 | //Test WHERE CLAUSE 90 | clusteringHelper.whereClause = "WHERE ${FakePoint.dbLat} > 42.6"; 91 | } 92 | //Force map update 93 | clusteringHelper.updateMap(); 94 | }, 95 | ), 96 | ); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:example/splash.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | void main() => runApp(MyApp()); 5 | 6 | class MyApp extends StatelessWidget { 7 | @override 8 | Widget build(BuildContext context) { 9 | return MaterialApp( 10 | title: 'Flutter Demo', 11 | theme: ThemeData( 12 | primarySwatch: Colors.blue, 13 | ), 14 | home: Splash(), 15 | ); 16 | } 17 | } -------------------------------------------------------------------------------- /example/lib/splash.dart: -------------------------------------------------------------------------------- 1 | import 'package:example/home.dart'; 2 | import 'package:example/splash_bloc.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:clustering_google_maps/clustering_google_maps.dart'; 5 | 6 | class Splash extends StatefulWidget { 7 | @override 8 | SplashState createState() { 9 | return SplashState(); 10 | } 11 | } 12 | 13 | class SplashState extends State { 14 | final SplashBloc bloc = SplashBloc(); 15 | 16 | bool loading = false; 17 | 18 | @override 19 | void initState() { 20 | super.initState(); 21 | } 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | return Scaffold( 26 | body: Center( 27 | child: Column( 28 | mainAxisAlignment: MainAxisAlignment.center, 29 | children: [ 30 | RaisedButton( 31 | child: Text('Load Fake Data into Database'), 32 | onPressed: loading 33 | ? null 34 | : () async { 35 | try { 36 | setState(() { 37 | loading = true; 38 | }); 39 | await bloc.addFakePointsToDB(context); 40 | await Navigator.push( 41 | context, 42 | MaterialPageRoute( 43 | builder: (context) => HomeScreen(), 44 | ), 45 | ); 46 | setState(() { 47 | loading = false; 48 | }); 49 | } catch (e) { 50 | showDialog( 51 | context: context, 52 | builder: (context) { 53 | return Column( 54 | children: [ 55 | Text('Error'), 56 | Text(e.toString()), 57 | ], 58 | ); 59 | }, 60 | ); 61 | } 62 | }, 63 | ), 64 | RaisedButton( 65 | child: Text('Load Fake Data into Memory'), 66 | onPressed: loading 67 | ? null 68 | : () async { 69 | try { 70 | setState(() { 71 | loading = true; 72 | }); 73 | final List list = 74 | await bloc.getListOfLatLngAndGeohash(context); 75 | await Navigator.push( 76 | context, 77 | MaterialPageRoute( 78 | builder: (context) => HomeScreen(list: list), 79 | ), 80 | ); 81 | setState(() { 82 | loading = false; 83 | }); 84 | } catch (e) { 85 | showDialog( 86 | context: context, 87 | builder: (context) { 88 | return Column( 89 | children: [ 90 | Text('Error'), 91 | Text(e.toString()), 92 | ], 93 | ); 94 | }, 95 | ); 96 | } 97 | }, 98 | ), 99 | loading ? CircularProgressIndicator() : Container(), 100 | ], 101 | ), 102 | ), 103 | ); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /example/lib/splash_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'package:clustering_google_maps/clustering_google_maps.dart'; 3 | import 'package:example/app_db.dart'; 4 | import 'package:example/fake_point.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:google_maps_flutter/google_maps_flutter.dart'; 7 | import 'package:sqflite/sqflite.dart'; 8 | 9 | class SplashBloc { 10 | Future> getListOfLatLngAndGeohash( 11 | BuildContext context) async { 12 | print("START GET FAKE DATA"); 13 | try { 14 | final fakeList = await loadDataFromJson(context); 15 | List myPoints = List(); 16 | for (int i = 0; i < fakeList.length; i++) { 17 | final fakePoint = fakeList[i]; 18 | final p = LatLngAndGeohash( 19 | LatLng(fakePoint["LATITUDE"], fakePoint["LONGITUDE"]), 20 | ); 21 | myPoints.add(p); 22 | } 23 | print("EXTRACT COMPLETE"); 24 | return myPoints; 25 | } catch (e) { 26 | throw Exception(e.toString()); 27 | } 28 | } 29 | 30 | Future addFakePointsToDB(context) async { 31 | print("START GET FAKE DATA"); 32 | try { 33 | final fakeList = await loadDataFromJson(context); 34 | for (int i = 0; i < fakeList.length; i++) { 35 | final point = fakeList[i]; 36 | final f = FakePoint( 37 | location: LatLng(point["LATITUDE"], point["LONGITUDE"]), 38 | id: i, 39 | ); 40 | await saveFakePointToDB(f); 41 | } 42 | print("EXTRACT COMPLETE"); 43 | } catch (e) { 44 | throw Exception(e.toString()); 45 | } 46 | } 47 | 48 | Future> loadDataFromJson(BuildContext context) async { 49 | final fakeData = await DefaultAssetBundle.of(context) 50 | .loadString('assets/map_point.json'); 51 | return json.decode(fakeData.toString()); 52 | } 53 | 54 | Future saveFakePointToDB(FakePoint fakePoint) async { 55 | var db = await AppDatabase.get().getDb(); 56 | try { 57 | await db.transaction((Transaction txn) async { 58 | await txn.rawInsert('INSERT INTO ' 59 | '${FakePoint.tblFakePoints}(${FakePoint.dbGeohash},${FakePoint.dbLat},${FakePoint.dbLong})' 60 | ' VALUES("${fakePoint.geohash}",${fakePoint.location.latitude},${fakePoint.location.longitude})'); 61 | }); 62 | } catch (e) { 63 | print("erorr = " + e.toString()); 64 | throw Exception(e); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | archive: 5 | dependency: transitive 6 | description: 7 | name: archive 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.0.10" 11 | args: 12 | dependency: transitive 13 | description: 14 | name: args 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.5.2" 18 | async: 19 | dependency: transitive 20 | description: 21 | name: async 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.3.0" 25 | boolean_selector: 26 | dependency: transitive 27 | description: 28 | name: boolean_selector 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.0.5" 32 | charcode: 33 | dependency: transitive 34 | description: 35 | name: charcode 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.2" 39 | clustering_google_maps: 40 | dependency: "direct main" 41 | description: 42 | path: ".." 43 | relative: true 44 | source: path 45 | version: "0.1.2" 46 | collection: 47 | dependency: transitive 48 | description: 49 | name: collection 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.14.11" 53 | convert: 54 | dependency: transitive 55 | description: 56 | name: convert 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "2.1.1" 60 | crypto: 61 | dependency: transitive 62 | description: 63 | name: crypto 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "2.1.3" 67 | cupertino_icons: 68 | dependency: "direct main" 69 | description: 70 | name: cupertino_icons 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "0.1.2" 74 | flutter: 75 | dependency: "direct main" 76 | description: flutter 77 | source: sdk 78 | version: "0.0.0" 79 | flutter_test: 80 | dependency: "direct dev" 81 | description: flutter 82 | source: sdk 83 | version: "0.0.0" 84 | geohash: 85 | dependency: transitive 86 | description: 87 | name: geohash 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "0.2.1" 91 | google_maps_flutter: 92 | dependency: transitive 93 | description: 94 | name: google_maps_flutter 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "0.5.21+3" 98 | image: 99 | dependency: transitive 100 | description: 101 | name: image 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "2.1.4" 105 | matcher: 106 | dependency: transitive 107 | description: 108 | name: matcher 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "0.12.5" 112 | meta: 113 | dependency: transitive 114 | description: 115 | name: meta 116 | url: "https://pub.dartlang.org" 117 | source: hosted 118 | version: "1.1.7" 119 | path: 120 | dependency: transitive 121 | description: 122 | name: path 123 | url: "https://pub.dartlang.org" 124 | source: hosted 125 | version: "1.6.4" 126 | path_provider: 127 | dependency: transitive 128 | description: 129 | name: path_provider 130 | url: "https://pub.dartlang.org" 131 | source: hosted 132 | version: "1.1.0" 133 | pedantic: 134 | dependency: transitive 135 | description: 136 | name: pedantic 137 | url: "https://pub.dartlang.org" 138 | source: hosted 139 | version: "1.8.0+1" 140 | petitparser: 141 | dependency: transitive 142 | description: 143 | name: petitparser 144 | url: "https://pub.dartlang.org" 145 | source: hosted 146 | version: "2.4.0" 147 | quiver: 148 | dependency: transitive 149 | description: 150 | name: quiver 151 | url: "https://pub.dartlang.org" 152 | source: hosted 153 | version: "2.0.5" 154 | sky_engine: 155 | dependency: transitive 156 | description: flutter 157 | source: sdk 158 | version: "0.0.99" 159 | source_span: 160 | dependency: transitive 161 | description: 162 | name: source_span 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "1.5.5" 166 | sqflite: 167 | dependency: transitive 168 | description: 169 | name: sqflite 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "1.1.6+1" 173 | stack_trace: 174 | dependency: transitive 175 | description: 176 | name: stack_trace 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "1.9.3" 180 | stream_channel: 181 | dependency: transitive 182 | description: 183 | name: stream_channel 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "2.0.0" 187 | string_scanner: 188 | dependency: transitive 189 | description: 190 | name: string_scanner 191 | url: "https://pub.dartlang.org" 192 | source: hosted 193 | version: "1.0.5" 194 | synchronized: 195 | dependency: transitive 196 | description: 197 | name: synchronized 198 | url: "https://pub.dartlang.org" 199 | source: hosted 200 | version: "2.1.0+1" 201 | term_glyph: 202 | dependency: transitive 203 | description: 204 | name: term_glyph 205 | url: "https://pub.dartlang.org" 206 | source: hosted 207 | version: "1.1.0" 208 | test_api: 209 | dependency: transitive 210 | description: 211 | name: test_api 212 | url: "https://pub.dartlang.org" 213 | source: hosted 214 | version: "0.2.5" 215 | typed_data: 216 | dependency: transitive 217 | description: 218 | name: typed_data 219 | url: "https://pub.dartlang.org" 220 | source: hosted 221 | version: "1.1.6" 222 | vector_math: 223 | dependency: transitive 224 | description: 225 | name: vector_math 226 | url: "https://pub.dartlang.org" 227 | source: hosted 228 | version: "2.0.8" 229 | xml: 230 | dependency: transitive 231 | description: 232 | name: xml 233 | url: "https://pub.dartlang.org" 234 | source: hosted 235 | version: "3.5.0" 236 | sdks: 237 | dart: ">=2.4.0 <3.0.0" 238 | flutter: ">=1.5.0 <2.0.0" 239 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: A new Flutter application. 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # Read more about versioning at semver.org. 10 | version: 1.0.0+1 11 | 12 | environment: 13 | sdk: ">=2.1.0 <3.0.0" 14 | 15 | dependencies: 16 | flutter: 17 | sdk: flutter 18 | 19 | clustering_google_maps: 20 | path: ../ 21 | 22 | # The following adds the Cupertino Icons font to your application. 23 | # Use with the CupertinoIcons class for iOS style icons. 24 | cupertino_icons: ^0.1.2 25 | 26 | dev_dependencies: 27 | flutter_test: 28 | sdk: flutter 29 | 30 | 31 | # For information on the generic Dart part of this file, see the 32 | # following page: https://www.dartlang.org/tools/pub/pubspec 33 | 34 | # The following section is specific to Flutter. 35 | flutter: 36 | 37 | # The following line ensures that the Material Icons font is 38 | # included with your application, so that you can use the icons in 39 | # the material Icons class. 40 | uses-material-design: true 41 | 42 | # To add assets to your application, add an assets section, like this: 43 | assets: 44 | - assets/map_point.json 45 | 46 | # An image asset can refer to one or more resolution-specific "variants", see 47 | # https://flutter.io/assets-and-images/#resolution-aware. 48 | 49 | # For details regarding adding assets from package dependencies, see 50 | # https://flutter.io/assets-and-images/#from-packages 51 | 52 | # To add custom fonts to your application, add a fonts section here, 53 | # in this "flutter" section. Each entry in this list should have a 54 | # "family" key with the font family name, and a "fonts" key with a 55 | # list giving the asset and other descriptors for the font. For 56 | # example: 57 | # fonts: 58 | # - family: Schyler 59 | # fonts: 60 | # - asset: fonts/Schyler-Regular.ttf 61 | # - asset: fonts/Schyler-Italic.ttf 62 | # style: italic 63 | # - family: Trajan Pro 64 | # fonts: 65 | # - asset: fonts/TrajanPro.ttf 66 | # - asset: fonts/TrajanPro_Bold.ttf 67 | # weight: 700 68 | # 69 | # For details regarding fonts from package dependencies, 70 | # see https://flutter.io/custom-fonts/#from-packages 71 | -------------------------------------------------------------------------------- /lib/clustering_google_maps.dart: -------------------------------------------------------------------------------- 1 | export 'package:clustering_google_maps/src/clustering_helper.dart'; 2 | export 'package:clustering_google_maps/src/aggregation_setup.dart'; 3 | export 'package:clustering_google_maps/src/lat_lang_geohash.dart'; 4 | -------------------------------------------------------------------------------- /lib/src/aggregated_points.dart: -------------------------------------------------------------------------------- 1 | import 'package:google_maps_flutter/google_maps_flutter.dart'; 2 | 3 | class AggregatedPoints { 4 | final LatLng location; 5 | final int count; 6 | String bitmabAssetName; 7 | 8 | AggregatedPoints(this.location, this.count) { 9 | this.bitmabAssetName = getBitmapDescriptor(); 10 | } 11 | 12 | AggregatedPoints.fromMap( 13 | Map map, String dbLatColumn, String dbLongColumn) 14 | : count = map['n_marker'], 15 | this.location = LatLng(map['lat'], map['long']) { 16 | this.bitmabAssetName = getBitmapDescriptor(); 17 | } 18 | 19 | String getBitmapDescriptor() { 20 | String bitmapDescriptor; 21 | if (count < 10) { 22 | // + 2 23 | bitmapDescriptor = "assets/images/m1.png"; 24 | } else if (count < 25) { 25 | // + 10 26 | bitmapDescriptor = "assets/images/m2.png"; 27 | } else if (count < 50) { 28 | // + 25 29 | bitmapDescriptor = "assets/images/m3.png"; 30 | } else if (count < 100) { 31 | // + 50 32 | bitmapDescriptor = "assets/images/m4.png"; 33 | } else if (count < 500) { 34 | // + 100 35 | bitmapDescriptor = "assets/images/m5.png"; 36 | } else if (count < 1000) { 37 | // +500 38 | bitmapDescriptor = "assets/images/m6.png"; 39 | } else { 40 | // + 1k 41 | bitmapDescriptor = "assets/images/m7.png"; 42 | } 43 | return bitmapDescriptor; 44 | } 45 | 46 | getId() { 47 | return location.latitude.toString() + 48 | "_" + 49 | location.longitude.toString() + 50 | "_$count"; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lib/src/aggregation_setup.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class AggregationSetup { 4 | /// List of integern number, they are the limit of aggregation range 5 | final List maxAggregationItems; 6 | 7 | /// List of MaterialColor, they are the color of the marker matching aggregation range 8 | final List colors; 9 | 10 | /// List of double, they are the limit of zoom when change the aggregation level 11 | final List maxZoomLimits; 12 | 13 | final int markerSize; 14 | 15 | AggregationSetup({ 16 | this.maxAggregationItems = const [10, 25, 50, 100, 500, 1000], 17 | this.colors = const [ 18 | Colors.grey, 19 | Colors.blue, 20 | Colors.green, 21 | Colors.yellow, 22 | Colors.orange, 23 | Colors.red, 24 | Colors.pink 25 | ], 26 | this.maxZoomLimits = const [ 27 | 3.0, 28 | 5.0, 29 | 7.5, 30 | 10.5, 31 | 13.0, 32 | 13.5, 33 | 14.5, 34 | ], 35 | this.markerSize = 150, 36 | }) : assert(maxAggregationItems.length == 6), 37 | assert(colors.length == 7), 38 | assert(maxZoomLimits.length == 7), 39 | assert(markerSize > 0); 40 | } 41 | -------------------------------------------------------------------------------- /lib/src/clustering_helper.dart: -------------------------------------------------------------------------------- 1 | import 'dart:typed_data'; 2 | import 'dart:async'; 3 | import 'dart:ui' as ui; 4 | import 'package:clustering_google_maps/src/aggregated_points.dart'; 5 | import 'package:clustering_google_maps/src/aggregation_setup.dart'; 6 | import 'package:clustering_google_maps/src/db_helper.dart'; 7 | import 'package:clustering_google_maps/src/lat_lang_geohash.dart'; 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter/painting.dart'; 10 | import 'package:google_maps_flutter/google_maps_flutter.dart'; 11 | import 'package:meta/meta.dart'; 12 | import 'package:sqflite/sqflite.dart'; 13 | 14 | class ClusteringHelper { 15 | ClusteringHelper.forDB({ 16 | @required this.dbTable, 17 | @required this.dbLatColumn, 18 | @required this.dbLongColumn, 19 | @required this.dbGeohashColumn, 20 | @required this.updateMarkers, 21 | this.database, 22 | this.whereClause = "", 23 | @required this.aggregationSetup, 24 | this.maxZoomForAggregatePoints = 13.5, 25 | this.bitmapAssetPathForSingleMarker, 26 | }) : assert(dbTable != null), 27 | assert(dbGeohashColumn != null), 28 | assert(dbLongColumn != null), 29 | assert(dbLatColumn != null), 30 | assert(aggregationSetup != null); 31 | 32 | ClusteringHelper.forMemory({ 33 | @required this.list, 34 | @required this.updateMarkers, 35 | this.maxZoomForAggregatePoints = 13.5, 36 | @required this.aggregationSetup, 37 | this.bitmapAssetPathForSingleMarker, 38 | }) : assert(list != null), 39 | assert(aggregationSetup != null); 40 | 41 | //After this value the map show the single points without aggregation 42 | final double maxZoomForAggregatePoints; 43 | 44 | //Database where we performed the queries 45 | Database database; 46 | 47 | //Name of table of the databasa SQLite where are stored the latitude, longitude and geoahash value 48 | String dbTable; 49 | 50 | //Name of column where is stored the latitude 51 | String dbLatColumn; 52 | 53 | //Name of column where is stored the longitude 54 | String dbLongColumn; 55 | 56 | //Name of column where is stored the geohash value 57 | String dbGeohashColumn; 58 | 59 | //Custom bitmap: string of assets position 60 | final String bitmapAssetPathForSingleMarker; 61 | 62 | //Custom bitmap: string of assets position 63 | final AggregationSetup aggregationSetup; 64 | 65 | //Where clause for query db 66 | String whereClause; 67 | 68 | GoogleMapController mapController; 69 | 70 | //Variable for save the last zoom 71 | double _currentZoom = 0.0; 72 | 73 | //Function called when the map must show single point without aggregation 74 | // if null the class use the default function 75 | Function showSinglePoint; 76 | 77 | //Function for update Markers on Google Map 78 | Function updateMarkers; 79 | 80 | //List of points for memory clustering 81 | List list; 82 | 83 | //Call during the editing of CameraPosition 84 | //If you want updateMap during the zoom in/out set forceUpdate to true 85 | //this is NOT RECCOMENDED 86 | onCameraMove(CameraPosition position, {forceUpdate = false}) { 87 | _currentZoom = position.zoom; 88 | if (forceUpdate) { 89 | updateMap(); 90 | } 91 | } 92 | 93 | //Call when user stop to move or zoom the map 94 | Future onMapIdle() async { 95 | updateMap(); 96 | } 97 | 98 | updateMap() { 99 | if (_currentZoom < maxZoomForAggregatePoints) { 100 | updateAggregatedPoints(zoom: _currentZoom); 101 | } else { 102 | if (showSinglePoint != null) { 103 | showSinglePoint(); 104 | } else { 105 | updatePoints(_currentZoom); 106 | } 107 | } 108 | } 109 | 110 | // Used for update list 111 | // NOT RECCOMENDED for good performance (SQL IS BETTER) 112 | updateData(List newList) { 113 | list = newList; 114 | updateMap(); 115 | } 116 | 117 | Future> getAggregatedPoints(double zoom) async { 118 | assert(() { 119 | print("loading aggregation"); 120 | return true; 121 | }()); 122 | 123 | int level = 5; 124 | 125 | if (zoom <= aggregationSetup.maxZoomLimits[0]) { 126 | level = 1; 127 | } else if (zoom < aggregationSetup.maxZoomLimits[1]) { 128 | level = 2; 129 | } else if (zoom < aggregationSetup.maxZoomLimits[2]) { 130 | level = 3; 131 | } else if (zoom < aggregationSetup.maxZoomLimits[3]) { 132 | level = 4; 133 | } else if (zoom < aggregationSetup.maxZoomLimits[4]) { 134 | level = 5; 135 | } else if (zoom < aggregationSetup.maxZoomLimits[5]) { 136 | level = 6; 137 | } else if (zoom < aggregationSetup.maxZoomLimits[6]) { 138 | level = 7; 139 | } 140 | 141 | try { 142 | List aggregatedPoints; 143 | final latLngBounds = await mapController.getVisibleRegion(); 144 | if (database != null) { 145 | aggregatedPoints = await DBHelper.getAggregatedPoints( 146 | database: database, 147 | dbTable: dbTable, 148 | dbLatColumn: dbLatColumn, 149 | dbLongColumn: dbLongColumn, 150 | dbGeohashColumn: dbGeohashColumn, 151 | level: level, 152 | latLngBounds: latLngBounds, 153 | whereClause: whereClause); 154 | } else { 155 | final listBounds = list.where((p) { 156 | final double leftTopLatitude = latLngBounds.northeast.latitude; 157 | final double leftTopLongitude = latLngBounds.southwest.longitude; 158 | final double rightBottomLatitude = latLngBounds.southwest.latitude; 159 | final double rightBottomLongitude = latLngBounds.northeast.longitude; 160 | 161 | final bool latQuery = (leftTopLatitude > rightBottomLatitude) 162 | ? p.location.latitude <= leftTopLatitude && 163 | p.location.latitude >= rightBottomLatitude 164 | : p.location.latitude <= leftTopLatitude || 165 | p.location.latitude >= rightBottomLatitude; 166 | 167 | final bool longQuery = (leftTopLongitude < rightBottomLongitude) 168 | ? p.location.longitude >= leftTopLongitude && 169 | p.location.longitude <= rightBottomLongitude 170 | : p.location.longitude >= leftTopLongitude || 171 | p.location.longitude <= rightBottomLongitude; 172 | return latQuery && longQuery; 173 | }).toList(); 174 | 175 | aggregatedPoints = _retrieveAggregatedPoints(listBounds, List(), level); 176 | } 177 | return aggregatedPoints; 178 | } catch (e) { 179 | assert(() { 180 | print(e.toString()); 181 | return true; 182 | }()); 183 | return List(); 184 | } 185 | } 186 | 187 | final List aggList = []; 188 | 189 | List _retrieveAggregatedPoints( 190 | List inputList, 191 | List resultList, 192 | int level) { 193 | assert(() { 194 | print("input list lenght: " + inputList.length.toString()); 195 | return true; 196 | }()); 197 | 198 | if (inputList.isEmpty) { 199 | return resultList; 200 | } 201 | final List newInputList = List.from(inputList); 202 | List tmp; 203 | final t = newInputList[0].geohash.substring(0, level); 204 | tmp = 205 | newInputList.where((p) => p.geohash.substring(0, level) == t).toList(); 206 | newInputList.removeWhere((p) => p.geohash.substring(0, level) == t); 207 | double latitude = 0; 208 | double longitude = 0; 209 | tmp.forEach((l) { 210 | latitude += l.location.latitude; 211 | longitude += l.location.longitude; 212 | }); 213 | final count = tmp.length; 214 | final a = 215 | AggregatedPoints(LatLng(latitude / count, longitude / count), count); 216 | resultList.add(a); 217 | return _retrieveAggregatedPoints(newInputList, resultList, level); 218 | } 219 | 220 | Future updateAggregatedPoints({double zoom = 0.0}) async { 221 | List aggregation = await getAggregatedPoints(zoom); 222 | 223 | assert(() { 224 | print("aggregation lenght: " + aggregation.length.toString()); 225 | return true; 226 | }()); 227 | 228 | final Set markers = {}; 229 | 230 | for (var i = 0; i < aggregation.length; i++) { 231 | final a = aggregation[i]; 232 | assert(() { 233 | print(a.count); 234 | return true; 235 | }()); 236 | 237 | BitmapDescriptor bitmapDescriptor; 238 | 239 | if (a.count == 1) { 240 | if (bitmapAssetPathForSingleMarker != null) { 241 | bitmapDescriptor = 242 | BitmapDescriptor.fromAsset(bitmapAssetPathForSingleMarker); 243 | } else { 244 | bitmapDescriptor = BitmapDescriptor.defaultMarker; 245 | } 246 | } else { 247 | // >1 248 | final Uint8List markerIcon = 249 | await getBytesFromCanvas(a.count.toString(), getColor(a.count)); 250 | bitmapDescriptor = BitmapDescriptor.fromBytes(markerIcon); 251 | } 252 | final MarkerId markerId = MarkerId(a.getId()); 253 | 254 | final marker = Marker( 255 | markerId: markerId, 256 | position: a.location, 257 | infoWindow: InfoWindow(title: a.count.toString()), 258 | icon: bitmapDescriptor, 259 | ); 260 | 261 | markers.add(marker); 262 | } 263 | updateMarkers(markers); 264 | } 265 | 266 | updatePoints(double zoom) async { 267 | assert(() { 268 | print("update single points"); 269 | return true; 270 | }()); 271 | 272 | try { 273 | List listOfPoints; 274 | if (database != null) { 275 | listOfPoints = await DBHelper.getPoints( 276 | database: database, 277 | dbTable: dbTable, 278 | dbLatColumn: dbLatColumn, 279 | dbLongColumn: dbLongColumn, 280 | whereClause: whereClause); 281 | } else { 282 | listOfPoints = list; 283 | } 284 | 285 | final Set markers = listOfPoints.map((p) { 286 | final MarkerId markerId = MarkerId(p.getId()); 287 | return Marker( 288 | markerId: markerId, 289 | position: p.location, 290 | infoWindow: InfoWindow( 291 | title: 292 | "${p.location.latitude.toStringAsFixed(2)},${p.location.longitude.toStringAsFixed(2)}"), 293 | icon: bitmapAssetPathForSingleMarker != null 294 | ? BitmapDescriptor.fromAsset(bitmapAssetPathForSingleMarker) 295 | : BitmapDescriptor.defaultMarker, 296 | ); 297 | }).toSet(); 298 | updateMarkers(markers); 299 | } catch (ex) { 300 | assert(() { 301 | print(ex.toString()); 302 | return true; 303 | }()); 304 | } 305 | } 306 | 307 | Future getBytesFromCanvas(String text, MaterialColor color) async { 308 | final ui.PictureRecorder pictureRecorder = ui.PictureRecorder(); 309 | final Canvas canvas = Canvas(pictureRecorder); 310 | final Paint paint1 = Paint()..color = color[400]; 311 | final Paint paint2 = Paint()..color = color[300]; 312 | final Paint paint3 = Paint()..color = color[100]; 313 | final int size = aggregationSetup.markerSize; 314 | canvas.drawCircle(Offset(size / 2, size / 2), size / 2.0, paint3); 315 | canvas.drawCircle(Offset(size / 2, size / 2), size / 2.4, paint2); 316 | canvas.drawCircle(Offset(size / 2, size / 2), size / 3.3, paint1); 317 | TextPainter painter = TextPainter(textDirection: TextDirection.ltr); 318 | painter.text = TextSpan( 319 | text: text, 320 | style: TextStyle( 321 | fontSize: size / 4, color: Colors.black, fontWeight: FontWeight.bold), 322 | ); 323 | painter.layout(); 324 | painter.paint( 325 | canvas, 326 | Offset(size / 2 - painter.width / 2, size / 2 - painter.height / 2), 327 | ); 328 | 329 | final img = await pictureRecorder.endRecording().toImage(size, size); 330 | final data = await img.toByteData(format: ui.ImageByteFormat.png); 331 | return data.buffer.asUint8List(); 332 | } 333 | 334 | MaterialColor getColor(int count) { 335 | if (count < aggregationSetup.maxAggregationItems[0]) { 336 | // + 2 337 | return aggregationSetup.colors[0]; 338 | } else if (count < aggregationSetup.maxAggregationItems[1]) { 339 | // + 10 340 | return aggregationSetup.colors[1]; 341 | } else if (count < aggregationSetup.maxAggregationItems[2]) { 342 | // + 25 343 | return aggregationSetup.colors[2]; 344 | } else if (count < aggregationSetup.maxAggregationItems[3]) { 345 | // + 50 346 | return aggregationSetup.colors[3]; 347 | } else if (count < aggregationSetup.maxAggregationItems[4]) { 348 | // + 100 349 | return aggregationSetup.colors[4]; 350 | } else if (count < aggregationSetup.maxAggregationItems[5]) { 351 | // +500 352 | return aggregationSetup.colors[5]; 353 | } else { 354 | // + 1k 355 | return aggregationSetup.colors[6]; 356 | } 357 | } 358 | } 359 | -------------------------------------------------------------------------------- /lib/src/db_helper.dart: -------------------------------------------------------------------------------- 1 | import 'package:clustering_google_maps/src/aggregated_points.dart'; 2 | import 'package:clustering_google_maps/src/lat_lang_geohash.dart'; 3 | import 'package:google_maps_flutter/google_maps_flutter.dart' show LatLngBounds; 4 | import 'package:meta/meta.dart'; 5 | import 'package:sqflite/sqflite.dart'; 6 | 7 | class DBHelper { 8 | static Future> getAggregatedPoints({ 9 | @required Database database, 10 | @required String dbTable, 11 | @required String dbLatColumn, 12 | @required String dbLongColumn, 13 | @required String dbGeohashColumn, 14 | @required int level, 15 | LatLngBounds latLngBounds, 16 | String whereClause = "", 17 | }) async { 18 | assert(() { 19 | print("--------- START QUERY AGGREGATION"); 20 | return true; 21 | }()); 22 | try { 23 | if (database == null) { 24 | throw Exception("Database must not be null"); 25 | } 26 | 27 | final String boundingBoxClause = buildBoundingBoxClause( 28 | latLngBounds, 29 | dbTable, 30 | dbLatColumn, 31 | dbLongColumn, 32 | ); 33 | 34 | whereClause = whereClause.isEmpty 35 | ? "WHERE $boundingBoxClause" 36 | : "$whereClause AND $boundingBoxClause"; 37 | 38 | final query = 39 | 'SELECT COUNT(*) as n_marker, AVG($dbLatColumn) as lat, AVG($dbLongColumn) as long ' 40 | 'FROM $dbTable $whereClause GROUP BY substr($dbGeohashColumn,1,$level);'; 41 | assert(() { 42 | print(query); 43 | return true; 44 | }()); 45 | var result = await database.rawQuery(query); 46 | 47 | List aggregatedPoints = new List(); 48 | 49 | for (Map item in result) { 50 | assert(() { 51 | print(item); 52 | return true; 53 | }()); 54 | var p = new AggregatedPoints.fromMap(item, dbLatColumn, dbLongColumn); 55 | aggregatedPoints.add(p); 56 | } 57 | assert(() { 58 | print("--------- COMPLETE QUERY AGGREGATION"); 59 | return true; 60 | }()); 61 | return aggregatedPoints; 62 | } catch (e) { 63 | assert(() { 64 | print(e.toString()); 65 | print("--------- COMPLETE QUERY AGGREGATION WITH ERROR"); 66 | return true; 67 | }()); 68 | return List(); 69 | } 70 | } 71 | 72 | static Future> getPoints( 73 | {@required Database database, 74 | @required String dbTable, 75 | @required String dbLatColumn, 76 | @required String dbLongColumn, 77 | String whereClause = ""}) async { 78 | try { 79 | var result = await database 80 | .rawQuery('SELECT $dbLatColumn as lat, $dbLongColumn as long ' 81 | 'FROM $dbTable $whereClause;'); 82 | List points = new List(); 83 | for (Map item in result) { 84 | var p = new LatLngAndGeohash.fromMap(item); 85 | points.add(p); 86 | } 87 | assert(() { 88 | print("--------- COMPLETE QUERY"); 89 | return true; 90 | }()); 91 | 92 | return points; 93 | } catch (e) { 94 | assert(() { 95 | print(e.toString()); 96 | return true; 97 | }()); 98 | return List(); 99 | } 100 | } 101 | 102 | static String buildBoundingBoxClause( 103 | LatLngBounds latLngBounds, String dbTable, String dbLat, String dbLong) { 104 | assert(() { 105 | print(latLngBounds.toString()); 106 | return true; 107 | }()); 108 | final double leftTopLatitude = latLngBounds.northeast.latitude; 109 | final double leftTopLongitude = latLngBounds.southwest.longitude; 110 | final double rightBottomLatitude = latLngBounds.southwest.latitude; 111 | final double rightBottomLongitude = latLngBounds.northeast.longitude; 112 | 113 | final latQuery = (leftTopLatitude > rightBottomLatitude) 114 | ? "($dbLat <= $leftTopLatitude AND $dbLat >= $rightBottomLatitude)" 115 | : "($dbLat <= $leftTopLatitude OR $dbLat >= $rightBottomLatitude)"; 116 | 117 | final longQuery = (leftTopLongitude < rightBottomLongitude) 118 | ? "($dbLong >= $leftTopLongitude AND $dbLong <= $rightBottomLongitude)" 119 | : "($dbLong >= $leftTopLongitude OR $dbLong <= $rightBottomLongitude)"; 120 | 121 | return "$latQuery AND $longQuery"; 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /lib/src/lat_lang_geohash.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | import 'package:google_maps_flutter/google_maps_flutter.dart' show LatLng; 3 | import 'package:geohash/geohash.dart'; 4 | 5 | class LatLngAndGeohash { 6 | final LatLng location; 7 | String geohash; 8 | 9 | LatLngAndGeohash(this.location) { 10 | geohash = Geohash.encode(location.latitude, location.longitude); 11 | } 12 | 13 | LatLngAndGeohash.fromMap(Map map) 14 | : location = LatLng(map['lat'], map['long']) { 15 | this.geohash = 16 | Geohash.encode(this.location.latitude, this.location.longitude); 17 | } 18 | 19 | getId() { 20 | return location.latitude.toString() + 21 | "_" + 22 | location.longitude.toString() + 23 | "_${Random().nextInt(10000)}"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | archive: 5 | dependency: transitive 6 | description: 7 | name: archive 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.0.10" 11 | args: 12 | dependency: transitive 13 | description: 14 | name: args 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.5.2" 18 | async: 19 | dependency: transitive 20 | description: 21 | name: async 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.3.0" 25 | boolean_selector: 26 | dependency: transitive 27 | description: 28 | name: boolean_selector 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.0.5" 32 | charcode: 33 | dependency: transitive 34 | description: 35 | name: charcode 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.2" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.14.11" 46 | convert: 47 | dependency: transitive 48 | description: 49 | name: convert 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "2.1.1" 53 | crypto: 54 | dependency: transitive 55 | description: 56 | name: crypto 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "2.1.3" 60 | flutter: 61 | dependency: "direct main" 62 | description: flutter 63 | source: sdk 64 | version: "0.0.0" 65 | flutter_test: 66 | dependency: "direct dev" 67 | description: flutter 68 | source: sdk 69 | version: "0.0.0" 70 | geohash: 71 | dependency: "direct main" 72 | description: 73 | name: geohash 74 | url: "https://pub.dartlang.org" 75 | source: hosted 76 | version: "0.2.1" 77 | google_maps_flutter: 78 | dependency: "direct main" 79 | description: 80 | name: google_maps_flutter 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "0.5.21+8" 84 | image: 85 | dependency: transitive 86 | description: 87 | name: image 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "2.1.4" 91 | matcher: 92 | dependency: transitive 93 | description: 94 | name: matcher 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "0.12.5" 98 | meta: 99 | dependency: "direct main" 100 | description: 101 | name: meta 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "1.1.7" 105 | path: 106 | dependency: transitive 107 | description: 108 | name: path 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "1.6.4" 112 | path_provider: 113 | dependency: "direct main" 114 | description: 115 | name: path_provider 116 | url: "https://pub.dartlang.org" 117 | source: hosted 118 | version: "1.1.0" 119 | pedantic: 120 | dependency: transitive 121 | description: 122 | name: pedantic 123 | url: "https://pub.dartlang.org" 124 | source: hosted 125 | version: "1.8.0+1" 126 | petitparser: 127 | dependency: transitive 128 | description: 129 | name: petitparser 130 | url: "https://pub.dartlang.org" 131 | source: hosted 132 | version: "2.4.0" 133 | quiver: 134 | dependency: transitive 135 | description: 136 | name: quiver 137 | url: "https://pub.dartlang.org" 138 | source: hosted 139 | version: "2.0.5" 140 | sky_engine: 141 | dependency: transitive 142 | description: flutter 143 | source: sdk 144 | version: "0.0.99" 145 | source_span: 146 | dependency: transitive 147 | description: 148 | name: source_span 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "1.5.5" 152 | sqflite: 153 | dependency: "direct main" 154 | description: 155 | name: sqflite 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "1.1.6+1" 159 | stack_trace: 160 | dependency: transitive 161 | description: 162 | name: stack_trace 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "1.9.3" 166 | stream_channel: 167 | dependency: transitive 168 | description: 169 | name: stream_channel 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "2.0.0" 173 | string_scanner: 174 | dependency: transitive 175 | description: 176 | name: string_scanner 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "1.0.5" 180 | synchronized: 181 | dependency: transitive 182 | description: 183 | name: synchronized 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "2.1.0+1" 187 | term_glyph: 188 | dependency: transitive 189 | description: 190 | name: term_glyph 191 | url: "https://pub.dartlang.org" 192 | source: hosted 193 | version: "1.1.0" 194 | test_api: 195 | dependency: transitive 196 | description: 197 | name: test_api 198 | url: "https://pub.dartlang.org" 199 | source: hosted 200 | version: "0.2.5" 201 | typed_data: 202 | dependency: transitive 203 | description: 204 | name: typed_data 205 | url: "https://pub.dartlang.org" 206 | source: hosted 207 | version: "1.1.6" 208 | vector_math: 209 | dependency: transitive 210 | description: 211 | name: vector_math 212 | url: "https://pub.dartlang.org" 213 | source: hosted 214 | version: "2.0.8" 215 | xml: 216 | dependency: transitive 217 | description: 218 | name: xml 219 | url: "https://pub.dartlang.org" 220 | source: hosted 221 | version: "3.5.0" 222 | sdks: 223 | dart: ">=2.4.0 <3.0.0" 224 | flutter: ">=1.5.0 <2.0.0" 225 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: clustering_google_maps 2 | description: A Flutter package that recreate clustering technique in a Google Maps widget. 3 | version: 0.1.2 4 | author: Gian Marco Di Francesco 5 | homepage: https://github.com/giandifra/clustering_google_maps 6 | 7 | environment: 8 | sdk: ">=2.1.0 <3.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | geohash: ^0.2.1 15 | sqflite: ^1.1.5 16 | path_provider: ^1.1.0 17 | google_maps_flutter: ^1.0.3 18 | meta: ^1.1.6 19 | 20 | dev_dependencies: 21 | flutter_test: 22 | sdk: flutter 23 | 24 | # For information on the generic Dart part of this file, see the 25 | # following page: https://www.dartlang.org/tools/pub/pubspec 26 | 27 | # The following section is specific to Flutter. 28 | flutter: 29 | 30 | # To add assets to your package, add an assets section, like this: 31 | assets: 32 | - assets/images/m1.png 33 | - assets/images/m2.png 34 | - assets/images/m3.png 35 | - assets/images/m4.png 36 | - assets/images/m5.png 37 | - assets/images/m6.png 38 | - assets/images/m7.png 39 | # For details regarding assets in packages, see 40 | # https://flutter.io/assets-and-images/#from-packages 41 | # 42 | # An image asset can refer to one or more resolution-specific "variants", see 43 | # https://flutter.io/assets-and-images/#resolution-aware. 44 | 45 | # To add custom fonts to your package, add a fonts section here, 46 | # in this "flutter" section. Each entry in this list should have a 47 | # "family" key with the font family name, and a "fonts" key with a 48 | # list giving the asset and other descriptors for the font. For 49 | # example: 50 | # fonts: 51 | # - family: Schyler 52 | # fonts: 53 | # - asset: fonts/Schyler-Regular.ttf 54 | # - asset: fonts/Schyler-Italic.ttf 55 | # style: italic 56 | # - family: Trajan Pro 57 | # fonts: 58 | # - asset: fonts/TrajanPro.ttf 59 | # - asset: fonts/TrajanPro_Bold.ttf 60 | # weight: 700 61 | # 62 | # For details regarding fonts in packages, see 63 | # https://flutter.io/custom-fonts/#from-packages 64 | --------------------------------------------------------------------------------