1 Star 0 Fork 0

四川湃舟网络科技有限公司 / amap_flutter_search

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

前述

  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 = '',
  })
Copyright 2022 dingjian Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

amap_flutter_search 兼容新版本 api 展开 收起
Dart 等 4 种语言
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hyhuyin/amap_flutter_search.git
git@gitee.com:hyhuyin/amap_flutter_search.git
hyhuyin
amap_flutter_search
amap_flutter_search
main

搜索帮助

344bd9b3 5694891 D2dac590 5694891