Giter Club home page Giter Club logo

flutter_2d_amap's Introduction

flutter_2d_amap

本插件主要服务于 flutter_deer。仅保持现有功能,需要的功能可自行拓展。

高德2D地图插件(已支持1.12版本新的android插件api)

效果展示

实现功能包括

  • 处理地图所需权限申请
  • 定位并自动移动地图至当前位置
  • 默认获取POI数据并返回
  • 支持传入经纬度来移动地图
  • 支持搜索POI

使用方式

flutter_2d_amap:
    git:
      url: https://github.com/simplezhli/flutter_2d_amap.git

import 'package:flutter_2d_amap/flutter_2d_amap.dart';


AMap2DView(
  onPoiSearched: (result) {

  },
  onAMap2DViewCreated: (controller) {

  },
)

Android

AndroidManifest.xml 中添加:

<meta-data
     android:name="com.amap.api.v2.apikey"
     android:value="配置你的key"/>

如果你的targetSdkVersion为27以上,则需要做以下配置来支持http明文请求(具体可以看demo),否则会导致地图加载不出:

AndroidManifest.xml 中添加:

<application
  android:networkSecurityConfig="@xml/network_security_config"
/>

在 res 下新增一个 xml 目录,然后创建一个名为:network_security_config.xml 文件:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true" />
</network-security-config>

iOS

使用前设置key:

Flutter2dAMap.setApiKey("配置你的key");

在info.plist中增加:

    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>地图功能需要您的定位服务,否则无法使用,如果您需要使用后台定位功能请选择“始终允许”。</string>

    <key>NSLocationAlwaysUsageDescription</key>
    <string>地图功能需要您的定位服务,否则无法使用。</string>

    <key>NSLocationWhenInUseUsageDescription</key>
    <string>地图功能需要您的定位服务,否则无法使用。</string>

    <key>io.flutter.embedded_views_preview</key>
    <true/>

License

Copyright 2019 simplezhli

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

flutter_2d_amap's People

Contributors

simplezhli avatar shao-xianhui avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.