• Stars
    star
    167
  • Rank 221,622 (Top 5 %)
  • Language
    Dart
  • License
    Apache License 2.0
  • Created almost 5 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Flutter 高德2D地图插件(支持Android、iOS、Web)

flutter_2d_amap

高德2D地图插件

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

效果展示

实现功能包括

已知问题

使用方式

pubspec.yaml 添加:

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

使用前同意隐私政策:

Flutter2dAMap.updatePrivacy(true);

使用:

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(iOSKey: '配置你的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/>

Web

index.html中添加(在main.dart.js之前):

<script src="https://webapi.amap.com/loader.js"></script>

使用前设置key:

Flutter2dAMap.setApiKey(webKey: '配置你的key');

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.

More Repositories

1

flutter_deer

🦌 Flutter 练习项目(包括集成测试、可访问性测试)。内含完整UI设计图,更贴近真实项目的练习。Flutter practice project (including integration testing and accessibility testing). Contains complete UI design drawings for a more realistic practice project.
Dart
7,396
star
2

Tesseract-OCR-Scanner

[停止维护]基于Tesseract-OCR实现自动扫描识别手机号
Java
649
star
3

AndroidUT

Android开发中必要的一环---单元测试(Unit Test)
Java
496
star
4

RemoteControlView

【停止维护】一款万能遥控器的交互效果
Java
416
star
5

ChangeTabLayout

[停止维护]一款炫酷的TabLayout
Java
340
star
6

flutter_remote_control

flutter remote control
Dart
175
star
7

Saber

🏄 帮助你快速使用Android的LiveData与ViewModel,已支持SavedState
Java
144
star
8

RxPay

【停止维护】支付宝、微信支付快速集成
Java
47
star
9

RecyclerViewExtensionsDemo

RecyclerView列表优化方案
Java
43
star
10

Dagger2Example

[停止维护]Dagger2简单使用,推荐使用Jetpack Hilt。
Java
39
star
11

RxBindingExample

[停止维护]RxBinding使用例子
Java
25
star
12

SAFExample

SAF(Storage Access Framework)使用例子
Java
21
star
13

flutter_riverpod_examples

Dart
20
star
14

AspectJDemo

AspectJ Demo
Java
13
star
15

RedEnvelopeService

[停止维护]抢红包助手
Java
11
star
16

ZCarouselView

[停止维护]一种轮播图效果
Java
7
star
17

flutter_video_player

利用官方video_player项目结构,使用外接纹理的方式接入阿里云点播SDK。个人练习,仅供参考。
Dart
3
star
18

flutter_ffi

C++
2
star
19

rn-learning

React Native练习Demo
JavaScript
1
star
20

simplezhli

1
star