amap_plugin 0.0.4

  • Readme
  • Changelog
  • Example
  • Installing
  • new46

amap_plugin #

这是一个flutter的高德地图插件,支持iOS和Android平台


Getting Started #

Add dependency #

dependencies:
  amap_plugin:  

Useage #

Android #

1.AndroidManifest.xml 配置 网络 定位 权限

//地图包、搜索包需要的基础权限

<!--允许程序打开网络套接字-->
<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" /> 

2.配置 AndroidManifest.xml 文件 在AndroidManifest.xml的application标签中配置Key:

<meta-data
android:name="com.amap.api.v2.apikey"
android:value="您的Key"/>

iOS #

1.配置Info.plist 文件

iOS9为了增强数据访问安全,将所有的http请求都改为了https,为了能够在iOS9中正常使用地图SDK,请在"Info.plist"中添加如下配置,否则影响高德SDK的使用。

<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true></true>
</dict>

在info.plist加入定位权限 定位权限有三种(前两个同时添加 或 同时不添加),您可根据需求进行选择。

Privacy - Location Always Usage Description   始终允许访问位置信息
Privacy - Location Always and When In Use Usage Description 始终允许访问位置信息

Privacy - Location Usage Description   永不允许访问位置信息

Privacy - Location When In Use Usage Description  使用应用期间允许访问位置信息

2.配置Info.plist 文件 如下加入高德apikey 字段

<key>AMapAPIKey</key>
<string>
您的Key
</string>

Flutter #

使用如下:

import 'package:amap_plugin/amap_plugin.dart';
void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
    @override
    _MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
    @override
    Widget build(BuildContext context) {
        return MaterialApp(
            home: Scaffold(
                appBar: AppBar(
                    title: const Text('Plugin example app'),
                    ),
            body: AMapView(),
            ),
        );
    }   
}

其他 #

如有bug 或者 需求 请在 GitHub 提 issues 或者发本人邮箱共同学习探讨:234009184@qq.com

0.0.1 #

1.支持地图的简单展示 2.支持显示定位位置

0.0.2 #

1.更新readme说明

0.0.3 #

1.优化代码格式

0.0.4 #

1.优化readme

example/README.md

amap_plugin_example #

Demonstrates how to use the amap_plugin plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  amap_plugin: ^0.0.4

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:amap_plugin/amap_plugin.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
46
Learn more about scoring.

We analyzed this package on Nov 11, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

The description is too long. (-10 points)

Search engines display only the first part of the description. Try to keep the value of the description field in your package's pubspec.yaml file between 60 and 180 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test