eft_flutter_amap 0.0.1

  • Readme
  • Changelog
  • Installing
  • 42

eft_flutter_amap #

A flutter plugin to use amap.

Getting Started #

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

dependencies:
  eft_flutter_amap: "^0.0.1"

Getting Started #

  • Android

  • Add following permissions to your AndroidManifest.xml

    <!--用于访问网络,网络定位需要上网-->
    <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" />
    <!--用于访问GPS定位-->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <!--用于读取手机当前的状态-->
    <uses-permission android:name="android.permission.READ_PHONE_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.WAKE_LOCK"/>
    <!--用于申请调用A-GPS模块-->
    <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"></uses-permission>
    <!--用于申请获取蓝牙信息进行室内定位-->
    <uses-permission android:name="android.permission.BLUETOOTH"></uses-permission>
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"></uses-permission>

  • Add following code between
            <meta-data
                android:name="com.amap.api.v2.apikey"
                android:value="[您在高德地图后台申请的Android Key]"/>
            <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" />
  • ios

  • Add following permissions in info.plist

	<key>NSAppTransportSecurity</key>
	<dict>
		<key>NSAllowsArbitraryLoads</key>
		<true/>
	</dict>
	<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
	<string></string>
	<key>NSLocationWhenInUseUsageDescription</key>
	<string></string>
	<key>UIBackgroundModes</key>
    	<array>
    		<string>fetch</string>
    		<string>location</string>
    		<string>newsstand-content</string>
    	</array>
    	

How to use #

import 'package:eft_flutter_amap/eft_flutter_amap.dart';
await EftFlutterAmap.initKey("[您在高德地图后台申请的IOS Key]"); //初始化IOS key
await EftFlutterAmap.initLocation(onceFlag); //请求定位,onceFlag:true单次,false持续
await EftFlutterAmap.stopLocation(); //停止定位
await EftFlutterAmap.destoryLocation(); //销毁定位
await EftFlutterAmap.showMap("[地点名称]","[描述]",[坐标]); //显示地图
await EftFlutterAmap.showNavMap(
      startLocation: [始点坐标],
      endLocation: [终点坐标],
      startAddress: "[始点]",
      endAddress: "[终点]"
    ); //导航
EftFlutterAmap.setMethodCallHandler((MethodCall call){
    });//获取定位返回

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

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

0.0.1 #

A flutter plugin for amap 1.get location 2.show map view 3.show navigate view

Use this package as a library

1. Depend on it

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


dependencies:
  eft_flutter_amap: ^0.0.1

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:eft_flutter_amap/eft_flutter_amap.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]
60
Overall:
Weighted score of the above. [more]
42
Learn more about scoring.

We analyzed this package on Nov 15, 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.

Health suggestions

Format lib/eft_flutter_amap.dart.

Run flutter format to format lib/eft_flutter_amap.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and eft_flutter_amap.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

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.

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