Coder Social home page Coder Social logo

tangxiucai2 / flutter_amap Goto Github PK

View Code? Open in Web Editor NEW

This project forked from best-flutter/flutter_amap

0.0 1.0 0.0 169 KB

A Flutter plugin use amap.高德地图flutter组件

License: MIT License

Java 17.46% Ruby 6.17% Objective-C 39.83% Dart 36.54%

flutter_amap's Introduction

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_amap: "^0.0.1"

在要用的地方导入:

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") ;
 
     });
   }

特性

  • android支持
  • ios 支持
  • 不需要新增Activity或Controller就可以展示地图
  • 地图的展示和隐藏
  • 设置地图位置
  • 基本地图选项
  • 定位回调
  • 展示定制的地图Mark
  • 搜索api
  • 更多api

flutter_amap's People

Contributors

jzoom avatar

Watchers

James Cloos 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.