├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── config.yml │ └── feature_request.md ├── dependabot.yml └── workflows │ └── stale.yaml ├── .gitignore ├── .idea ├── .gitignore ├── .name ├── codeStyles │ ├── Project.xml │ └── codeStyleConfig.xml ├── misc.xml ├── modules.xml ├── runConfigurations │ ├── dart_format.xml │ ├── flutter_analyze.xml │ ├── flutter_pub_publish.xml │ └── main_dart.xml └── vcs.xml ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── assets └── interface.jpg ├── example ├── .gitignore ├── .idea │ ├── misc.xml │ ├── modules.xml │ └── runConfigurations │ │ └── main_dart.xml ├── .metadata ├── analysis_options.yaml ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── net │ │ │ │ │ └── tlserver6y │ │ │ │ │ └── flutter_map_location_marker │ │ │ │ │ └── example │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── drawable-v21 │ │ │ │ └── launch_background.xml │ │ │ │ ├── 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-night │ │ │ │ └── styles.xml │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── example_android.iml │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── example.iml ├── example.md ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Podfile │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── 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 │ ├── main.dart │ └── page │ │ ├── animation_debugger.dart │ │ ├── center_fab_example.dart │ │ ├── custom_stream_example.dart │ │ ├── customize_marker_example.dart │ │ ├── default_stream_example.dart │ │ ├── geolocator_settings_example.dart │ │ ├── indicators_example.dart │ │ ├── minimum_example.dart │ │ ├── navigation_example.dart │ │ ├── no_stream_example.dart │ │ ├── selectable_distance_filter_example.dart │ │ └── stream_debugger.dart ├── linux │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ │ └── CMakeLists.txt │ ├── main.cc │ ├── my_application.cc │ └── my_application.h ├── macos │ ├── .gitignore │ ├── Flutter │ │ ├── Flutter-Debug.xcconfig │ │ └── Flutter-Release.xcconfig │ ├── Podfile │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ └── app_icon_64.png │ │ ├── Base.lproj │ │ └── MainMenu.xib │ │ ├── Configs │ │ ├── AppInfo.xcconfig │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── Warnings.xcconfig │ │ ├── DebugProfile.entitlements │ │ ├── Info.plist │ │ ├── MainFlutterWindow.swift │ │ └── Release.entitlements ├── pubspec.lock ├── pubspec.yaml ├── web │ ├── favicon.png │ ├── icons │ │ ├── Icon-192.png │ │ ├── Icon-512.png │ │ ├── Icon-maskable-192.png │ │ └── Icon-maskable-512.png │ ├── index.html │ └── manifest.json └── windows │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ └── CMakeLists.txt │ └── runner │ ├── CMakeLists.txt │ ├── Runner.rc │ ├── flutter_window.cpp │ ├── flutter_window.h │ ├── main.cpp │ ├── resource.h │ ├── resources │ └── app_icon.ico │ ├── runner.exe.manifest │ ├── utils.cpp │ ├── utils.h │ ├── win32_window.cpp │ └── win32_window.h ├── flutter_map_location_marker.iml ├── lib ├── flutter_map_location_marker.dart └── src │ ├── data │ ├── data.dart │ ├── data_stream_factory.dart │ └── tween.dart │ ├── drawings │ ├── default_location_marker.dart │ └── heading_sector.dart │ ├── exceptions │ ├── incorrect_setup_exception.dart │ ├── permission_denied_exception.dart │ ├── permission_requesting_exception.dart │ └── service_disabled_exception.dart │ ├── options │ ├── align_on_update.dart │ ├── focal_point.dart │ ├── indicators.dart │ ├── marker_direction.dart │ └── style.dart │ └── widgets │ ├── animated_location_marker_layer.dart │ ├── current_location_layer.dart │ └── location_marker_layer.dart ├── notes └── migration_v5.md └── pubspec.yaml /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: tlserver 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | contact_links: 2 | - name: How to... ? 3 | url: https://discord.gg/BwpEsjqMAH 4 | about: For how-to questions, please join the FM Discord server and ask there! -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "pub" 4 | directory: "/" 5 | schedule: 6 | interval: "daily" 7 | -------------------------------------------------------------------------------- /.github/workflows/stale.yaml: -------------------------------------------------------------------------------- 1 | name: 'Stale' 2 | on: 3 | schedule: 4 | - cron: '16 10 * * *' 5 | 6 | jobs: 7 | stale: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/stale@v5 11 | with: 12 | repo-token: ${{ github.token }} 13 | stale-issue-message: 'This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.' 14 | stale-pr-message: 'This PR is stale because it has been open for 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.' 15 | close-issue-message: 'This issue was closed because it has been stalled for 7 days with no activity.' 16 | close-pr-message: 'This PR was closed because it has been stalled for 14 days with no activity.' 17 | close-issue-reason: 'not_planned' 18 | days-before-issue-stale: 30 19 | days-before-issue-close: 7 20 | days-before-pr-stale: 60 21 | days-before-pr-close: 14 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.toptal.com/developers/gitignore/api/jetbrains,flutter 2 | # Edit at https://www.toptal.com/developers/gitignore?templates=jetbrains,flutter 3 | 4 | ### Flutter ### 5 | # Flutter/Dart/Pub related 6 | **/doc/api/ 7 | .dart_tool/ 8 | .flutter-plugins 9 | .flutter-plugins-dependencies 10 | .fvm/flutter_sdk 11 | .packages 12 | .pub-cache/ 13 | .pub/ 14 | build/ 15 | coverage/ 16 | lib/generated_plugin_registrant.dart 17 | # For library packages, don’t commit the pubspec.lock file. 18 | # Regenerating the pubspec.lock file lets you test your package against the latest compatible versions of its dependencies. 19 | # See https://dart.dev/guides/libraries/private-files#pubspeclock 20 | pubspec.lock 21 | 22 | # Android related 23 | **/android/**/gradle-wrapper.jar 24 | **/android/.gradle 25 | **/android/captures/ 26 | **/android/gradlew 27 | **/android/gradlew.bat 28 | **/android/key.properties 29 | **/android/local.properties 30 | **/android/**/GeneratedPluginRegistrant.java 31 | 32 | # iOS/XCode related 33 | **/ios/**/*.mode1v3 34 | **/ios/**/*.mode2v3 35 | **/ios/**/*.moved-aside 36 | **/ios/**/*.pbxuser 37 | **/ios/**/*.perspectivev3 38 | **/ios/**/*sync/ 39 | **/ios/**/.sconsign.dblite 40 | **/ios/**/.tags* 41 | **/ios/**/.vagrant/ 42 | **/ios/**/DerivedData/ 43 | **/ios/**/Icon? 44 | **/ios/**/Pods/ 45 | **/ios/**/.symlinks/ 46 | **/ios/**/profile 47 | **/ios/**/xcuserdata 48 | **/ios/.generated/ 49 | **/ios/Flutter/.last_build_id 50 | **/ios/Flutter/App.framework 51 | **/ios/Flutter/Flutter.framework 52 | **/ios/Flutter/Flutter.podspec 53 | **/ios/Flutter/Generated.xcconfig 54 | **/ios/Flutter/ephemeral 55 | **/ios/Flutter/app.flx 56 | **/ios/Flutter/app.zip 57 | **/ios/Flutter/flutter_assets/ 58 | **/ios/Flutter/flutter_export_environment.sh 59 | **/ios/ServiceDefinitions.json 60 | **/ios/Runner/GeneratedPluginRegistrant.* 61 | 62 | # macOS 63 | **/macos/Flutter/GeneratedPluginRegistrant.swift 64 | **/macos/Flutter/ephemeral 65 | 66 | # windows 67 | **/windows/flutter/generated_plugin_registrant.cc 68 | **/windows/flutter/generated_plugin_registrant.h 69 | **/windows/flutter/generated_plugins.cmake 70 | **/windows/flutter/ephemeral 71 | 72 | # linux 73 | **/linux/flutter/generated_plugin_registrant.cc 74 | **/linux/flutter/generated_plugin_registrant.h 75 | **/linux/flutter/generated_plugins.cmake 76 | **/linux/flutter/ephemeral 77 | 78 | # Exceptions to above rules. 79 | !**/ios/**/default.mode1v3 80 | !**/ios/**/default.mode2v3 81 | !**/ios/**/default.pbxuser 82 | !**/ios/**/default.perspectivev3 83 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 84 | 85 | ### JetBrains ### 86 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider 87 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 88 | 89 | # User-specific stuff 90 | .idea/**/workspace.xml 91 | .idea/**/tasks.xml 92 | .idea/**/usage.statistics.xml 93 | .idea/**/dictionaries 94 | .idea/**/shelf 95 | 96 | # AWS User-specific 97 | .idea/**/aws.xml 98 | 99 | # Generated files 100 | .idea/**/contentModel.xml 101 | 102 | # Sensitive or high-churn files 103 | .idea/**/dataSources/ 104 | .idea/**/dataSources.ids 105 | .idea/**/dataSources.local.xml 106 | .idea/**/sqlDataSources.xml 107 | .idea/**/dynamic.xml 108 | .idea/**/uiDesigner.xml 109 | .idea/**/dbnavigator.xml 110 | 111 | # Gradle 112 | .idea/**/gradle.xml 113 | .idea/**/libraries 114 | 115 | # Gradle and Maven with auto-import 116 | # When using Gradle or Maven with auto-import, you should exclude module files, 117 | # since they will be recreated, and may cause churn. Uncomment if using 118 | # auto-import. 119 | # .idea/artifacts 120 | # .idea/compiler.xml 121 | # .idea/jarRepositories.xml 122 | # .idea/modules.xml 123 | # .idea/*.iml 124 | # .idea/modules 125 | # *.iml 126 | # *.ipr 127 | 128 | # CMake 129 | cmake-build-*/ 130 | 131 | # Mongo Explorer plugin 132 | .idea/**/mongoSettings.xml 133 | 134 | # File-based project format 135 | *.iws 136 | 137 | # IntelliJ 138 | out/ 139 | 140 | # mpeltonen/sbt-idea plugin 141 | .idea_modules/ 142 | 143 | # JIRA plugin 144 | atlassian-ide-plugin.xml 145 | 146 | # Cursive Clojure plugin 147 | .idea/replstate.xml 148 | 149 | # SonarLint plugin 150 | .idea/sonarlint/ 151 | 152 | # Crashlytics plugin (for Android Studio and IntelliJ) 153 | com_crashlytics_export_strings.xml 154 | crashlytics.properties 155 | crashlytics-build.properties 156 | fabric.properties 157 | 158 | # Editor-based Rest Client 159 | .idea/httpRequests 160 | 161 | # Android studio 3.1+ serialized cache file 162 | .idea/caches/build_file_checksums.ser 163 | 164 | ### JetBrains Patch ### 165 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 166 | 167 | # *.iml 168 | # modules.xml 169 | # .idea/misc.xml 170 | # *.ipr 171 | 172 | # Sonarlint plugin 173 | # https://plugins.jetbrains.com/plugin/7973-sonarlint 174 | .idea/**/sonarlint/ 175 | 176 | # SonarQube Plugin 177 | # https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin 178 | .idea/**/sonarIssues.xml 179 | 180 | # Markdown Navigator plugin 181 | # https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced 182 | .idea/**/markdown-navigator.xml 183 | .idea/**/markdown-navigator-enh.xml 184 | .idea/**/markdown-navigator/ 185 | 186 | # Cache file creation bug 187 | # See https://youtrack.jetbrains.com/issue/JBR-2257 188 | .idea/$CACHE_FILE$ 189 | 190 | # CodeStream plugin 191 | # https://plugins.jetbrains.com/plugin/12206-codestream 192 | .idea/codestream.xml 193 | 194 | # Azure Toolkit for IntelliJ plugin 195 | # https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij 196 | .idea/**/azureSettings.xml 197 | 198 | # End of https://www.toptal.com/developers/gitignore/api/jetbrains,flutter -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /caches/ 3 | /libraries/ 4 | /shelf/ 5 | /workspace.xml 6 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | FlutterMapLocationMarker -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 130 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/runConfigurations/dart_format.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | -------------------------------------------------------------------------------- /.idea/runConfigurations/flutter_analyze.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | -------------------------------------------------------------------------------- /.idea/runConfigurations/flutter_pub_publish.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | -------------------------------------------------------------------------------- /.idea/runConfigurations/main_dart.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.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: 2ae34518b87dd891355ed6c6ea8cb68c4d52bb9d 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2020, tlserver. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above 9 | copyright notice, this list of conditions and the following 10 | disclaimer in the documentation and/or other materials provided 11 | with the distribution. 12 | * Neither the name of Google Inc. nor the names of its 13 | contributors may be used to endorse or promote products derived 14 | from this software without specific prior written permission. 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # flutter_map_location_marker 2 | 3 | [![pub package](https://img.shields.io/pub/v/flutter_map_location_marker)](https://pub.dev/packages/flutter_map_location_marker) 4 | [![github tag](https://img.shields.io/github/v/tag/tlserver/flutter_map_location_marker?include_prereleases&sort=semver)](https://github.com/tlserver/flutter_map_location_marker) 5 | [![license](https://img.shields.io/github/license/tlserver/flutter_map_location_marker)](https://github.com/tlserver/flutter_map_location_marker/blob/main/LICENSE) 6 | 7 | `flutter_map_location_marker` is a [flutter_map](https://pub.dev/packages/flutter_map) plugin for 8 | displaying device's current location on a map. It provides a simple and flexible way to add a 9 | customizable location marker to your map. 10 |
11 | Interface preview 12 | 13 | Join [flutter_map Discord server](https://discord.gg/BwpEsjqMAH) to talk 14 | about `flutter_map_location_marker`, get help and help others in the #plugins channel. 15 | 16 | ## Features 17 | 18 | - **Simple**: The only thing you need to do is to add a `CurrentLocationLayer()` in to your map 19 | because all parameters have good default values. 20 | 21 | - **Flexible**: The default implementation receives the device's position from 22 | the [geolocator](https://pub.dev/packages/geolocator) package and the device's heading from 23 | the [flutter_compass](https://pub.dev/packages/flutter_compass) package, but with type conversion, 24 | streams from other sources are also supported. 25 | 26 | - **Auto-following**: The map follows the new location when location is updated. This feature is 27 | disabled by default. 28 | 29 | - **Auto-rotating**: The map can be rotated automatically as navigation mode. This feature is 30 | disabled by default. 31 | 32 | - **Customization**: The location marker can be fully customized, including the colors of the 33 | accuracy circle and header. 34 | 35 | ## Usage 36 | 37 | 1. Add `flutter_map_location_marker` to your `pubspec.yaml`: 38 | ```yaml 39 | dependencies: 40 | flutter_map_location_marker: any # or latest version 41 | ``` 42 | 43 | 2. Add permission by following the instructions from 44 | the [geolocator](https://pub.dev/packages/geolocator#usage) package. 45 | 46 | 3. Add the layer widget into `FlutterMap`: 47 | ```dart 48 | Widget build(BuildContext context) { 49 | return FlutterMap( 50 | children: [ 51 | TileLayer( 52 | urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', 53 | maxZoom: 19, 54 | ), 55 | CurrentLocationLayer(), // <-- add layer here 56 | ], 57 | ); 58 | } 59 | ``` 60 | 61 | 4. Discover more parameters 62 | in [CurrentLocationLayer](https://pub.dev/documentation/flutter_map_location_marker/latest/flutter_map_location_marker/CurrentLocationLayer-class.html) 63 | . 64 | 65 | ```dart 66 | Widget build() { 67 | return CurrentLocationLayer( 68 | alignPositionOnUpdate: AlignOnUpdate.always, 69 | alignDirectionOnUpdate: AlignOnUpdate.never, 70 | style: LocationMarkerStyle( 71 | marker: const DefaultLocationMarker( 72 | child: Icon( 73 | Icons.navigation, 74 | color: Colors.white, 75 | ), 76 | ), 77 | markerSize: const Size(40, 40), 78 | markerDirection: MarkerDirection.heading, 79 | ), 80 | ); 81 | } 82 | ``` 83 | 84 | 5. Consider using either 85 | the [AnimatedLocationMarkerLayer](https://pub.dev/documentation/flutter_map_location_marker/latest/flutter_map_location_marker/AnimatedLocationMarkerLayer-class.html) 86 | or 87 | the [LocationMarkerLayer](https://pub.dev/documentation/flutter_map_location_marker/latest/flutter_map_location_marker/LocationMarkerLayer-class.html) 88 | if multiple location markers need to be displayed. 89 | 90 | ## Examples 91 | 92 | 1. [Marker Customization](https://github.com/tlserver/flutter_map_location_marker/blob/main/example/lib/page/customize_marker_example.dart) : 93 | Change the marker to any widget you want. 94 | 95 | 2. [Floating Action Button to Follow Current Location](https://github.com/tlserver/flutter_map_location_marker/blob/main/example/lib/page/center_fab_example.dart) : 96 | Use a floating action button to move and zoom the map to the current location. 97 | 98 | 3. [Change Geolocator Settings](https://github.com/tlserver/flutter_map_location_marker/blob/main/example/lib/page/geolocator_settings_example.dart) : 99 | Define Geolocator settings yourself. 100 | 101 | 4. [Selectable Distance Filter](https://github.com/tlserver/flutter_map_location_marker/blob/main/example/lib/page/selectable_distance_filter_example.dart) : 102 | Change Geolocator settings at the runtime. 103 | 104 | 5. [Custom Stream](https://github.com/tlserver/flutter_map_location_marker/blob/main/example/lib/page/custom_stream_example.dart) : 105 | Use your own stream, such as position stream from another library or predefined route, as the 106 | source. 107 | 108 | 6. [No Stream](https://github.com/tlserver/flutter_map_location_marker/blob/main/example/lib/page/no_stream_example.dart) : 109 | Use Flutter `setState()` to update position and heading. 110 | 111 | 7. [Navigation Mode](https://github.com/tlserver/flutter_map_location_marker/blob/main/example/lib/page/navigation_example.dart) : 112 | Rotate the map to keep heading pointing upward. 113 | 114 | 8. [Default Stream](https://github.com/tlserver/flutter_map_location_marker/blob/main/example/lib/page/default_stream_example.dart) : 115 | Share the default streams between your app and this plugin. 116 | 117 | ## FAQ 118 | 119 | *Q*: How to get 120 | the [positionStream](https://pub.dev/documentation/flutter_map_location_marker/5.1.0/flutter_map_location_marker/CurrentLocationLayer/positionStream.html) 121 | , [headingStream](https://pub.dev/documentation/flutter_map_location_marker/5.1.0/flutter_map_location_marker/CurrentLocationLayer/headingStream.html) 122 | or their origin streams from a CurrentLocationLayer widget? 123 | 124 | *A*: No, you should not get these streams from a CurrentLocationLayer widget. Instead, create you 125 | own streams with the the same types and also pass it to all the widgets which need them. 126 | CurrentLocationLayer doesn't own the streams; it just listens to them. You can use any 127 | implementation of position and heading streams, as long as the stream types are 128 | Stream<LocationMarkerPosition?> and Stream<LocationMarkerHeading?>, respectively. You 129 | may 130 | see [this example](https://github.com/tlserver/flutter_map_location_marker/blob/main/example/lib/page/default_stream_example.dart) 131 | to know about how to do this. 132 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer to use the lint rule set from `package:lint` 2 | include: package:flutter_lints/flutter.yaml 3 | 4 | linter: 5 | rules: 6 | - avoid_dynamic_calls 7 | - cancel_subscriptions 8 | - close_sinks 9 | - comment_references 10 | - deprecated_member_use_from_same_package 11 | - diagnostic_describe_all_properties 12 | - literal_only_boolean_expressions 13 | - no_self_assignments 14 | - no_wildcard_variable_uses 15 | - prefer_relative_imports 16 | - prefer_void_to_null 17 | - test_types_in_equals 18 | - throw_in_finally 19 | - unnecessary_statements 20 | 21 | - avoid_bool_literals_in_conditional_expressions 22 | - avoid_catches_without_on_clauses 23 | - avoid_catching_errors 24 | - avoid_classes_with_only_static_members 25 | - avoid_double_and_int_checks 26 | - avoid_equals_and_hash_code_on_mutable_classes 27 | - avoid_escaping_inner_quotes 28 | - avoid_final_parameters 29 | - avoid_implementing_value_types 30 | - avoid_js_rounded_ints 31 | - avoid_multiple_declarations_per_line 32 | - avoid_positional_boolean_parameters 33 | - avoid_redundant_argument_values 34 | - avoid_returning_this 35 | - avoid_setters_without_getters 36 | - avoid_types_on_closure_parameters 37 | - avoid_unused_constructor_parameters 38 | - avoid_void_async 39 | - cascade_invocations 40 | - cast_nullable_to_non_nullable 41 | - combinators_ordering 42 | - conditional_uri_does_not_exist 43 | - deprecated_consistency 44 | - directives_ordering 45 | - do_not_use_environment 46 | - eol_at_end_of_file 47 | - join_return_with_assignment 48 | - leading_newlines_in_multiline_strings 49 | - library_annotations 50 | - lines_longer_than_80_chars 51 | - matching_super_parameters 52 | - missing_whitespace_between_adjacent_strings 53 | - no_literal_bool_comparisons 54 | - no_runtimeType_toString 55 | - noop_primitive_operations 56 | - omit_local_variable_types 57 | - one_member_abstracts 58 | - only_throw_errors 59 | - prefer_asserts_in_initializer_lists 60 | - prefer_asserts_with_message 61 | - prefer_constructors_over_static_methods 62 | - prefer_expression_function_bodies 63 | - prefer_final_fields 64 | - prefer_final_in_for_each 65 | - prefer_foreach 66 | - prefer_if_elements_to_conditional_expressions 67 | - prefer_int_literals 68 | - prefer_mixin 69 | - prefer_null_aware_method_calls 70 | - prefer_single_quotes 71 | - require_trailing_commas 72 | - sized_box_shrink_expand 73 | - sort_unnamed_constructors_first 74 | - tighten_type_of_initializing_formals 75 | - type_annotate_public_apis 76 | - unawaited_futures 77 | - unnecessary_await_in_return 78 | - unnecessary_breaks 79 | - unnecessary_lambdas 80 | - unnecessary_library_directive 81 | - unnecessary_null_aware_operator_on_extension_on_nullable 82 | - unnecessary_parenthesis 83 | - unnecessary_raw_strings 84 | - unreachable_from_main 85 | - use_colored_box 86 | - use_decorated_box 87 | - use_enums 88 | - use_if_null_to_convert_nulls_to_bools 89 | - use_is_even_rather_than_modulo 90 | - use_named_constants 91 | - use_raw_strings 92 | - use_setters_to_change_properties 93 | - use_string_buffers 94 | - use_test_throws_matchers 95 | - use_to_and_as_if_applicable 96 | 97 | - sort_pub_dependencies 98 | -------------------------------------------------------------------------------- /assets/interface.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/assets/interface.jpg -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.toptal.com/developers/gitignore/api/jetbrains,flutter 2 | # Edit at https://www.toptal.com/developers/gitignore?templates=jetbrains,flutter 3 | 4 | ### Flutter ### 5 | # Flutter/Dart/Pub related 6 | **/doc/api/ 7 | .dart_tool/ 8 | .flutter-plugins 9 | .flutter-plugins-dependencies 10 | .fvm/flutter_sdk 11 | .packages 12 | .pub-cache/ 13 | .pub/ 14 | build/ 15 | coverage/ 16 | lib/generated_plugin_registrant.dart 17 | # For library packages, don’t commit the pubspec.lock file. 18 | # Regenerating the pubspec.lock file lets you test your package against the latest compatible versions of its dependencies. 19 | # See https://dart.dev/guides/libraries/private-files#pubspeclock 20 | !pubspec.lock 21 | 22 | # Android related 23 | **/android/**/gradle-wrapper.jar 24 | **/android/.gradle 25 | **/android/captures/ 26 | **/android/gradlew 27 | **/android/gradlew.bat 28 | **/android/key.properties 29 | **/android/local.properties 30 | **/android/**/GeneratedPluginRegistrant.java 31 | 32 | # iOS/XCode related 33 | **/ios/**/*.mode1v3 34 | **/ios/**/*.mode2v3 35 | **/ios/**/*.moved-aside 36 | **/ios/**/*.pbxuser 37 | **/ios/**/*.perspectivev3 38 | **/ios/**/*sync/ 39 | **/ios/**/.sconsign.dblite 40 | **/ios/**/.tags* 41 | **/ios/**/.vagrant/ 42 | **/ios/**/DerivedData/ 43 | **/ios/**/Icon? 44 | **/ios/**/Pods/ 45 | **/ios/**/.symlinks/ 46 | **/ios/**/profile 47 | **/ios/**/xcuserdata 48 | **/ios/.generated/ 49 | **/ios/Flutter/.last_build_id 50 | **/ios/Flutter/App.framework 51 | **/ios/Flutter/Flutter.framework 52 | **/ios/Flutter/Flutter.podspec 53 | **/ios/Flutter/Generated.xcconfig 54 | **/ios/Flutter/ephemeral 55 | **/ios/Flutter/app.flx 56 | **/ios/Flutter/app.zip 57 | **/ios/Flutter/flutter_assets/ 58 | **/ios/Flutter/flutter_export_environment.sh 59 | **/ios/ServiceDefinitions.json 60 | **/ios/Runner/GeneratedPluginRegistrant.* 61 | 62 | # macOS 63 | **/macos/Flutter/GeneratedPluginRegistrant.swift 64 | **/macos/Flutter/ephemeral 65 | 66 | # windows 67 | **/windows/flutter/generated_plugin_registrant.cc 68 | **/windows/flutter/generated_plugin_registrant.h 69 | **/windows/flutter/generated_plugins.cmake 70 | **/windows/flutter/ephemeral 71 | 72 | # linux 73 | **/linux/flutter/generated_plugin_registrant.cc 74 | **/linux/flutter/generated_plugin_registrant.h 75 | **/linux/flutter/generated_plugins.cmake 76 | **/linux/flutter/ephemeral 77 | 78 | # Exceptions to above rules. 79 | !**/ios/**/default.mode1v3 80 | !**/ios/**/default.mode2v3 81 | !**/ios/**/default.pbxuser 82 | !**/ios/**/default.perspectivev3 83 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 84 | 85 | ### JetBrains ### 86 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider 87 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 88 | 89 | # User-specific stuff 90 | .idea/**/workspace.xml 91 | .idea/**/tasks.xml 92 | .idea/**/usage.statistics.xml 93 | .idea/**/dictionaries 94 | .idea/**/shelf 95 | 96 | # AWS User-specific 97 | .idea/**/aws.xml 98 | 99 | # Generated files 100 | .idea/**/contentModel.xml 101 | 102 | # Sensitive or high-churn files 103 | .idea/**/dataSources/ 104 | .idea/**/dataSources.ids 105 | .idea/**/dataSources.local.xml 106 | .idea/**/sqlDataSources.xml 107 | .idea/**/dynamic.xml 108 | .idea/**/uiDesigner.xml 109 | .idea/**/dbnavigator.xml 110 | 111 | # Gradle 112 | .idea/**/gradle.xml 113 | .idea/**/libraries 114 | 115 | # Gradle and Maven with auto-import 116 | # When using Gradle or Maven with auto-import, you should exclude module files, 117 | # since they will be recreated, and may cause churn. Uncomment if using 118 | # auto-import. 119 | # .idea/artifacts 120 | # .idea/compiler.xml 121 | # .idea/jarRepositories.xml 122 | # .idea/modules.xml 123 | # .idea/*.iml 124 | # .idea/modules 125 | # *.iml 126 | # *.ipr 127 | 128 | # CMake 129 | cmake-build-*/ 130 | 131 | # Mongo Explorer plugin 132 | .idea/**/mongoSettings.xml 133 | 134 | # File-based project format 135 | *.iws 136 | 137 | # IntelliJ 138 | out/ 139 | 140 | # mpeltonen/sbt-idea plugin 141 | .idea_modules/ 142 | 143 | # JIRA plugin 144 | atlassian-ide-plugin.xml 145 | 146 | # Cursive Clojure plugin 147 | .idea/replstate.xml 148 | 149 | # SonarLint plugin 150 | .idea/sonarlint/ 151 | 152 | # Crashlytics plugin (for Android Studio and IntelliJ) 153 | com_crashlytics_export_strings.xml 154 | crashlytics.properties 155 | crashlytics-build.properties 156 | fabric.properties 157 | 158 | # Editor-based Rest Client 159 | .idea/httpRequests 160 | 161 | # Android studio 3.1+ serialized cache file 162 | .idea/caches/build_file_checksums.ser 163 | 164 | ### JetBrains Patch ### 165 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 166 | 167 | # *.iml 168 | # modules.xml 169 | # .idea/misc.xml 170 | # *.ipr 171 | 172 | # Sonarlint plugin 173 | # https://plugins.jetbrains.com/plugin/7973-sonarlint 174 | .idea/**/sonarlint/ 175 | 176 | # SonarQube Plugin 177 | # https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin 178 | .idea/**/sonarIssues.xml 179 | 180 | # Markdown Navigator plugin 181 | # https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced 182 | .idea/**/markdown-navigator.xml 183 | .idea/**/markdown-navigator-enh.xml 184 | .idea/**/markdown-navigator/ 185 | 186 | # Cache file creation bug 187 | # See https://youtrack.jetbrains.com/issue/JBR-2257 188 | .idea/$CACHE_FILE$ 189 | 190 | # CodeStream plugin 191 | # https://plugins.jetbrains.com/plugin/12206-codestream 192 | .idea/codestream.xml 193 | 194 | # Azure Toolkit for IntelliJ plugin 195 | # https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij 196 | .idea/**/azureSettings.xml 197 | 198 | # End of https://www.toptal.com/developers/gitignore/api/jetbrains,flutter -------------------------------------------------------------------------------- /example/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /example/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /example/.idea/runConfigurations/main_dart.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /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. 5 | 6 | version: 7 | revision: 676cefaaff197f27424942307668886253e1ec35 8 | channel: stable 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 676cefaaff197f27424942307668886253e1ec35 17 | base_revision: 676cefaaff197f27424942307668886253e1ec35 18 | - platform: android 19 | create_revision: 676cefaaff197f27424942307668886253e1ec35 20 | base_revision: 676cefaaff197f27424942307668886253e1ec35 21 | - platform: ios 22 | create_revision: 676cefaaff197f27424942307668886253e1ec35 23 | base_revision: 676cefaaff197f27424942307668886253e1ec35 24 | - platform: linux 25 | create_revision: 676cefaaff197f27424942307668886253e1ec35 26 | base_revision: 676cefaaff197f27424942307668886253e1ec35 27 | - platform: macos 28 | create_revision: 676cefaaff197f27424942307668886253e1ec35 29 | base_revision: 676cefaaff197f27424942307668886253e1ec35 30 | - platform: web 31 | create_revision: 676cefaaff197f27424942307668886253e1ec35 32 | base_revision: 676cefaaff197f27424942307668886253e1ec35 33 | - platform: windows 34 | create_revision: 676cefaaff197f27424942307668886253e1ec35 35 | base_revision: 676cefaaff197f27424942307668886253e1ec35 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer to use the lint rule set from `package:lint` 2 | include: package:lint/analysis_options.yaml 3 | 4 | analyzer: 5 | exclude: 6 | 7 | linter: 8 | rules: 9 | always_use_package_imports: false 10 | prefer_relative_imports: true 11 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | /app/.cxx 9 | 10 | # Remember to never publicly share your keystore. 11 | # See https://flutter.dev/to/reference-keystore 12 | key.properties 13 | **/*.keystore 14 | **/*.jks 15 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. 5 | id "dev.flutter.flutter-gradle-plugin" 6 | } 7 | 8 | android { 9 | namespace = "net.tlserver6y.flutter_map_location_marker.example" 10 | compileSdk = flutter.compileSdkVersion 11 | ndkVersion = flutter.ndkVersion 12 | 13 | compileOptions { 14 | sourceCompatibility = JavaVersion.VERSION_1_8 15 | targetCompatibility = JavaVersion.VERSION_1_8 16 | } 17 | 18 | kotlinOptions { 19 | jvmTarget = JavaVersion.VERSION_1_8 20 | } 21 | 22 | defaultConfig { 23 | applicationId = "net.tlserver6y.flutter_map_location_marker.example" 24 | // You can update the following values to match your application needs. 25 | // For more information, see: https://flutter.dev/to/review-gradle-config. 26 | minSdk = flutter.minSdkVersion 27 | targetSdk = flutter.targetSdkVersion 28 | versionCode = flutter.versionCode 29 | versionName = flutter.versionName 30 | } 31 | 32 | buildTypes { 33 | release { 34 | // Signing with the debug keys for now, so `flutter run --release` works. 35 | signingConfig = signingConfigs.debug 36 | } 37 | } 38 | } 39 | 40 | flutter { 41 | source = "../.." 42 | } 43 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 9 | 17 | 21 | 25 | 26 | 27 | 28 | 29 | 30 | 32 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/net/tlserver6y/flutter_map_location_marker/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package net.tlserver6y.flutter_map_location_marker.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /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/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/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/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/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/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/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/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/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/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | } 7 | 8 | rootProject.buildDir = "../build" 9 | subprojects { 10 | project.buildDir = "${rootProject.buildDir}/${project.name}" 11 | } 12 | subprojects { 13 | project.evaluationDependsOn(":app") 14 | } 15 | 16 | tasks.register("clean", Delete) { 17 | delete rootProject.buildDir 18 | } 19 | -------------------------------------------------------------------------------- /example/android/example_android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip 6 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | }() 9 | 10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") 11 | 12 | repositories { 13 | google() 14 | mavenCentral() 15 | gradlePluginPortal() 16 | } 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 21 | id "com.android.application" version "8.6.0" apply false 22 | id "org.jetbrains.kotlin.android" version "1.8.22" apply false 23 | } 24 | 25 | include ":app" 26 | -------------------------------------------------------------------------------- /example/example.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/example.md: -------------------------------------------------------------------------------- 1 | ```dart 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_map/flutter_map.dart'; 4 | import 'package:flutter_map_location_marker/flutter_map_location_marker.dart'; 5 | import 'package:latlong2/latlong.dart'; 6 | 7 | void main() { 8 | runApp( 9 | MaterialApp( 10 | home: MinimumExample(), 11 | ), 12 | ); 13 | } 14 | 15 | class MinimumExample extends StatelessWidget { 16 | @override 17 | Widget build(BuildContext context) { 18 | return Scaffold( 19 | appBar: AppBar( 20 | title: const Text('Minimum Example'), 21 | ), 22 | body: FlutterMap( 23 | options: const MapOptions( 24 | initialCenter: LatLng(0, 0), 25 | initialZoom: 1, 26 | minZoom: 0, 27 | maxZoom: 19, 28 | ), 29 | children: [ 30 | TileLayer( 31 | urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', 32 | userAgentPackageName: 33 | 'net.tlserver6y.flutter_map_location_marker.example', 34 | maxZoom: 19, 35 | ), 36 | CurrentLocationLayer(), 37 | ], 38 | ), 39 | ); 40 | } 41 | } 42 | ``` 43 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /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 | 12.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, '12.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 flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | 4 | @main 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: 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/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/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/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/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/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/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/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/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/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/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/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/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/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/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/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/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/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/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/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/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/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/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/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/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/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/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/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/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/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/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/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/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 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Location Marker Example 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | example 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | NSLocationWhenInUseUsageDescription 28 | This app needs access to location when open. 29 | UILaunchStoryboardName 30 | LaunchScreen 31 | UIMainStoryboardFile 32 | Main 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | UIViewControllerBasedStatusBarAppearance 47 | 48 | CADisableMinimumFrameDurationOnPhone 49 | 50 | UIApplicationSupportsIndirectInputEvents 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'page/center_fab_example.dart'; 4 | import 'page/custom_stream_example.dart'; 5 | import 'page/customize_marker_example.dart'; 6 | import 'page/default_stream_example.dart'; 7 | import 'page/geolocator_settings_example.dart'; 8 | import 'page/indicators_example.dart'; 9 | import 'page/minimum_example.dart'; 10 | import 'page/navigation_example.dart'; 11 | import 'page/no_stream_example.dart'; 12 | import 'page/selectable_distance_filter_example.dart'; 13 | 14 | // import 'page/animation_debugger.dart'; 15 | // import 'page/stream_debugger.dart'; 16 | 17 | void main() { 18 | runApp( 19 | MaterialApp( 20 | home: Home(), 21 | ), 22 | ); 23 | } 24 | 25 | class Home extends StatelessWidget { 26 | @override 27 | Widget build(BuildContext context) { 28 | return Scaffold( 29 | body: ListView( 30 | children: [ 31 | // ListTile( 32 | // title: const Text('Animation Debugger'), 33 | // onTap: () { 34 | // Navigator.push( 35 | // context, 36 | // MaterialPageRoute( 37 | // builder: (BuildContext context) => AnimationDebugger(), 38 | // ), 39 | // ); 40 | // }, 41 | // ), 42 | // ListTile( 43 | // title: const Text('Stream Debugger'), 44 | // onTap: () { 45 | // Navigator.push( 46 | // context, 47 | // MaterialPageRoute( 48 | // builder: (BuildContext context) => StreamDebugger(), 49 | // ), 50 | // ); 51 | // }, 52 | // ), 53 | ListTile( 54 | title: const Text('Minimum Example'), 55 | onTap: () { 56 | Navigator.push( 57 | context, 58 | MaterialPageRoute( 59 | builder: (BuildContext context) => MinimumExample(), 60 | ), 61 | ); 62 | }, 63 | ), 64 | ListTile( 65 | title: const Text('Customize Marker Example'), 66 | onTap: () { 67 | Navigator.push( 68 | context, 69 | MaterialPageRoute( 70 | builder: (BuildContext context) => CustomizeMarkerExample(), 71 | ), 72 | ); 73 | }, 74 | ), 75 | ListTile( 76 | title: const Text('Center FAB Example'), 77 | onTap: () { 78 | Navigator.push( 79 | context, 80 | MaterialPageRoute( 81 | builder: (BuildContext context) => CenterFabExample(), 82 | ), 83 | ); 84 | }, 85 | ), 86 | ListTile( 87 | title: const Text('Geolocator Settings Example'), 88 | onTap: () { 89 | Navigator.push( 90 | context, 91 | MaterialPageRoute( 92 | builder: (BuildContext context) => 93 | GeolocatorSettingsExample(), 94 | ), 95 | ); 96 | }, 97 | ), 98 | ListTile( 99 | title: const Text('Selectable Distance Filter Example'), 100 | onTap: () { 101 | Navigator.push( 102 | context, 103 | MaterialPageRoute( 104 | builder: (BuildContext context) => 105 | SelectableDistanceFilterExample(), 106 | ), 107 | ); 108 | }, 109 | ), 110 | ListTile( 111 | title: const Text('Custom Stream Example'), 112 | onTap: () { 113 | Navigator.push( 114 | context, 115 | MaterialPageRoute( 116 | builder: (BuildContext context) => CustomStreamExample(), 117 | ), 118 | ); 119 | }, 120 | ), 121 | ListTile( 122 | title: const Text('No Stream Example'), 123 | onTap: () { 124 | Navigator.push( 125 | context, 126 | MaterialPageRoute( 127 | builder: (BuildContext context) => NoStreamExample(), 128 | ), 129 | ); 130 | }, 131 | ), 132 | ListTile( 133 | title: const Text('Navigation Example'), 134 | onTap: () { 135 | Navigator.push( 136 | context, 137 | MaterialPageRoute( 138 | builder: (BuildContext context) => NavigationExample(), 139 | ), 140 | ); 141 | }, 142 | ), 143 | ListTile( 144 | title: const Text('Default Stream Example'), 145 | onTap: () { 146 | Navigator.push( 147 | context, 148 | MaterialPageRoute( 149 | builder: (BuildContext context) => DefaultStreamExample(), 150 | ), 151 | ); 152 | }, 153 | ), 154 | ListTile( 155 | title: const Text('Indicators Example'), 156 | onTap: () { 157 | Navigator.push( 158 | context, 159 | MaterialPageRoute( 160 | builder: (BuildContext context) => IndicatorsExample(), 161 | ), 162 | ); 163 | }, 164 | ), 165 | ], 166 | ), 167 | ); 168 | } 169 | } 170 | -------------------------------------------------------------------------------- /example/lib/page/animation_debugger.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_map/flutter_map.dart'; 5 | import 'package:flutter_map_location_marker/flutter_map_location_marker.dart'; 6 | import 'package:latlong2/latlong.dart'; 7 | 8 | class AnimationDebugger extends StatefulWidget { 9 | @override 10 | State createState() => _AnimationDebuggerState(); 11 | } 12 | 13 | class _AnimationDebuggerState extends State { 14 | LocationMarkerPosition _locationMarkerPosition = const LocationMarkerPosition( 15 | latitude: 0, 16 | longitude: 0, 17 | accuracy: 20000, 18 | ); 19 | LocationMarkerHeading _locationMarkerHeading = const LocationMarkerHeading( 20 | heading: 0, 21 | accuracy: 1, 22 | ); 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return Scaffold( 27 | appBar: AppBar( 28 | title: const Text('Animation Debugger'), 29 | ), 30 | body: FlutterMap( 31 | options: const MapOptions( 32 | initialCenter: LatLng(0, 0), 33 | initialZoom: 8, 34 | minZoom: 0, 35 | maxZoom: 19, 36 | ), 37 | children: [ 38 | TileLayer( 39 | urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', 40 | userAgentPackageName: 41 | 'net.tlserver6y.flutter_map_location_marker.example', 42 | maxZoom: 19, 43 | ), 44 | AnimatedLocationMarkerLayer( 45 | position: _locationMarkerPosition, 46 | heading: _locationMarkerHeading, 47 | moveAnimationDuration: const Duration(seconds: 2), 48 | ), 49 | Align( 50 | alignment: Alignment.bottomRight, 51 | child: Padding( 52 | padding: const EdgeInsets.all(8.0), 53 | child: Column( 54 | children: [ 55 | FloatingActionButton( 56 | onPressed: () { 57 | final random = Random(); 58 | setState(() { 59 | _locationMarkerPosition = LocationMarkerPosition( 60 | latitude: random.nextDouble() - 0.5, 61 | longitude: random.nextDouble() - 0.5, 62 | accuracy: random.nextDouble() * 80000 + 20000, 63 | ); 64 | }); 65 | }, 66 | heroTag: null, 67 | child: const Icon( 68 | Icons.my_location, 69 | color: Colors.white, 70 | ), 71 | ), 72 | const SizedBox( 73 | height: 20, 74 | ), 75 | FloatingActionButton( 76 | onPressed: () { 77 | final random = Random(); 78 | setState(() { 79 | _locationMarkerHeading = LocationMarkerHeading( 80 | heading: random.nextDouble() * pi * 2, 81 | accuracy: random.nextDouble() * 0.8 + 0.2, 82 | ); 83 | }); 84 | }, 85 | heroTag: null, 86 | child: const Icon( 87 | Icons.navigation, 88 | color: Colors.white, 89 | ), 90 | ), 91 | ], 92 | ), 93 | ), 94 | ), 95 | ], 96 | ), 97 | ); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /example/lib/page/center_fab_example.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_map/flutter_map.dart'; 5 | import 'package:flutter_map_location_marker/flutter_map_location_marker.dart'; 6 | import 'package:latlong2/latlong.dart'; 7 | 8 | class CenterFabExample extends StatefulWidget { 9 | @override 10 | _CenterFabExampleState createState() => _CenterFabExampleState(); 11 | } 12 | 13 | class _CenterFabExampleState extends State { 14 | late AlignOnUpdate _alignPositionOnUpdate; 15 | late final StreamController _alignPositionStreamController; 16 | 17 | @override 18 | void initState() { 19 | super.initState(); 20 | _alignPositionOnUpdate = AlignOnUpdate.always; 21 | _alignPositionStreamController = StreamController(); 22 | } 23 | 24 | @override 25 | void dispose() { 26 | _alignPositionStreamController.close(); 27 | super.dispose(); 28 | } 29 | 30 | @override 31 | Widget build(BuildContext context) { 32 | return Scaffold( 33 | appBar: AppBar( 34 | title: const Text('Center FAB Example'), 35 | ), 36 | body: FlutterMap( 37 | options: MapOptions( 38 | initialCenter: const LatLng(0, 0), 39 | initialZoom: 1, 40 | minZoom: 0, 41 | maxZoom: 19, 42 | // Stop aligning the location marker to the center of the map widget 43 | // if user interacted with the map. 44 | onPositionChanged: (MapCamera camera, bool hasGesture) { 45 | if (hasGesture && _alignPositionOnUpdate != AlignOnUpdate.never) { 46 | setState( 47 | () => _alignPositionOnUpdate = AlignOnUpdate.never, 48 | ); 49 | } 50 | }, 51 | ), 52 | // ignore: sort_child_properties_last 53 | children: [ 54 | TileLayer( 55 | urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', 56 | userAgentPackageName: 57 | 'net.tlserver6y.flutter_map_location_marker.example', 58 | maxZoom: 19, 59 | ), 60 | CurrentLocationLayer( 61 | alignPositionStream: _alignPositionStreamController.stream, 62 | alignPositionOnUpdate: _alignPositionOnUpdate, 63 | ), 64 | Align( 65 | alignment: Alignment.bottomRight, 66 | child: Padding( 67 | padding: const EdgeInsets.all(20.0), 68 | child: FloatingActionButton( 69 | onPressed: () { 70 | // Align the location marker to the center of the map widget 71 | // on location update until user interact with the map. 72 | setState( 73 | () => _alignPositionOnUpdate = AlignOnUpdate.always, 74 | ); 75 | // Align the location marker to the center of the map widget 76 | // and zoom the map to level 18. 77 | _alignPositionStreamController.add(18); 78 | }, 79 | child: const Icon( 80 | Icons.my_location, 81 | color: Colors.white, 82 | ), 83 | ), 84 | ), 85 | ), 86 | ], 87 | ), 88 | ); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /example/lib/page/custom_stream_example.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:math'; 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_joystick/flutter_joystick.dart'; 6 | import 'package:flutter_map/flutter_map.dart'; 7 | import 'package:flutter_map_location_marker/flutter_map_location_marker.dart'; 8 | import 'package:latlong2/latlong.dart'; 9 | 10 | // A demo for a custom position and heading stream. In this example, the 11 | // location marker is controlled by a joystick instead of the device sensor. 12 | // This example provide same behavior as Joystick Example. 13 | class CustomStreamExample extends StatefulWidget { 14 | @override 15 | _CustomStreamExampleState createState() => _CustomStreamExampleState(); 16 | } 17 | 18 | class _CustomStreamExampleState extends State { 19 | late final StreamController _positionStreamController; 20 | late final StreamController _headingStreamController; 21 | double _currentLat = 0; 22 | double _currentLng = 0; 23 | 24 | @override 25 | void initState() { 26 | super.initState(); 27 | _positionStreamController = StreamController() 28 | ..add( 29 | LocationMarkerPosition( 30 | latitude: _currentLat, 31 | longitude: _currentLng, 32 | accuracy: 0, 33 | ), 34 | ); 35 | _headingStreamController = StreamController() 36 | ..add( 37 | const LocationMarkerHeading( 38 | heading: 0, 39 | accuracy: pi * 0.2, 40 | ), 41 | ); 42 | } 43 | 44 | @override 45 | void dispose() { 46 | _positionStreamController.close(); 47 | _headingStreamController.close(); 48 | super.dispose(); 49 | } 50 | 51 | @override 52 | Widget build(BuildContext context) { 53 | return Scaffold( 54 | appBar: AppBar( 55 | title: const Text('Custom Stream Example'), 56 | ), 57 | body: Stack( 58 | children: [ 59 | FlutterMap( 60 | options: const MapOptions( 61 | initialCenter: LatLng(0, 0), 62 | initialZoom: 1, 63 | minZoom: 0, 64 | maxZoom: 19, 65 | ), 66 | // ignore: sort_child_properties_last 67 | children: [ 68 | TileLayer( 69 | urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', 70 | userAgentPackageName: 71 | 'net.tlserver6y.flutter_map_location_marker.example', 72 | maxZoom: 19, 73 | ), 74 | CurrentLocationLayer( 75 | positionStream: _positionStreamController.stream, 76 | headingStream: _headingStreamController.stream, 77 | ), 78 | ], 79 | ), 80 | Positioned( 81 | right: 20, 82 | bottom: 20, 83 | child: Joystick( 84 | listener: (details) { 85 | _currentLat -= details.y; 86 | _currentLat = _currentLat.clamp(-85, 85); 87 | _currentLng += details.x; 88 | _currentLng = _currentLng.clamp(-180, 180); 89 | _positionStreamController.add( 90 | LocationMarkerPosition( 91 | latitude: _currentLat, 92 | longitude: _currentLng, 93 | accuracy: 0, 94 | ), 95 | ); 96 | if (details.x != 0 || details.y != 0) { 97 | _headingStreamController.add( 98 | LocationMarkerHeading( 99 | heading: 100 | (atan2(details.y, details.x) + pi * 0.5) % (pi * 2), 101 | accuracy: pi * 0.2, 102 | ), 103 | ); 104 | } 105 | }, 106 | ), 107 | ), 108 | ], 109 | ), 110 | ); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /example/lib/page/customize_marker_example.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_map/flutter_map.dart'; 3 | import 'package:flutter_map_location_marker/flutter_map_location_marker.dart'; 4 | import 'package:latlong2/latlong.dart'; 5 | 6 | class CustomizeMarkerExample extends StatelessWidget { 7 | @override 8 | Widget build(BuildContext context) { 9 | return Scaffold( 10 | appBar: AppBar( 11 | title: const Text('Customize Marker Example'), 12 | ), 13 | body: FlutterMap( 14 | options: const MapOptions( 15 | initialCenter: LatLng(0, 0), 16 | initialZoom: 1, 17 | minZoom: 0, 18 | maxZoom: 19, 19 | ), 20 | children: [ 21 | TileLayer( 22 | urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', 23 | userAgentPackageName: 24 | 'net.tlserver6y.flutter_map_location_marker.example', 25 | maxZoom: 19, 26 | ), 27 | CurrentLocationLayer( 28 | style: LocationMarkerStyle( 29 | marker: const DefaultLocationMarker( 30 | color: Colors.green, 31 | child: Icon( 32 | Icons.person, 33 | color: Colors.white, 34 | ), 35 | ), 36 | markerSize: const Size.square(40), 37 | accuracyCircleColor: Colors.green.withValues(alpha: 0.1), 38 | headingSectorColor: Colors.green.withValues(alpha: 0.8), 39 | headingSectorRadius: 120, 40 | ), 41 | moveAnimationDuration: Duration.zero, // disable animation 42 | ), 43 | ], 44 | ), 45 | ); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /example/lib/page/geolocator_settings_example.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_map/flutter_map.dart'; 3 | import 'package:flutter_map_location_marker/flutter_map_location_marker.dart'; 4 | import 'package:geolocator/geolocator.dart'; 5 | import 'package:latlong2/latlong.dart'; 6 | 7 | class GeolocatorSettingsExample extends StatelessWidget { 8 | final _positionStream = 9 | const LocationMarkerDataStreamFactory().fromGeolocatorPositionStream( 10 | stream: Geolocator.getPositionStream( 11 | locationSettings: const LocationSettings( 12 | accuracy: LocationAccuracy.medium, 13 | distanceFilter: 50, 14 | timeLimit: Duration(minutes: 1), 15 | ), 16 | ), 17 | ); 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | return Scaffold( 22 | appBar: AppBar( 23 | title: const Text('Geolocator Settings Example'), 24 | ), 25 | body: FlutterMap( 26 | options: const MapOptions( 27 | initialCenter: LatLng(0, 0), 28 | initialZoom: 1, 29 | minZoom: 0, 30 | maxZoom: 19, 31 | ), 32 | children: [ 33 | TileLayer( 34 | urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', 35 | userAgentPackageName: 36 | 'net.tlserver6y.flutter_map_location_marker.example', 37 | maxZoom: 19, 38 | ), 39 | CurrentLocationLayer( 40 | positionStream: _positionStream, 41 | ), 42 | ], 43 | ), 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /example/lib/page/indicators_example.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_map/flutter_map.dart'; 3 | import 'package:flutter_map_location_marker/flutter_map_location_marker.dart'; 4 | import 'package:latlong2/latlong.dart'; 5 | 6 | class IndicatorsExample extends StatelessWidget { 7 | @override 8 | Widget build(BuildContext context) { 9 | return Scaffold( 10 | appBar: AppBar( 11 | title: const Text('Indicators Example'), 12 | actions: [ 13 | IconButton( 14 | icon: const Icon(Icons.info_outline), 15 | onPressed: () => showDialog( 16 | context: context, 17 | builder: (BuildContext context) => AlertDialog( 18 | content: const Text( 19 | 'Try to disable the location service, and you will see an ' 20 | 'indicator on the top of the map.'), 21 | actions: [ 22 | TextButton( 23 | onPressed: () => Navigator.pop(context, 'OK'), 24 | child: const Text('OK'), 25 | ), 26 | ], 27 | ), 28 | ), 29 | ), 30 | ], 31 | ), 32 | body: FlutterMap( 33 | options: const MapOptions( 34 | initialCenter: LatLng(0, 0), 35 | initialZoom: 1, 36 | minZoom: 0, 37 | maxZoom: 19, 38 | ), 39 | children: [ 40 | TileLayer( 41 | urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', 42 | userAgentPackageName: 43 | 'net.tlserver6y.flutter_map_location_marker.example', 44 | maxZoom: 19, 45 | ), 46 | CurrentLocationLayer( 47 | indicators: LocationMarkerIndicators( 48 | serviceDisabled: Align( 49 | alignment: Alignment.topCenter, 50 | child: SizedBox( 51 | width: double.infinity, 52 | child: ColoredBox( 53 | color: Colors.white.withAlpha(0x80), 54 | child: const Padding( 55 | padding: EdgeInsets.all(4.0), 56 | child: Text( 57 | "Please turn on location service.", 58 | textAlign: TextAlign.center, 59 | style: TextStyle(height: 1.2), 60 | ), 61 | ), 62 | ), 63 | ), 64 | ), 65 | ), 66 | ), 67 | ], 68 | ), 69 | ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /example/lib/page/minimum_example.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_map/flutter_map.dart'; 3 | import 'package:flutter_map_location_marker/flutter_map_location_marker.dart'; 4 | import 'package:latlong2/latlong.dart'; 5 | 6 | class MinimumExample extends StatelessWidget { 7 | @override 8 | Widget build(BuildContext context) { 9 | return Scaffold( 10 | appBar: AppBar( 11 | title: const Text('Minimum Example'), 12 | ), 13 | body: FlutterMap( 14 | options: const MapOptions( 15 | initialCenter: LatLng(0, 0), 16 | initialZoom: 1, 17 | minZoom: 0, 18 | maxZoom: 19, 19 | ), 20 | children: [ 21 | TileLayer( 22 | urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', 23 | userAgentPackageName: 24 | 'net.tlserver6y.flutter_map_location_marker.example', 25 | maxZoom: 19, 26 | ), 27 | const CurrentLocationLayer(), 28 | ], 29 | ), 30 | ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /example/lib/page/navigation_example.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_map/flutter_map.dart'; 5 | import 'package:flutter_map_location_marker/flutter_map_location_marker.dart'; 6 | import 'package:latlong2/latlong.dart'; 7 | 8 | class NavigationExample extends StatefulWidget { 9 | @override 10 | _NavigationExampleState createState() => _NavigationExampleState(); 11 | } 12 | 13 | class _NavigationExampleState extends State { 14 | late bool _navigationMode; 15 | late int _pointerCount; 16 | late AlignOnUpdate _alignPositionOnUpdate; 17 | late AlignOnUpdate _alignDirectionOnUpdate; 18 | late final StreamController _alignPositionStreamController; 19 | late final StreamController _alignDirectionStreamController; 20 | 21 | @override 22 | void initState() { 23 | super.initState(); 24 | _navigationMode = false; 25 | _pointerCount = 0; 26 | _alignPositionOnUpdate = AlignOnUpdate.never; 27 | _alignDirectionOnUpdate = AlignOnUpdate.never; 28 | _alignPositionStreamController = StreamController(); 29 | _alignDirectionStreamController = StreamController(); 30 | } 31 | 32 | @override 33 | void dispose() { 34 | _alignPositionStreamController.close(); 35 | _alignDirectionStreamController.close(); 36 | super.dispose(); 37 | } 38 | 39 | @override 40 | Widget build(BuildContext context) { 41 | return Scaffold( 42 | appBar: AppBar( 43 | title: const Text('Navigation Example'), 44 | ), 45 | body: FlutterMap( 46 | options: MapOptions( 47 | initialCenter: const LatLng(0, 0), 48 | initialZoom: 1, 49 | minZoom: 0, 50 | maxZoom: 19, 51 | onPointerDown: _onPointerDown, 52 | onPointerUp: _onPointerUp, 53 | onPointerCancel: _onPointerUp, 54 | ), 55 | // ignore: sort_child_properties_last 56 | children: [ 57 | TileLayer( 58 | urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', 59 | userAgentPackageName: 60 | 'net.tlserver6y.flutter_map_location_marker.example', 61 | maxZoom: 19, 62 | ), 63 | CurrentLocationLayer( 64 | focalPoint: const FocalPoint( 65 | ratio: Offset(0.0, 1.0), 66 | offset: Offset(0.0, -60.0), 67 | ), 68 | alignPositionStream: _alignPositionStreamController.stream, 69 | alignDirectionStream: _alignDirectionStreamController.stream, 70 | alignPositionOnUpdate: _alignPositionOnUpdate, 71 | alignDirectionOnUpdate: _alignDirectionOnUpdate, 72 | style: const LocationMarkerStyle( 73 | marker: DefaultLocationMarker( 74 | child: Icon( 75 | Icons.navigation, 76 | color: Colors.white, 77 | ), 78 | ), 79 | markerSize: Size(40, 40), 80 | markerDirection: MarkerDirection.heading, 81 | ), 82 | ), 83 | Align( 84 | alignment: Alignment.bottomRight, 85 | child: Padding( 86 | padding: const EdgeInsets.all(20.0), 87 | child: FloatingActionButton( 88 | backgroundColor: _navigationMode ? Colors.blue : Colors.grey, 89 | foregroundColor: Colors.white, 90 | onPressed: () { 91 | setState( 92 | () { 93 | _navigationMode = !_navigationMode; 94 | _alignPositionOnUpdate = _navigationMode 95 | ? AlignOnUpdate.always 96 | : AlignOnUpdate.never; 97 | _alignDirectionOnUpdate = _navigationMode 98 | ? AlignOnUpdate.always 99 | : AlignOnUpdate.never; 100 | }, 101 | ); 102 | if (_navigationMode) { 103 | _alignPositionStreamController.add(18); 104 | _alignDirectionStreamController.add(null); 105 | } 106 | }, 107 | child: const Icon( 108 | Icons.navigation_outlined, 109 | ), 110 | ), 111 | ), 112 | ), 113 | ], 114 | ), 115 | ); 116 | } 117 | 118 | // Disable align position and align direction temporarily when user is 119 | // manipulating the map. 120 | void _onPointerDown(PointerEvent event, LatLng latLng) { 121 | _pointerCount++; 122 | setState(() { 123 | _alignPositionOnUpdate = AlignOnUpdate.never; 124 | _alignDirectionOnUpdate = AlignOnUpdate.never; 125 | }); 126 | } 127 | 128 | // Enable align position and align direction again when user manipulation 129 | // ended. 130 | void _onPointerUp(PointerEvent event, LatLng latLng) { 131 | if (--_pointerCount == 0 && _navigationMode) { 132 | setState(() { 133 | _alignPositionOnUpdate = AlignOnUpdate.always; 134 | _alignDirectionOnUpdate = AlignOnUpdate.always; 135 | }); 136 | _alignPositionStreamController.add(18); 137 | _alignDirectionStreamController.add(null); 138 | } 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /example/lib/page/no_stream_example.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_joystick/flutter_joystick.dart'; 5 | import 'package:flutter_map/flutter_map.dart'; 6 | import 'package:flutter_map_location_marker/flutter_map_location_marker.dart'; 7 | import 'package:latlong2/latlong.dart'; 8 | 9 | // A demo for the usage of AnimatedLocationMarkerLayer. In this example, the 10 | // location marker is controlled by a joystick. This example provide same 11 | // behavior as Custom Stream Example. 12 | class NoStreamExample extends StatefulWidget { 13 | @override 14 | _NoStreamExampleState createState() => _NoStreamExampleState(); 15 | } 16 | 17 | class _NoStreamExampleState extends State { 18 | LocationMarkerPosition _currentPosition = const LocationMarkerPosition( 19 | latitude: 0, 20 | longitude: 0, 21 | accuracy: 0, 22 | ); 23 | LocationMarkerHeading _currentHeading = const LocationMarkerHeading( 24 | heading: 0, 25 | accuracy: pi * 0.2, 26 | ); 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return Scaffold( 31 | appBar: AppBar( 32 | title: const Text('No Stream Example'), 33 | ), 34 | body: Stack( 35 | children: [ 36 | FlutterMap( 37 | options: const MapOptions( 38 | initialCenter: LatLng(0, 0), 39 | initialZoom: 1, 40 | minZoom: 0, 41 | maxZoom: 19, 42 | ), 43 | // ignore: sort_child_properties_last 44 | children: [ 45 | TileLayer( 46 | urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', 47 | userAgentPackageName: 48 | 'net.tlserver6y.flutter_map_location_marker.example', 49 | maxZoom: 19, 50 | ), 51 | AnimatedLocationMarkerLayer( 52 | position: _currentPosition, 53 | heading: _currentHeading, 54 | ), 55 | ], 56 | ), 57 | Positioned( 58 | right: 20, 59 | bottom: 20, 60 | child: Joystick( 61 | listener: (details) { 62 | setState(() { 63 | _currentPosition = LocationMarkerPosition( 64 | latitude: 65 | (_currentPosition.latitude - details.y).clamp(-85, 85), 66 | longitude: (_currentPosition.longitude + details.x) 67 | .clamp(-180, 180), 68 | accuracy: 0, 69 | ); 70 | if (details.x != 0 || details.y != 0) { 71 | _currentHeading = LocationMarkerHeading( 72 | heading: 73 | (atan2(details.y, details.x) + pi * 0.5) % (pi * 2), 74 | accuracy: pi * 0.2, 75 | ); 76 | } 77 | }); 78 | }, 79 | ), 80 | ), 81 | ], 82 | ), 83 | ); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /example/lib/page/selectable_distance_filter_example.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_map/flutter_map.dart'; 5 | import 'package:flutter_map_location_marker/flutter_map_location_marker.dart'; 6 | import 'package:geolocator/geolocator.dart'; 7 | import 'package:latlong2/latlong.dart'; 8 | 9 | class SelectableDistanceFilterExample extends StatefulWidget { 10 | @override 11 | State createState() => 12 | _SelectableDistanceFilterExampleState(); 13 | } 14 | 15 | class _SelectableDistanceFilterExampleState 16 | extends State { 17 | static const _distanceFilters = [0, 5, 10, 30, 50]; 18 | int _selectedIndex = 0; 19 | 20 | late final StreamController _positionStream; 21 | late StreamSubscription _streamSubscription; 22 | 23 | @override 24 | void initState() { 25 | super.initState(); 26 | _positionStream = StreamController(); 27 | _subscriptPositionStream(); 28 | } 29 | 30 | @override 31 | void dispose() { 32 | _positionStream.close(); 33 | _streamSubscription.cancel(); 34 | super.dispose(); 35 | } 36 | 37 | @override 38 | Widget build(BuildContext context) { 39 | return Scaffold( 40 | appBar: AppBar( 41 | title: const Text('Selectable Distance Filter Example'), 42 | ), 43 | body: FlutterMap( 44 | options: const MapOptions( 45 | initialCenter: LatLng(0, 0), 46 | initialZoom: 1, 47 | minZoom: 0, 48 | maxZoom: 19, 49 | ), 50 | children: [ 51 | TileLayer( 52 | urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', 53 | userAgentPackageName: 54 | 'net.tlserver6y.flutter_map_location_marker.example', 55 | maxZoom: 19, 56 | ), 57 | CurrentLocationLayer( 58 | positionStream: _positionStream.stream, 59 | ), 60 | Align( 61 | alignment: Alignment.bottomCenter, 62 | child: Container( 63 | color: Theme.of(context).scaffoldBackgroundColor, 64 | padding: const EdgeInsets.all(8), 65 | child: Row( 66 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 67 | children: [ 68 | const Text("Distance Filter:"), 69 | ToggleButtons( 70 | isSelected: List.generate( 71 | _distanceFilters.length, 72 | (index) => index == _selectedIndex, 73 | growable: false, 74 | ), 75 | onPressed: (index) { 76 | setState(() => _selectedIndex = index); 77 | _streamSubscription.cancel(); 78 | _subscriptPositionStream(); 79 | }, 80 | children: _distanceFilters 81 | .map((distance) => Text(distance.toString())) 82 | .toList(growable: false), 83 | ), 84 | ], 85 | ), 86 | ), 87 | ), 88 | ], 89 | ), 90 | ); 91 | } 92 | 93 | void _subscriptPositionStream() { 94 | _streamSubscription = const LocationMarkerDataStreamFactory() 95 | .fromGeolocatorPositionStream( 96 | stream: Geolocator.getPositionStream( 97 | locationSettings: LocationSettings( 98 | distanceFilter: _distanceFilters[_selectedIndex], 99 | ), 100 | ), 101 | ) 102 | .listen( 103 | (position) { 104 | _positionStream.add(position); 105 | }, 106 | ); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /example/lib/page/stream_debugger.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_map/flutter_map.dart'; 5 | import 'package:flutter_map_location_marker/flutter_map_location_marker.dart'; 6 | import 'package:latlong2/latlong.dart'; 7 | 8 | class StreamDebugger extends StatefulWidget { 9 | @override 10 | State createState() => _StreamDebuggerState(); 11 | } 12 | 13 | class _StreamDebuggerState extends State { 14 | late Stream _stream; 15 | LocationMarkerPosition _locationMarkerPosition = const LocationMarkerPosition( 16 | latitude: 0, 17 | longitude: 0, 18 | accuracy: 20000, 19 | ); 20 | 21 | @override 22 | void initState() { 23 | super.initState(); 24 | _stream = Stream.value(_locationMarkerPosition); 25 | } 26 | 27 | @override 28 | Widget build(BuildContext context) { 29 | return Scaffold( 30 | appBar: AppBar( 31 | title: const Text('Stream Debugger'), 32 | ), 33 | body: FlutterMap( 34 | options: const MapOptions( 35 | initialCenter: LatLng(0, 0), 36 | initialZoom: 8, 37 | minZoom: 0, 38 | maxZoom: 19, 39 | ), 40 | children: [ 41 | TileLayer( 42 | urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', 43 | userAgentPackageName: 44 | 'net.tlserver6y.flutter_map_location_marker.example', 45 | maxZoom: 19, 46 | ), 47 | CurrentLocationLayer( 48 | positionStream: _stream, 49 | moveAnimationDuration: const Duration(seconds: 2), 50 | ), 51 | Align( 52 | alignment: Alignment.bottomRight, 53 | child: Padding( 54 | padding: const EdgeInsets.all(20.0), 55 | child: Column( 56 | children: [ 57 | FloatingActionButton( 58 | onPressed: () { 59 | final random = Random(); 60 | setState(() { 61 | _stream = 62 | Stream.periodic(const Duration(seconds: 1), (_) { 63 | return _locationMarkerPosition = 64 | LocationMarkerPosition( 65 | latitude: _locationMarkerPosition.latitude - 0.05, 66 | longitude: _locationMarkerPosition.longitude, 67 | accuracy: random.nextDouble() * 80000 + 20000, 68 | ); 69 | }); 70 | }); 71 | }, 72 | heroTag: null, 73 | child: const Icon( 74 | Icons.vertical_align_bottom, 75 | color: Colors.white, 76 | ), 77 | ), 78 | const SizedBox( 79 | height: 20, 80 | ), 81 | FloatingActionButton( 82 | onPressed: () { 83 | final random = Random(); 84 | setState(() { 85 | _stream = 86 | Stream.periodic(const Duration(seconds: 2), (_) { 87 | return _locationMarkerPosition = 88 | LocationMarkerPosition( 89 | latitude: _locationMarkerPosition.latitude + 0.1, 90 | longitude: _locationMarkerPosition.longitude, 91 | accuracy: random.nextDouble() * 80000 + 20000, 92 | ); 93 | }); 94 | }); 95 | }, 96 | heroTag: null, 97 | child: const Icon( 98 | Icons.vertical_align_top, 99 | color: Colors.white, 100 | ), 101 | ), 102 | ], 103 | ), 104 | ), 105 | ), 106 | ], 107 | ), 108 | ); 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /example/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /example/linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.10) 3 | project(runner LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "example") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "net.tlserver6y.fluttermaplocationmarker.example") 11 | 12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 13 | # versions of CMake. 14 | cmake_policy(SET CMP0063 NEW) 15 | 16 | # Load bundled libraries from the lib/ directory relative to the binary. 17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 18 | 19 | # Root filesystem for cross-building. 20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | endif() 28 | 29 | # Define build configuration options. 30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 31 | set(CMAKE_BUILD_TYPE "Debug" CACHE 32 | STRING "Flutter build mode" FORCE) 33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 34 | "Debug" "Profile" "Release") 35 | endif() 36 | 37 | # Compilation settings that should be applied to most targets. 38 | # 39 | # Be cautious about adding new options here, as plugins use this function by 40 | # default. In most cases, you should add new options to specific targets instead 41 | # of modifying this function. 42 | function(APPLY_STANDARD_SETTINGS TARGET) 43 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 47 | endfunction() 48 | 49 | # Flutter library and tool build rules. 50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 51 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 52 | 53 | # System-level dependencies. 54 | find_package(PkgConfig REQUIRED) 55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 56 | 57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 58 | 59 | # Define the application target. To change its name, change BINARY_NAME above, 60 | # not the value here, or `flutter run` will no longer work. 61 | # 62 | # Any new source files that you add to the application should be added here. 63 | add_executable(${BINARY_NAME} 64 | "main.cc" 65 | "my_application.cc" 66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 67 | ) 68 | 69 | # Apply the standard set of build settings. This can be removed for applications 70 | # that need different build settings. 71 | apply_standard_settings(${BINARY_NAME}) 72 | 73 | # Add dependency libraries. Add any application-specific dependencies here. 74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 76 | 77 | # Run the Flutter tool portions of the build. This must not be removed. 78 | add_dependencies(${BINARY_NAME} flutter_assemble) 79 | 80 | # Only the install-generated bundle's copy of the executable will launch 81 | # correctly, since the resources must in the right relative locations. To avoid 82 | # people trying to run the unbundled copy, put it in a subdirectory instead of 83 | # the default top-level location. 84 | set_target_properties(${BINARY_NAME} 85 | PROPERTIES 86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 87 | ) 88 | 89 | # Generated plugin build rules, which manage building the plugins and adding 90 | # them to the application. 91 | include(flutter/generated_plugins.cmake) 92 | 93 | 94 | # === Installation === 95 | # By default, "installing" just makes a relocatable bundle in the build 96 | # directory. 97 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 98 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 99 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 100 | endif() 101 | 102 | # Start with a clean build bundle directory every time. 103 | install(CODE " 104 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 105 | " COMPONENT Runtime) 106 | 107 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 108 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 109 | 110 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 111 | COMPONENT Runtime) 112 | 113 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 114 | COMPONENT Runtime) 115 | 116 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 117 | COMPONENT Runtime) 118 | 119 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 120 | install(FILES "${bundled_library}" 121 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 122 | COMPONENT Runtime) 123 | endforeach(bundled_library) 124 | 125 | # Fully re-copy the assets directory on each build to avoid having stale files 126 | # from a previous install. 127 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 128 | install(CODE " 129 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 130 | " COMPONENT Runtime) 131 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 132 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 133 | 134 | # Install the AOT library on non-Debug builds only. 135 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 136 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 137 | COMPONENT Runtime) 138 | endif() 139 | -------------------------------------------------------------------------------- /example/linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /example/linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /example/linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "example"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "example"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /example/linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.14' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | target 'RunnerTests' do 35 | inherit! :search_paths 36 | end 37 | end 38 | 39 | post_install do |installer| 40 | installer.pods_project.targets.each do |target| 41 | flutter_additional_macos_build_settings(target) 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /example/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = net.tlserver6y.fluttermaplocationmarker.example 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /example/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /example/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /example/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: location_marker_example 2 | description: Example of FlutterMapLocationMarkerPlugin 3 | publish_to: none 4 | 5 | version: 1.0.0+1 6 | 7 | environment: 8 | sdk: ">=3.0.0 <4.0.0" 9 | flutter: ">=3.10.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | flutter_joystick: ^0.0.4 15 | flutter_map: any 16 | flutter_map_location_marker: 17 | path: ../ 18 | geolocator: any 19 | latlong2: any 20 | 21 | dev_dependencies: 22 | flutter_test: 23 | sdk: flutter 24 | lint: any 25 | 26 | flutter: 27 | uses-material-design: true 28 | -------------------------------------------------------------------------------- /example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/example/web/favicon.png -------------------------------------------------------------------------------- /example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | example 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "short_name": "example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /example/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /example/windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(example LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "example") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(SET CMP0063 NEW) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /EHsc) 44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 46 | endfunction() 47 | 48 | # Flutter library and tool build rules. 49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 50 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 51 | 52 | # Application build; see runner/CMakeLists.txt. 53 | add_subdirectory("runner") 54 | 55 | # Generated plugin build rules, which manage building the plugins and adding 56 | # them to the application. 57 | include(flutter/generated_plugins.cmake) 58 | 59 | 60 | # === Installation === 61 | # Support files are copied into place next to the executable, so that it can 62 | # run in place. This is done instead of making a separate bundle (as on Linux) 63 | # so that building and running from within Visual Studio will work. 64 | set(BUILD_BUNDLE_DIR "$") 65 | # Make the "install" step default, as it's required to run. 66 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 67 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 68 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 69 | endif() 70 | 71 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 72 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 73 | 74 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 75 | COMPONENT Runtime) 76 | 77 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 78 | COMPONENT Runtime) 79 | 80 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 81 | COMPONENT Runtime) 82 | 83 | if(PLUGIN_BUNDLED_LIBRARIES) 84 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 85 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 86 | COMPONENT Runtime) 87 | endif() 88 | 89 | # Fully re-copy the assets directory on each build to avoid having stale files 90 | # from a previous install. 91 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 92 | install(CODE " 93 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 94 | " COMPONENT Runtime) 95 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 96 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 97 | 98 | # Install the AOT library on non-Debug builds only. 99 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 100 | CONFIGURATIONS Profile;Release 101 | COMPONENT Runtime) 102 | -------------------------------------------------------------------------------- /example/windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # === Flutter Library === 14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 15 | 16 | # Published to parent scope for install step. 17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 21 | 22 | list(APPEND FLUTTER_LIBRARY_HEADERS 23 | "flutter_export.h" 24 | "flutter_windows.h" 25 | "flutter_messenger.h" 26 | "flutter_plugin_registrar.h" 27 | "flutter_texture_registrar.h" 28 | ) 29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 30 | add_library(flutter INTERFACE) 31 | target_include_directories(flutter INTERFACE 32 | "${EPHEMERAL_DIR}" 33 | ) 34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 35 | add_dependencies(flutter flutter_assemble) 36 | 37 | # === Wrapper === 38 | list(APPEND CPP_WRAPPER_SOURCES_CORE 39 | "core_implementations.cc" 40 | "standard_codec.cc" 41 | ) 42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 44 | "plugin_registrar.cc" 45 | ) 46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 47 | list(APPEND CPP_WRAPPER_SOURCES_APP 48 | "flutter_engine.cc" 49 | "flutter_view_controller.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 52 | 53 | # Wrapper sources needed for a plugin. 54 | add_library(flutter_wrapper_plugin STATIC 55 | ${CPP_WRAPPER_SOURCES_CORE} 56 | ${CPP_WRAPPER_SOURCES_PLUGIN} 57 | ) 58 | apply_standard_settings(flutter_wrapper_plugin) 59 | set_target_properties(flutter_wrapper_plugin PROPERTIES 60 | POSITION_INDEPENDENT_CODE ON) 61 | set_target_properties(flutter_wrapper_plugin PROPERTIES 62 | CXX_VISIBILITY_PRESET hidden) 63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 64 | target_include_directories(flutter_wrapper_plugin PUBLIC 65 | "${WRAPPER_ROOT}/include" 66 | ) 67 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 68 | 69 | # Wrapper sources needed for the runner. 70 | add_library(flutter_wrapper_app STATIC 71 | ${CPP_WRAPPER_SOURCES_CORE} 72 | ${CPP_WRAPPER_SOURCES_APP} 73 | ) 74 | apply_standard_settings(flutter_wrapper_app) 75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 76 | target_include_directories(flutter_wrapper_app PUBLIC 77 | "${WRAPPER_ROOT}/include" 78 | ) 79 | add_dependencies(flutter_wrapper_app flutter_assemble) 80 | 81 | # === Flutter tool backend === 82 | # _phony_ is a non-existent file to force this command to run every time, 83 | # since currently there's no way to get a full input/output list from the 84 | # flutter tool. 85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 87 | add_custom_command( 88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 90 | ${CPP_WRAPPER_SOURCES_APP} 91 | ${PHONY_OUTPUT} 92 | COMMAND ${CMAKE_COMMAND} -E env 93 | ${FLUTTER_TOOL_ENVIRONMENT} 94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 95 | windows-x64 $ 96 | VERBATIM 97 | ) 98 | add_custom_target(flutter_assemble DEPENDS 99 | "${FLUTTER_LIBRARY}" 100 | ${FLUTTER_LIBRARY_HEADERS} 101 | ${CPP_WRAPPER_SOURCES_CORE} 102 | ${CPP_WRAPPER_SOURCES_PLUGIN} 103 | ${CPP_WRAPPER_SOURCES_APP} 104 | ) 105 | -------------------------------------------------------------------------------- /example/windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Disable Windows macros that collide with C++ standard library functions. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 25 | 26 | # Add dependency libraries and include directories. Add any application-specific 27 | # dependencies here. 28 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 29 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 30 | 31 | # Run the Flutter tool portions of the build. This must not be removed. 32 | add_dependencies(${BINARY_NAME} flutter_assemble) 33 | -------------------------------------------------------------------------------- /example/windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #ifdef FLUTTER_BUILD_NUMBER 64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0 67 | #endif 68 | 69 | #ifdef FLUTTER_BUILD_NAME 70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.example" "\0" 93 | VALUE "FileDescription", "example" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "example" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "example.exe" "\0" 98 | VALUE "ProductName", "example" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /example/windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /example/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /example/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"example", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /example/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /example/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tlserver/flutter_map_location_marker/ff3bf693dada5dd31a018fb2202bd450c0ccee85/example/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /example/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /example/windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | std::string utf8_string; 52 | if (target_length == 0 || target_length > utf8_string.max_size()) { 53 | return utf8_string; 54 | } 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /example/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /example/windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | -------------------------------------------------------------------------------- /flutter_map_location_marker.iml: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /lib/flutter_map_location_marker.dart: -------------------------------------------------------------------------------- 1 | /// A flutter_map plugin for displaying device current location. 2 | library; 3 | 4 | export 'src/data/data.dart'; 5 | export 'src/data/data_stream_factory.dart'; 6 | export 'src/drawings/default_location_marker.dart'; 7 | export 'src/drawings/heading_sector.dart'; 8 | export 'src/exceptions/incorrect_setup_exception.dart'; 9 | export 'src/exceptions/permission_denied_exception.dart'; 10 | export 'src/exceptions/permission_requesting_exception.dart'; 11 | export 'src/exceptions/service_disabled_exception.dart'; 12 | export 'src/options/align_on_update.dart'; 13 | export 'src/options/focal_point.dart'; 14 | export 'src/options/indicators.dart'; 15 | export 'src/options/marker_direction.dart'; 16 | export 'src/options/style.dart'; 17 | export 'src/widgets/animated_location_marker_layer.dart'; 18 | export 'src/widgets/current_location_layer.dart'; 19 | export 'src/widgets/location_marker_layer.dart'; 20 | -------------------------------------------------------------------------------- /lib/src/data/data.dart: -------------------------------------------------------------------------------- 1 | import 'package:latlong2/latlong.dart'; 2 | 3 | /// A position with accuracy for marker rendering. 4 | class LocationMarkerPosition { 5 | /// The latitude, in degrees. The range should be -90 (inclusive) to +90 6 | /// (inclusive). 7 | final double latitude; 8 | 9 | /// The longitude, in degrees. The range should be -180 (exclusive) to +180 10 | /// (inclusive). 11 | final double longitude; 12 | 13 | /// The estimated horizontal accuracy of this location, radial, in meters. The 14 | /// smaller value, the better accuracy. 15 | final double accuracy; 16 | 17 | /// Create a LocationMarkerPosition. 18 | const LocationMarkerPosition({ 19 | required this.latitude, 20 | required this.longitude, 21 | required this.accuracy, 22 | }); 23 | 24 | /// Convert to LatLng object 25 | LatLng get latLng => LatLng(latitude, longitude); 26 | 27 | @override 28 | String toString() => 'LocationMarkerPosition(' 29 | 'latitude: $latitude, ' 30 | 'longitude: $longitude, ' 31 | 'accuracy: $accuracy)'; 32 | } 33 | 34 | /// A angle with accuracy for marker rendering. 35 | class LocationMarkerHeading { 36 | /// The heading, in radius, which 0 radians being the north and positive 37 | /// angles going clockwise. 38 | final double heading; 39 | 40 | /// The estimated accuracy of this heading, in radius.The smaller value, the 41 | /// better accuracy. 42 | final double accuracy; 43 | 44 | /// Create a LocationMarkerHeading. 45 | const LocationMarkerHeading({ 46 | required this.heading, 47 | required this.accuracy, 48 | }); 49 | 50 | @override 51 | String toString() => 'LocationMarkerHeading(' 52 | 'heading: $heading, ' 53 | 'accuracy: $accuracy)'; 54 | } 55 | -------------------------------------------------------------------------------- /lib/src/data/tween.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | import 'data.dart'; 6 | 7 | /// A linear interpolation between a beginning and ending value for 8 | /// `LocationMarkerPosition`. 9 | class LocationMarkerPositionTween extends Tween { 10 | /// Creates a tween. 11 | LocationMarkerPositionTween({ 12 | required super.begin, 13 | required super.end, 14 | }); 15 | 16 | @override 17 | LocationMarkerPosition lerp(double t) { 18 | final begin = this.begin!; 19 | final end = this.end!; 20 | return LocationMarkerPosition( 21 | latitude: _doubleLerp(begin.latitude, end.latitude, t), 22 | longitude: _doubleLerp(begin.longitude, end.longitude, t), 23 | accuracy: _doubleLerp(begin.accuracy, end.accuracy, t), 24 | ); 25 | } 26 | } 27 | 28 | /// A linear interpolation between a beginning and ending value for 29 | /// `LocationMarkerHeading`. 30 | class LocationMarkerHeadingTween extends Tween { 31 | /// Creates a tween. 32 | LocationMarkerHeadingTween({ 33 | required super.begin, 34 | required super.end, 35 | }); 36 | 37 | @override 38 | LocationMarkerHeading lerp(double t) { 39 | final begin = this.begin!; 40 | final end = this.end!; 41 | return LocationMarkerHeading( 42 | heading: _radiusLerp(begin.heading, end.heading, t), 43 | accuracy: _radiusLerp(begin.accuracy, end.accuracy, t), 44 | ); 45 | } 46 | } 47 | 48 | /// A linear interpolation between a beginning and ending value for degree 49 | /// value. This value turn for both clockwise or anti-clockwise according to the 50 | /// shorter direction. 51 | class DegreeTween extends Tween { 52 | /// Creates a tween. 53 | DegreeTween({ 54 | required double begin, 55 | required double end, 56 | }) : super( 57 | begin: begin % 360, 58 | end: end % 360, 59 | ); 60 | 61 | @override 62 | double lerp(double t) => _degreeLerp(begin!, end!, t); 63 | } 64 | 65 | /// A linear interpolation between a beginning and ending value for radius 66 | /// value. This value turn for both clockwise or anti-clockwise according to the 67 | /// shorter direction. 68 | class RadiusTween extends Tween { 69 | /// Creates a tween. 70 | RadiusTween({ 71 | required double begin, 72 | required double end, 73 | }) : super( 74 | begin: begin % (2 * pi), 75 | end: end % (2 * pi), 76 | ); 77 | 78 | @override 79 | double lerp(double t) => _radiusLerp(begin!, end!, t); 80 | } 81 | 82 | double _doubleLerp(double begin, double end, double t) => 83 | begin + (end - begin) * t; 84 | 85 | double _circularLerp(double begin, double end, double t, double oneCircle) { 86 | final halfCircle = oneCircle / 2; 87 | // ignore: parameter_assignments 88 | begin = begin % oneCircle; 89 | // ignore: parameter_assignments 90 | end = end % oneCircle; 91 | 92 | final compareResult = (end - begin).abs().compareTo(halfCircle); 93 | final crossZero = compareResult == 1 || 94 | (compareResult == 0 && begin != end && begin >= halfCircle); 95 | if (crossZero) { 96 | double opposite(double value) => (value + halfCircle) % oneCircle; 97 | 98 | return opposite(_doubleLerp(opposite(begin), opposite(end), t)); 99 | } else { 100 | return _doubleLerp(begin, end, t); 101 | } 102 | } 103 | 104 | double _degreeLerp(double begin, double end, double t) => 105 | _circularLerp(begin, end, t, 360); 106 | 107 | double _radiusLerp(double begin, double end, double t) => 108 | _circularLerp(begin, end, t, 2 * pi); 109 | -------------------------------------------------------------------------------- /lib/src/drawings/default_location_marker.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | 4 | /// The default [Widget] that shows the device's position. By default, it is a 5 | /// blue circle with a white border. The color can be changed and a child can be 6 | /// displayed inside the circle. 7 | class DefaultLocationMarker extends StatelessWidget { 8 | /// The color of the marker. Default to ARGB(0xFF2196F3). 9 | final Color color; 10 | 11 | /// Typically the marker's icon. Default to null. 12 | final Widget? child; 13 | 14 | /// Create a DefaultLocationMarker. 15 | const DefaultLocationMarker({ 16 | super.key, 17 | this.color = const Color(0xFF2196F3), 18 | this.child, 19 | }); 20 | 21 | @override 22 | Widget build(BuildContext context) => DecoratedBox( 23 | decoration: const BoxDecoration( 24 | color: Color(0xFFFFFFFF), 25 | shape: BoxShape.circle, 26 | ), 27 | child: Padding( 28 | padding: const EdgeInsets.all(2), 29 | child: DecoratedBox( 30 | decoration: BoxDecoration( 31 | color: color, 32 | shape: BoxShape.circle, 33 | ), 34 | child: child, 35 | ), 36 | ), 37 | ); 38 | 39 | @override 40 | void debugFillProperties(DiagnosticPropertiesBuilder properties) { 41 | super.debugFillProperties(properties); 42 | properties.add(ColorProperty('color', color)); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/src/drawings/heading_sector.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | import '../data/data.dart'; 6 | 7 | /// A [CustomPainter] that draws a sector for displaying the device's heading. 8 | class HeadingSector extends CustomPainter { 9 | /// The color of this sector origin. The actual color is multiplied by a 10 | /// opacity factor which decreases when the distance to the origin increases. 11 | final Color color; 12 | 13 | /// The heading, in radius, which define the direction of the middle point of 14 | /// this sector. See [LocationMarkerHeading.heading]. 15 | final double heading; 16 | 17 | /// The accuracy, in radius, which affect the length of this sector. The 18 | /// actual length of this sector is `accuracy * 2`. See 19 | /// [LocationMarkerHeading.accuracy]. 20 | final double accuracy; 21 | 22 | /// Create a HeadingSector. 23 | HeadingSector(this.color, this.heading, this.accuracy); 24 | 25 | @override 26 | void paint(Canvas canvas, Size size) { 27 | final radius = size.shortestSide / 2; 28 | final rect = Rect.fromCircle( 29 | center: Offset(radius, radius), 30 | radius: radius, 31 | ); 32 | canvas.drawArc( 33 | rect, 34 | pi * 3 / 2 + heading - accuracy, 35 | accuracy * 2, 36 | true, 37 | Paint() 38 | ..shader = RadialGradient( 39 | colors: [ 40 | color.withValues(alpha: color.a * 1.0), 41 | color.withValues(alpha: color.a * 0.6), 42 | color.withValues(alpha: color.a * 0.3), 43 | color.withValues(alpha: color.a * 0.1), 44 | color.withValues(alpha: color.a * 0.0), 45 | ], 46 | ).createShader(rect), 47 | ); 48 | } 49 | 50 | @override 51 | bool shouldRepaint(HeadingSector oldDelegate) => 52 | oldDelegate.color != color || 53 | oldDelegate.heading != heading || 54 | oldDelegate.accuracy != accuracy; 55 | } 56 | -------------------------------------------------------------------------------- /lib/src/exceptions/incorrect_setup_exception.dart: -------------------------------------------------------------------------------- 1 | /// An exception thrown when the required platform specific setup steps have not 2 | /// been correctly done, such as permission definitions could not be found in 3 | /// the AndroidManifest.xml file on Android or in the Info.plist file on iOS. 4 | class IncorrectSetupException implements Exception { 5 | /// Create an IncorrectSetupException. 6 | const IncorrectSetupException(); 7 | } 8 | -------------------------------------------------------------------------------- /lib/src/exceptions/permission_denied_exception.dart: -------------------------------------------------------------------------------- 1 | /// An exception thrown when trying to access the device's location information 2 | /// while access is denied. 3 | class PermissionDeniedException implements Exception { 4 | /// Create a PermissionDeniedException. 5 | const PermissionDeniedException(); 6 | } 7 | -------------------------------------------------------------------------------- /lib/src/exceptions/permission_requesting_exception.dart: -------------------------------------------------------------------------------- 1 | /// An exception thrown when requesting location permissions while an earlier 2 | /// request has not yet been completed. 3 | class PermissionRequestingException implements Exception { 4 | /// Create a PermissionRequestingException. 5 | const PermissionRequestingException(); 6 | } 7 | -------------------------------------------------------------------------------- /lib/src/exceptions/service_disabled_exception.dart: -------------------------------------------------------------------------------- 1 | /// An exception thrown when trying to access the device's location information 2 | /// while the location service on the device is disabled. 3 | class ServiceDisabledException implements Exception { 4 | /// Create a ServiceDisabledException. 5 | const ServiceDisabledException(); 6 | } 7 | -------------------------------------------------------------------------------- /lib/src/options/align_on_update.dart: -------------------------------------------------------------------------------- 1 | /// Determines whether an 'align position event' or 'align direction event' 2 | /// should be emitted upon location or heading updates. 3 | enum AlignOnUpdate { 4 | /// Never emit an align event. 5 | never, 6 | 7 | /// Emit an align event only on the first update. This is equivalent to 8 | /// 'never' if set after the first update has occurred. 9 | once, 10 | 11 | /// Always emit align events. 12 | always, 13 | } 14 | -------------------------------------------------------------------------------- /lib/src/options/focal_point.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | /// The [FocalPoint] class defines a screen point to align a marker on the map 4 | /// during a focus event. It uses a combination of a normalized coordinate ratio 5 | /// and a pixel offset to determine the marker's final position on the map 6 | /// widget. 7 | class FocalPoint { 8 | /// The normalized coordinate [ratio] for aligning the marker within the map 9 | /// widget. This point follows a normalized coordinate system where: 10 | /// - (-1.0, -1.0) aligns the marker with the top-left corner of the map 11 | /// widget. 12 | /// - (1.0, 1.0) aligns the marker with the bottom-right corner of the map 13 | /// widget. 14 | /// - (0.0, 0.0) aligns the marker with the center of the map widget. 15 | /// 16 | /// The ratio is used to scale the marker's position proportionally to the 17 | /// size of the map widget, allowing for responsive design across different 18 | /// screen sizes. 19 | final Offset ratio; 20 | 21 | /// The pixel-based [offset] is applied after the [ratio] calculation to 22 | /// fine-tune the marker's position. This allows for precise adjustments to 23 | /// the marker's screen location, accommodating for elements such as map 24 | /// controls or overlays that may otherwise obscure the marker. 25 | /// 26 | /// For example, an offset of (10, 20) pixels would move the marker 10 pixels 27 | /// to the right and 20 pixels downward from the position calculated with the 28 | /// [ratio]. 29 | final Offset offset; 30 | 31 | /// Constructs a [FocalPoint] with an optional [ratio] and [offset], both 32 | /// defaulting to the origin point if not provided. 33 | const FocalPoint({ 34 | this.ratio = Offset.zero, 35 | this.offset = Offset.zero, 36 | }); 37 | 38 | /// Projects the [FocalPoint] onto the map widget given its [size]. The 39 | /// resulting [Offset] represents the absolute pixel coordinates on the map 40 | /// widget where the marker should be aligned. 41 | Offset project(Size size) => 42 | size.bottomRight(Offset.zero).scale(ratio.dx, ratio.dy) / 2 + offset; 43 | } 44 | -------------------------------------------------------------------------------- /lib/src/options/indicators.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../../flutter_map_location_marker.dart'; 4 | 5 | /// An object to store indicators widget for special status of 6 | /// [CurrentLocationLayer]. 7 | @immutable 8 | class LocationMarkerIndicators { 9 | /// A widget shown when in permission requesting status. 10 | final Widget? permissionRequesting; 11 | 12 | /// A widget shown when in permission denied status. 13 | final Widget? permissionDenied; 14 | 15 | /// A widget shown when in service disabled status. 16 | final Widget? serviceDisabled; 17 | 18 | /// Create a LocationMarkerIndicators. 19 | const LocationMarkerIndicators({ 20 | this.permissionRequesting, 21 | this.permissionDenied, 22 | this.serviceDisabled, 23 | }); 24 | } 25 | -------------------------------------------------------------------------------- /lib/src/options/marker_direction.dart: -------------------------------------------------------------------------------- 1 | /// Define how should the marker rotate. 2 | enum MarkerDirection { 3 | /// Always point to screen top. 4 | top, 5 | 6 | /// Always point to north. 7 | north, 8 | 9 | /// Follow the heading sector. 10 | heading, 11 | } 12 | -------------------------------------------------------------------------------- /lib/src/options/style.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:flutter_map/flutter_map.dart'; 3 | 4 | import '../drawings/default_location_marker.dart'; 5 | import 'marker_direction.dart'; 6 | 7 | /// An immutable style describing how to format and paint the location marker. 8 | @immutable 9 | class LocationMarkerStyle { 10 | /// The main marker widget. Default to [DefaultLocationMarker] 11 | final Widget marker; 12 | 13 | /// The size of main marker widget. Default to 20px * 20px. 14 | final Size markerSize; 15 | 16 | /// The alignment of the marker widget. Default to [Alignment.center]. The 17 | /// value is passed into [Marker.alignment] internally. 18 | final Alignment markerAlignment; 19 | 20 | /// The direction of the marker while map is rotated. Default to 21 | /// [MarkerDirection.top]. 22 | final MarkerDirection markerDirection; 23 | 24 | /// Whether to show accuracy circle. Android define accuracy as the radius of 25 | /// 68% confidence so there is a 68% probability that the true location is 26 | /// inside the circle. Default to true. 27 | final bool showAccuracyCircle; 28 | 29 | /// The color of the accuracy circle. Default to ARGB(0x182196F3). 30 | final Color accuracyCircleColor; 31 | 32 | /// Whether to show the heading sector. Default to true. 33 | final bool showHeadingSector; 34 | 35 | /// The radius of the heading sector in pixels. Default to 60. 36 | final double headingSectorRadius; 37 | 38 | /// The color of the heading sector. Default to ARGB(0xCC2196F3). 39 | final Color headingSectorColor; 40 | 41 | /// Create a LocationMarkerStyle. 42 | const LocationMarkerStyle({ 43 | this.marker = const DefaultLocationMarker(), 44 | this.markerSize = const Size.square(20), 45 | this.markerAlignment = Alignment.center, 46 | this.markerDirection = MarkerDirection.top, 47 | this.showAccuracyCircle = true, 48 | this.accuracyCircleColor = const Color(0x182196F3), 49 | this.showHeadingSector = true, 50 | this.headingSectorRadius = 60, 51 | this.headingSectorColor = const Color(0xCC2196F3), 52 | }); 53 | } 54 | -------------------------------------------------------------------------------- /lib/src/widgets/animated_location_marker_layer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_map/flutter_map.dart'; 4 | 5 | import '../data/data.dart'; 6 | import '../data/tween.dart'; 7 | import '../options/style.dart'; 8 | import 'location_marker_layer.dart'; 9 | 10 | /// A layer for location marker in [FlutterMap] with animation. 11 | class AnimatedLocationMarkerLayer extends StatelessWidget { 12 | /// A position with accuracy. 13 | final LocationMarkerPosition position; 14 | 15 | /// A angle with accuracy. 16 | final LocationMarkerHeading? heading; 17 | 18 | /// The style to use for this location marker. 19 | final LocationMarkerStyle style; 20 | 21 | /// The duration of the marker's move animation. Default to 200ms. 22 | final Duration moveAnimationDuration; 23 | 24 | /// The curve of the marker's move animation. Default to 25 | /// [Curves.fastOutSlowIn]. 26 | final Curve moveAnimationCurve; 27 | 28 | /// The duration of the heading sector rotate animation. Default to 50ms. 29 | final Duration rotateAnimationDuration; 30 | 31 | /// The curve of the heading sector rotate animation. Default to 32 | /// [Curves.easeInOut]. 33 | final Curve rotateAnimationCurve; 34 | 35 | /// Create a AnimatedLocationMarkerLayer. 36 | const AnimatedLocationMarkerLayer({ 37 | super.key, 38 | required this.position, 39 | this.heading, 40 | this.style = const LocationMarkerStyle(), 41 | this.moveAnimationDuration = const Duration(milliseconds: 200), 42 | this.moveAnimationCurve = Curves.fastOutSlowIn, 43 | this.rotateAnimationDuration = const Duration(milliseconds: 50), 44 | this.rotateAnimationCurve = Curves.easeInOut, 45 | }); 46 | 47 | @override 48 | Widget build(BuildContext context) => TweenAnimationBuilder( 49 | tween: LocationMarkerPositionTween( 50 | begin: position, 51 | end: position, 52 | ), 53 | curve: moveAnimationCurve, 54 | duration: moveAnimationDuration, 55 | builder: ( 56 | context, 57 | position, 58 | child, 59 | ) { 60 | if (heading != null) { 61 | return TweenAnimationBuilder( 62 | tween: LocationMarkerHeadingTween( 63 | begin: heading, 64 | end: heading, 65 | ), 66 | curve: rotateAnimationCurve, 67 | duration: rotateAnimationDuration, 68 | builder: ( 69 | context, 70 | heading, 71 | child, 72 | ) => 73 | LocationMarkerLayer( 74 | position: position, 75 | heading: heading, 76 | style: style, 77 | ), 78 | ); 79 | } else { 80 | return LocationMarkerLayer( 81 | position: position, 82 | style: style, 83 | ); 84 | } 85 | }, 86 | ); 87 | 88 | @override 89 | void debugFillProperties(DiagnosticPropertiesBuilder properties) { 90 | super.debugFillProperties(properties); 91 | properties 92 | ..add(DiagnosticsProperty('position', position)) 93 | ..add(DiagnosticsProperty('heading', heading)) 94 | ..add(DiagnosticsProperty('style', style)) 95 | ..add(DiagnosticsProperty('moveAnimationDuration', moveAnimationDuration)) 96 | ..add(DiagnosticsProperty('moveAnimationCurve', moveAnimationCurve)) 97 | ..add( 98 | DiagnosticsProperty( 99 | 'rotateAnimationDuration', 100 | rotateAnimationDuration, 101 | ), 102 | ) 103 | ..add(DiagnosticsProperty('rotateAnimationCurve', rotateAnimationCurve)); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /lib/src/widgets/location_marker_layer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_map/flutter_map.dart'; 4 | 5 | import '../data/data.dart'; 6 | import '../drawings/heading_sector.dart'; 7 | import '../options/marker_direction.dart'; 8 | import '../options/style.dart'; 9 | 10 | /// A layer for location marker in [FlutterMap]. 11 | class LocationMarkerLayer extends StatelessWidget { 12 | /// A position with accuracy. 13 | final LocationMarkerPosition position; 14 | 15 | /// A angle with accuracy. 16 | final LocationMarkerHeading? heading; 17 | 18 | /// The style to use for this location marker. 19 | final LocationMarkerStyle style; 20 | 21 | /// Create a LocationMarkerLayer. 22 | const LocationMarkerLayer({ 23 | super.key, 24 | required this.position, 25 | this.heading, 26 | this.style = const LocationMarkerStyle(), 27 | }); 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | final camera = MapCamera.maybeOf(context)!; 32 | return Stack( 33 | children: [ 34 | if (style.showAccuracyCircle) 35 | CircleLayer( 36 | circles: [ 37 | CircleMarker( 38 | point: position.latLng, 39 | radius: position.accuracy, 40 | useRadiusInMeter: true, 41 | color: style.accuracyCircleColor, 42 | ), 43 | ], 44 | ), 45 | MarkerLayer( 46 | markers: [ 47 | if (style.showHeadingSector && heading != null) 48 | Marker( 49 | point: position.latLng, 50 | width: style.headingSectorRadius * 2, 51 | height: style.headingSectorRadius * 2, 52 | child: IgnorePointer( 53 | child: CustomPaint( 54 | size: Size.fromRadius( 55 | style.headingSectorRadius, 56 | ), 57 | painter: HeadingSector( 58 | style.headingSectorColor, 59 | heading!.heading, 60 | heading!.accuracy, 61 | ), 62 | ), 63 | ), 64 | ), 65 | Marker( 66 | point: position.latLng, 67 | width: style.markerSize.width, 68 | height: style.markerSize.height, 69 | alignment: style.markerAlignment, 70 | child: switch (style.markerDirection) { 71 | MarkerDirection.north => style.marker, 72 | MarkerDirection.top => Transform.rotate( 73 | angle: -camera.rotationRad, 74 | child: style.marker, 75 | ), 76 | MarkerDirection.heading => Transform.rotate( 77 | angle: heading?.heading ?? -camera.rotationRad, 78 | child: style.marker, 79 | ), 80 | }, 81 | ), 82 | ], 83 | ), 84 | ], 85 | ); 86 | } 87 | 88 | @override 89 | void debugFillProperties(DiagnosticPropertiesBuilder properties) { 90 | super.debugFillProperties(properties); 91 | properties 92 | ..add(DiagnosticsProperty('position', position)) 93 | ..add(DiagnosticsProperty('heading', heading)) 94 | ..add(DiagnosticsProperty('style', style)); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /notes/migration_v5.md: -------------------------------------------------------------------------------- 1 | This update brings major breaking changes for all users. For a full list of changes, please see the 2 | full CHANGELOG, and make use of the old and new API reference. 3 | 4 | * Replace `LocationMarkerLayerWidget` with `CurrentLocationLayer` 5 | * The `LocationMarkerLayerWidget` class has been removed without deprecation. 6 | * To migrate, replace `LocationMarkerLayerWidget()` with `CurrentLocationLayer()`. 7 | * Note that the parameters of the constructor of `CurrentLocationLayer` is different from 8 | `LocationMarkerLayerWidget`: 9 | * There is no `plugin` and `options` parameters. 10 | * To migrate, directly pass all parameters to the constructor of `CurrentLocationLayer` 11 | instead of wrapping them in `LocationMarkerPlugin` or `LocationMarkerLayerOptions` 12 | classes. 13 | * Some parameters including `marker`, `markerSize`, `markerDirection`, `showAccuracyCircle`, 14 | `accuracyCircleColor`, `showHeadingSector`, `headingSectorRadius` and `headingSectorColor` 15 | is moved into a new class `LocationMarkerStyle`. 16 | * To migrate, create a `LocationMarkerStyle` object first and pass it in the `style` 17 | parameter. 18 | 19 | Example: 20 | 21 | * Old code: 22 | 23 | ```dart 24 | Widget build() { 25 | return LocationMarkerLayerWidget( 26 | plugin: LocationMarkerPlugin( 27 | centerCurrentLocationStream: _centerCurrentLocationStreamController.stream, 28 | turnHeadingUpLocationStream: _turnHeadingUpStreamController.stream, 29 | centerOnLocationUpdate: _centerOnLocationUpdate, 30 | turnOnHeadingUpdate: _turnOnHeadingUpdate, 31 | centerAnimationDuration: const Duration(milliseconds: 200), 32 | centerAnimationCurve: Curves.fastOutSlowIn, 33 | turnAnimationDuration: const Duration(milliseconds: 200), 34 | turnAnimationCurve: Curves.easeInOut, 35 | ), 36 | options: LocationMarkerLayerOptions( 37 | positionStream: const LocationMarkerDataStreamFactory().geolocatorPositionStream(), 38 | headingStream: const LocationMarkerDataStreamFactory().compassHeadingStream(), 39 | marker: const DefaultLocationMarker( 40 | child: Icon( 41 | Icons.navigation, 42 | color: Colors.white, 43 | ), 44 | ), 45 | markerSize: const Size.square(40), 46 | markerDirection: MarkerDirection.heading, 47 | showAccuracyCircle: true, 48 | accuracyCircleColor: Colors.black, 49 | showHeadingSector: true, 50 | headingSectorRadius: 80, 51 | headingSectorColor: Colors.black, 52 | moveAnimationDuration: const Duration(milliseconds: 200), 53 | moveAnimationCurve: Curves.fastOutSlowIn, 54 | rotateAnimationDuration: const Duration(milliseconds: 200), 55 | rotateAnimationCurve: Curves.easeInOut, 56 | ), 57 | ); 58 | } 59 | ``` 60 | 61 | * New code: 62 | 63 | ```dart 64 | Widget build() { 65 | return CurrentLocationLayer( 66 | style: LocationMarkerStyle( 67 | marker: const DefaultLocationMarker( 68 | child: Icon( 69 | Icons.navigation, 70 | color: Colors.white, 71 | ), 72 | ), 73 | markerSize: const Size.square(40), 74 | markerDirection: MarkerDirection.heading, 75 | showAccuracyCircle: true, 76 | accuracyCircleColor: Colors.black, 77 | showHeadingSector: true, 78 | headingSectorRadius: 80, 79 | headingSectorColor: Colors.black, 80 | ), 81 | positionStream: const LocationMarkerDataStreamFactory().geolocatorPositionStream(), 82 | headingStream: const LocationMarkerDataStreamFactory().compassHeadingStream(), 83 | centerCurrentLocationStream: _centerCurrentLocationStreamController.stream, 84 | turnHeadingUpLocationStream: _turnHeadingUpStreamController.stream, 85 | centerOnLocationUpdate: _centerOnLocationUpdate, 86 | turnOnHeadingUpdate: _turnOnHeadingUpdate, 87 | centerAnimationDuration: const Duration(milliseconds: 200), 88 | centerAnimationCurve: Curves.fastOutSlowIn, 89 | turnAnimationDuration: const Duration(milliseconds: 200), 90 | turnAnimationCurve: Curves.easeInOut, 91 | moveAnimationDuration: const Duration(milliseconds: 200), 92 | moveAnimationCurve: Curves.fastOutSlowIn, 93 | rotateAnimationDuration: const Duration(milliseconds: 200), 94 | rotateAnimationCurve: Curves.easeInOut, 95 | ); 96 | } 97 | ``` 98 | 99 | * If the location and heading is calculated in the app, `AnimatedLocationMarkerLayer`, a light 100 | weight widget which does not provide map controlling function such as auto-centering and 101 | auto-turning, is more suitable widget compared to `CurrentLocationLayer`. 102 | * Compare 103 | the [custom stream example](https://github.com/tlserver/flutter_map_location_marker/blob/master/example/lib/page/custom_stream_example.dart) 104 | and 105 | the [no stream example](https://github.com/tlserver/flutter_map_location_marker/blob/master/example/lib/page/no_stream_example.dart) -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_map_location_marker 2 | description: A flutter map plugin for displaying device current location. 3 | version: 10.1.0 4 | repository: https://github.com/tlserver/flutter_map_location_marker 5 | platforms: 6 | android: 7 | ios: 8 | linux: 9 | macos: 10 | web: 11 | windows: 12 | 13 | environment: 14 | sdk: ">=3.6.0 <4.0.0" 15 | flutter: ">=3.29.0" 16 | 17 | dependencies: 18 | flutter: 19 | sdk: flutter 20 | flutter_map: ^8.1.0 21 | flutter_rotation_sensor: ^0.1.0 22 | geolocator: ^14.0.0 23 | latlong2: ^0.9.1 24 | 25 | dev_dependencies: 26 | flutter_lints: ">=4.0.0 <6.0.0" 27 | flutter_test: 28 | sdk: flutter 29 | lint: ^2.3.0 30 | --------------------------------------------------------------------------------