All Projects → pdliuw → ai_amap

pdliuw / ai_amap

Licence: BSD-3-Clause License
amap plugin of flutter,flutter,amap,flutter amap plugin

Programming Languages

dart
5743 projects
kotlin
9241 projects
swift
15916 projects
C++
36643 projects - #6 most used programming language
ruby
36898 projects - #4 most used programming language
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to ai amap

react-components
React components library.
Stars: ✭ 27 (+17.39%)
Mutual labels:  amap
Moss
A GitHub client app developed with Flutter, which supports Android iOS Web. More feature: BaiduMap+Amap UI+DiDi+Weibo!
Stars: ✭ 76 (+230.43%)
Mutual labels:  amap
arcgis-android-moremap
基于 ArcGIS for Android 加载高德/百度/腾讯等切片底图
Stars: ✭ 38 (+65.22%)
Mutual labels:  amap
sy flutter amap
高德地图flutter插件
Stars: ✭ 13 (-43.48%)
Mutual labels:  amap
cordova-plugin-amap
Amap Maps plugin for Cordova
Stars: ✭ 51 (+121.74%)
Mutual labels:  amap
echarts-extension-amap
🚩 An AMap (https://lbs.amap.com) extension for Apache ECharts (https://github.com/apache/echarts)
Stars: ✭ 180 (+682.61%)
Mutual labels:  amap
AmapLike
【高仿】高德地图 包含定位、搜索、路径规划等功能 map bottomsheet
Stars: ✭ 51 (+121.74%)
Mutual labels:  amap
react-amap
基于 React 封装的高德地图组件,助你轻松的接入高德地图到 React 项目中。
Stars: ✭ 73 (+217.39%)
Mutual labels:  amap
mifitxiaomipiholelist
MiFit/Xiaomi PiHole Bock List
Stars: ✭ 28 (+21.74%)
Mutual labels:  amap
L7
🌎 Large-scale WebGL-powered Geospatial Data Visualization analysis framework which relies on Mapbox GL or AMap to render basemaps.
Stars: ✭ 2,517 (+10843.48%)
Mutual labels:  amap
Flutter deer
🦌 Flutter 练习项目(包括集成测试、可访问性测试)。内含完整UI设计图,更贴近真实项目的练习。Flutter practice project. Includes a complete UI design and exercises that are closer to real projects.
Stars: ✭ 5,725 (+24791.3%)
Mutual labels:  amap
Vue Amap
🌍 基于 Vue 2.x 和高德地图的地图组件
Stars: ✭ 3,074 (+13265.22%)
Mutual labels:  amap
AMapMarker-master
提供一种高德地图自定义marker的解决方案以及改善高德官方点聚合功能
Stars: ✭ 63 (+173.91%)
Mutual labels:  amap

ai_amap

totem


English Document 中文文档
Plugin Pub Points Popularity Likes
ai_amap pub package pub points popularity likes

Effect

iOS-map Android-map
ios android
:- :-
web-map
web
:-

1.安装

使用当前包作为依赖库

1. 依赖此库

在文件 'pubspec.yaml' 中添加

Plugin Pub Points Popularity Likes
ai_amap pub package pub points popularity likes

dependencies:

  ai_amap: ^version

或者以下方式依赖

dependencies:

  # ai_amap package.
  ai_amap:
    git:
      url: https://github.com/pdliuw/ai_amap.git

2. 安装此库

你可以通过下面的命令行来安装此库


$ flutter pub get


你也可以通过项目开发工具通过可视化操作来执行上述步骤

3. 导入此库

现在,在你的Dart编辑代码中,你可以使用:


import 'package:ai_amap/ai_amap.dart';

2.使用

使用'地图'需要动态申请权限,动态权限推荐:permission_handler

配置权限

Android

    <!--
    地图SDK(包含其搜索功能)需要的基础权限
    -->

    <!--允许程序打开网络套接字-->
    <uses-permission android:name="android.permission.INTERNET" />
    <!--允许程序设置内置sd卡的写权限-->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <!--允许程序获取网络状态-->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <!--允许程序访问WiFi网络信息-->
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <!--允许程序读写手机状态和身份-->
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <!--允许程序访问CellID或WiFi热点来获取粗略的位置-->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

    <!--
    地图定位需要的权限
    -->

    <!--用于进行网络定位-->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <!--用于访问GPS定位-->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <!--用于获取运营商信息,用于支持提供运营商信息相关的接口-->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <!--用于访问wifi网络信息,wifi信息会用于进行网络定位-->
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <!--用于获取wifi的获取权限,wifi信息会用来进行网络定位-->
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
    <!--用于访问网络,网络定位需要上网-->
    <uses-permission android:name="android.permission.INTERNET"/>
    <!--用于读取手机当前的状态-->
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <!--用于写入缓存数据到扩展存储卡-->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <!--用于申请调用A-GPS模块-->
    <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>

    <!--
    导航所需权限
    -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />


    <application>
    
    ...    

        <meta-data
            android:name="com.amap.api.v2.apikey"
            android:value="${apiKey}" />
        <!--
        https://lbs.amap.com/api/android-location-sdk/guide/android-location/getlocation
        (请在application标签中声明service组件,每个app拥有自己单独的定位service。)
        -->
        <service android:name="com.amap.api.location.APSService"></service>

        <!--
        地图导航组件
        -->
        <activity android:name="com.amap.api.navi.AmapRouteActivity"
            android:theme="@android:style/Theme.NoTitleBar"
            android:configChanges="orientation|keyboardHidden|screenSize" />

    </application>

iOS

	<key>NSFileProviderPresenceUsageDescription</key>
	<string>使用时允许访问文件</string>
	<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
	<string>始终允许定位(提高后台定位准确率)</string>
	<key>NSLocationAlwaysUsageDescription</key>
	<string>使用时始终允许定位</string>
	<key>NSLocationWhenInUseUsageDescription</key>
	<string>使用时允许定位</string>


** 为提高iOS定位成功率,请打开-->'Background Modes' --> 勾选 ️'Location Updates' **

iOS支持PlatformView配置:

	
    <key>io.flutter.embedded_views_preview</key>
    <true/>
    
web
    
    <script src="https://webapi.amap.com/loader.js" type="text/javascript"></script>
    
    

1.使用'地图组件'的地方中:

    //map widget
    _aMapWidget = AiAMapLocationPlatformWidget(
      platformWidgetController: _locationController,
    );

  • 2、使用地图Controller

    _locationController = AiAMapLocationPlatformWidgetController(
      locationResultCallback:
          (AiAMapLocationResult locationResult, bool isSuccess) {
        setState(() {
          _currentState = "定位:$isSuccess";
        });

        if (locationResult.haveAddress()) {
          _locationController.stopLocation();

          setState(() {
            if (widget._locationResultCallback != null) {
              widget._locationResultCallback(locationResult, isSuccess);
            }
            _locationAddress = locationResult.address;
          });

        }
      },
      platformViewCreatedCallback: (int id) {
        setState(() {
          //1、ApiKey
          AiAMapLocationPlatformWidgetController.setApiKey(
              apiKey: "$_yourPrimaryKey");
          //2、初始化定位服务
          _locationController..recreateLocationService();
          _locationController.startLocation();
          setState(() {
            _currentState = "开始定位";
          });
        });
      },

2.使用'定位服务'的地方中:


      @override
      void initState() {
        super.initState();
    
        _locationController = AiAMapLocationController(
          locationResultCallback: (result, successful) {
            if (result.haveAddress()) {
              _stopLocation();
              setState(() {
                _locationAddress = result.address;
              });
            }
          },
        );
    
        WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
          //1、ApiKey
          AiAMapLocationController.setApiKey(
              apiKey: "${GlobalConfig.AMAP_KEY}");
          _startLocation();
        });
      }



      void _startLocation() {
        _locationController.startLocation();
        
      }

        
      void _stopLocation() {
        _locationController.stopLocation();

      }
    

LICENSE

BSD 3-Clause License

Copyright (c) 2020, pdliuw
All rights reserved.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].