flutter_amap 0.0.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 80

flutter_amap

高德地图3d flutter组件。

展示原生android、ios高德地图,并与flutter交互。

注意:随着flutter版本的提升, 本项目也会随之更新,目前这个版本只能在单独的controller或者activity中打开高德地图。

Getting Started

集成高德地图android版本

1、先申请一个apikey http://lbs.amap.com/api/android-sdk/guide/create-project/get-key

2、在AndroidManifest.xml中增加

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

3、增加对应的权限:

<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.CHANGE_CONFIGURATION" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />

4、增加要显示的activity:

<activity android:name="com.jzoom.flutteramap.AMapActivity" android:theme="@style/Theme.AppCompat.Light.DarkActionBar"/>

集成高德地图ios版本

1、申请一个key http://lbs.amap.com/api/ios-sdk/guide/create-project/get-key

直接在dart文件中设置key

import 'package:flutter_amap/flutter_amap.dart';
   
   void main(){
     FlutterAmap.setApiKey("你的key");
     runApp(ne w MyApp());
   }

2、在info.plist中增加:

<key>NSLocationWhenInUseUsageDescription</key>
<string>要用定位</string>

How to use

先导入dart包 修改pubspec.yaml,增加依赖:

dependencies:
  flutter_alipay: "^0.1.0"

在要用的地方导入:

import 'package:flutter_amap/flutter_amap.dart';

然后就可以使用了

 FlutterAmap amap = new FlutterAmap();
 
 void show(){
     amap.show(
         mapview: new AMapView(
             centerCoordinate: new LatLng(39.9242, 116.3979),
             zoomLevel: 13.0,
             mapType: MapType.night,
             showsUserLocation: true),
         title: new TitleOptions(title: "我的地图"));
     amap.onLocationUpdated.listen((Location location){
 
       print("Location changed $location") ;
 
     });
   }

Feature

  • IOS Support
  • Android Support
  • Support for full screen map
  • Support for location change update
  • Support for basic map options

[0.0.1] - 05-13-2018

  • IOS Support
  • Android Support
  • Support for full screen map
  • Support for location change update
  • Support for basic map options

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_amap/flutter_amap.dart';

void main(){
  FlutterAmap.setApiKey("0787b16ca4fd97815b1d354571e9f9c1");
  runApp(new MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {

  FlutterAmap amap = new FlutterAmap();

  @override
  initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Plugin example app'),
        ),
        body: new Center(
          child: new InkWell(child: new Text("Show Map"),onTap: this.show)
        ),
      ),
    );
  }


  void show(){
    amap.show(
        mapview: new AMapView(
            centerCoordinate: new LatLng(39.9242, 116.3979),
            zoomLevel: 13.0,
            mapType: MapType.night,
            showsUserLocation: true),
        title: new TitleOptions(title: "我的地图"));
    amap.onLocationUpdated.listen((Location location){

      print("Location changed $location") ;

    });
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_amap: ^0.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_amap/flutter_amap.dart';
  
Version Uploaded Documentation Archive
0.0.1 May 13, 2018 Go to the documentation of flutter_amap 0.0.1 Download flutter_amap 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
72
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
80
Learn more about scoring.

We analyzed this package on Sep 18, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.3
  • Flutter: 0.8.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

The description is too short.

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Package is pre-v0.1 release.

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

Format lib/amap_view.dart.

Run flutter format to format lib/amap_view.dart.

Fix lib/flutter_amap.dart.

Analysis of lib/flutter_amap.dart reported 1 hint:

line 13 col 8: Unused import: 'latlng.dart'.

Format lib/latlng.dart.

Run flutter format to format lib/latlng.dart.

Fix additional 4 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/location.dart (Run flutter format to format lib/location.dart.)
  • lib/map_type.dart (Run flutter format to format lib/map_type.dart.)
  • lib/region.dart (Run flutter format to format lib/region.dart.)
  • lib/title_options.dart (Run flutter format to format lib/title_options.dart.)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.48.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8