GithubHelp home page GithubHelp logo

barretzhi / amap_view Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spicely/amap_view

0.0 0.0 0.0 306 KB

Flutter 高德地图

License: Other

Kotlin 45.12% Ruby 2.43% Swift 19.68% Objective-C 0.22% Dart 32.55%

amap_view's Introduction

amap_view

高德地图插件

Android

AndroidManifest.xml添加如下代码 <meta-data android:name="com.amap.api.v2.apikey" android:value="你的key" />

IOS

Info.plist添加如下代码

    // 默认
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>App需要您的同意,才能访问位置</string>
    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>App需要您的同意,才能访问位置</string>
    <key>amap_key</key>
    <string>  你的key  </string>

    // 导航
    <key>UIBackgroundModes</key> 
    <array> 
        <string>location</string>
        <string>audio</string> 
    </array>

AmapUtils目前只支持Android

    /// 直线距离测量
    double distance = await AmapUtils.calculateLineDistance(LatLng(30.649863, 104.066851), LatLng(30.659019, 104.057066));
    print(distance);

    /// 面积计算
    double distance = await AmapUtils.calculateArea(LatLng(30.765133, 103.955872), LatLng(30.608061, 104.138519));
    print(distance);

    /// 坐标转换
    LatLng latLng = await AmapUtils.converter(LatLng(39.93917, 116.379547), CoordType.baidu);
    print(latLng);

AmapSearch

    /// 地理编码(地址转坐标)
    List<Geocode> result = await AmapSearch.geocode('北京市海淀区北京大学口腔医院');
    result.forEach((e) {
        print(e.toJson());
    });

AmapLocation

    /// 持续定位
    await AmapLocation.start();
    AmapLocation.listen((dynamic location) { print(location);});

    /// 单次定位
    Location location = await AmapLocation.fetchLocation();
    print(location.toJson());

AmapView

    AmapView(
        initialCameraPosition: CameraPosition(target: center, zoom: 13),
        myLocationEnabled: true,
        scaleControlsEnabled: false,
        markers: Set<Marker>.of(markers.values),
        polylines: Set<Polyline>.of(polylines.values),
        setMyLocationButtonEnabled: true,
        onCameraMove: (pos) {
            print("onCameraMove ${pos.target}");
            setState(() {
                markers[centerMarkerId] = markers[centerMarkerId].copyWith(positionParam: pos.target);
        });
        },
        onCameraIdle: (pos) {
            print("onCameraIdle =====> $pos");
        },
        onTap: (pos) {
            print("onTap====> $pos");
        },
        onMapCreated: (AMapController controller) {
            mapController = controller;
        },
    )

AmapNavi IOS中 骑行、步行使用默认样式

    await AmapNavi.showRoute(
        // driver 汽车导航 默认使用官方组件 ride 骑行 walk 步行 【骑行和步行为自定义SDK 发起直接进入导航】
        naviType: NaviType.driver, 
        end: Poi("下一站", LatLng(30.659314, 104.056294), ""),
    );

amap_view's People

Contributors

spicely 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.