Giter VIP home page Giter VIP logo

amap_flutter_search's Introduction

前述

  1. 高德搜索Flutter插件
  2. 登录高德开放平台官网分别申请Android端iOS端的key
  3. 如需了解高德搜索原生SDK的相关功能,请参阅Android搜索SDK开发指南iOS搜索SDK开发指南

使用高德搜索Flutter插件

安卓端配置

需要将keystore文件添加到项目中,并在build.gradle中添加签名,(如需运行example中项目,需自行修改)

    signingConfigs {
        debug {
            storeFile file("xxx") //keystore路径
            storePassword 'xx'
            keyAlias 'xx'
            keyPassword 'xx'
        }
        release {
            storeFile file("xx") //keystore路径
            storePassword 'xx'
            keyAlias 'xx'
            keyPassword 'xx'
        }
    }

在需要的搜索功能的页面中引入搜索Flutter插件的dart类

import 'package:amap_flutter_search/amap_flutter_search.dart';

接口说明

设置Android和iOS的apikey

  ///设置Android和iOS的apikey,建议在weigdet初始化时设置<br>
  ///apiKey的申请请参考高德开放平台官网<br>
  ///Android端: https://lbs.amap.com/api/android-location-sdk/guide/create-project/get-key<br>
  ///iOS端: https://lbs.amap.com/api/ios-location-sdk/guide/create-project/get-key<br>
  ///[androidKey] Android平台的key<br>
  ///[iosKey] ios平台的key<br>
  static void setApiKey(String androidKey, String iosKey)

隐私设置

  /// 设置是否已经包含高德隐私政策并弹窗展示显示用户查看,如果未包含或者没有弹窗展示,高德定位SDK将不会工作<br>
  /// 高德SDK合规使用方案请参考官网地址:https://lbs.amap.com/news/sdkhgsy<br>
  /// <b>必须保证在调用定位功能之前调用, 建议首次启动App时弹出《隐私政策》并取得用户同意</b><br>
  /// 高德SDK合规使用方案请参考官网地址:https://lbs.amap.com/news/sdkhgsy
  /// [hasContains] 隐私声明中是否包含高德隐私政策说明<br>
  /// [hasShow] 隐私权政策是否弹窗展示告知用户<br>
  static void updatePrivacyShow(bool hasContains, bool hasShow)

  /// 设置是否已经取得用户同意,如果未取得用户同意,高德定位SDK将不会工作<br>
  /// 高德SDK合规使用方案请参考官网地址:https://lbs.amap.com/news/sdkhgsy<br>
  /// <b>必须保证在调用定位功能之前调用, 建议首次启动App时弹出《隐私政策》并取得用户同意</b><br>
  /// [hasAgree] 隐私权政策是否已经取得用户同意<br>
  static void updatePrivacyAgree(bool hasAgree)

关键字搜索

  /// 关键字搜索poi
  ///
  /// 在城市[city]搜索关键字[keyword]的poi, 可以设置每页数量[pageSize](1-50)和第[page](1-100)页
  static Future<List<AMapPoi>> searchKeyword(
    String keyword, {
    String city = '',
    String types = '',
    int pageSize = 20,
    int page = 1,
  })

周边搜索poi

  /// 周边搜索poi
  ///
  /// 在中心点[center]周边搜索关键字[keyword]和城市[city]的poi, 可以设置每页数量[pageSize](1-50)和第[page](1-100)页
  static Future<List<AMapPoi>> searchAround(
    Location center, {
    String keyword ,
    String city ,
    int pageSize ,
    int page,
    int radius ,
  })

TODO

  /// 输入内容自动提示
  ///
  /// 输入关键字[keyword], 并且限制所在城市[city]
  static Future<List> fetchInputTips(
    String keyword, {
    String city,
  })

TODO

  /// 地理编码(地址转坐标)
  ///
  /// 输入关键字[keyword], 并且限制所在城市[city]
  static Future<List> searchGeocode(
    String keyword, {
    String city = '',
  })

amap_flutter_search's People

Contributors

dingjianjaja avatar leozhang37 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.