搜尋套件、儲存庫與 APP 分類

yandex_mapkit 封面
套件詳情v4.3.0

yandex_mapkit

一個用於在 Android 和 iOS 應用程式中整合 Yandex.MapKit 的 Flutter 外掛程式。

AndroidiOS
近 30 天下載
7790
喜歡數
236
Pub 分數
150

安裝套件

flutter pub add yandex_mapkit

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

Yandex MapKit 是一個 Flutter 插件,可實現 Yandex 地圖在 Android 和 iOS 應用中的無縫整合。它透過一致的 Dart API 提供地圖渲染、標記、路線和地理編碼功能。該插件在兩個平台都支援原生效能,並由社群維護。開發者可以自訂地圖外觀,處理使用者互動,並利用 Yandex 的地圖資料提供位置相關服務。對於需要詳細地圖與導航工具,且 Yandex 地圖廣泛使用的地區,此插件極為理想。

適用情境

  • 在移動應用中整合 Yandex 地圖
  • 顯示自定義標記和覆蓋層
  • 實施路線規劃和導航
  • 將地址轉換為座標
  • 建構位置感知的應用程式

主要特色

  • 跨平台支援(Android 與 iOS)
  • 原生地圖渲染效能
  • 標記和折線自定義
  • 地理編碼和反向地理編碼
  • 互動式地圖手勢和事件

適合對象

  • 面向俄羅斯和獨聯體市場的應用
  • 使用 Yandex 地圖數據的開發者
  • 基於位置的服務應用
  • 導航與路線規劃功能

使用建議

  • 需要 Yandex MapKit SDK 設定
  • 與其他外掛相比,文件較少
  • 取決於Yandex的區域覆蓋範圍
  • 需要正確的 API 金鑰設定
  • 在 Android 上可能需要額外的權限

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

yandex_mapkit

A flutter plugin for displaying yandex maps on iOS and Android.

Android iOS
Support SDK 26+ iOS 15+

Disclaimer: This project uses Yandex Mapkit which belongs to Yandex
When using Mapkit refer to these terms of use

Features

  • [X] Working with Placemarks/Polylines/Polygons/Circles - adding, updating, removing, tap events, styling
  • [X] Working with collections of map objects and clusters
  • [X] Setting map bounds and limiting user interactions
  • [X] Showing current user location
  • [X] Address suggestions
  • [X] Basic driving/bicycle/pedestrian routing
  • [X] Basic address direct/reverse search
  • [X] Working with geo objects
  • [X] Support for both lite and full variants

Getting Started

Generate your API Key
  1. Go to https://developer.tech.yandex.ru/services/
  2. Create a MapKit Mobile SDK key
Setup for iOS
  • Specify your API key and locale in ios/Runner/AppDelegate.swift. It should be similar to the following
import UIKit
import Flutter
import YandexMapsMobile

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    YMKMapKit.setLocale("YOUR_LOCALE") // Your preferred language. Not required, defaults to system language
    YMKMapKit.setApiKey("YOUR_API_KEY") // Your generated API key
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}
  • Specify your desired variant of native library using environment variable YANDEX_MAPKIT_VARIANT

Available options: lite and full. navikit variant is currently not supported.
Defaults to lite.
After changing YANDEX_MAPKIT_VARIANT you need to invalidate Xcode cache using

rm -rf ~/Library/Developer/Xcode/DerivedData
Setup for Android
  • Specify your desired variant of native library.

Available options: lite and full. navikit variant is currently not supported.
Defaults to lite.

Add the following line to android/gradle.properties

yandexMapkit.variant=<YOUR_DESIRED_VARIANT>
  • Add dependency implementation 'com.yandex.android:maps.mobile:4.39.1-<YOUR_DESIRED_VARIANT>' to android/app/build.gradle
dependencies {
    implementation 'com.yandex.android:maps.mobile:4.39.1-<YOUR_DESIRED_VARIANT>'
}
  • Specify your API key and locale in your custom application class.
    If you don't have one the you can create it like so

android/app/src/main/.../MainApplication.java

import android.app.Application;

import com.yandex.mapkit.MapKitFactory;

public class MainApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        MapKitFactory.setLocale("YOUR_LOCALE"); // Your preferred language. Not required, defaults to system language
        MapKitFactory.setApiKey("YOUR_API_KEY"); // Your generated API key
    }
}

android/app/src/main/.../MainApplication.kt

import android.app.Application

import com.yandex.mapkit.MapKitFactory

class MainApplication: Application() {
  override fun onCreate() {
    super.onCreate()
    MapKitFactory.setLocale("YOUR_LOCALE") // Your preferred language. Not required, defaults to system language
    MapKitFactory.setApiKey("YOUR_API_KEY") // Your generated API key
  }
}
  • In your android/app/src/main/AndroidManifest.xml

Add permissions <uses-permission android:name="android.permission.INTERNET"/> and <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

Find application tag and replace android:name to the name of your custom application class prefixed by a dot .. In the end it should look like the following

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <application
      android:name=".MainApplication" >
Usage

For usage examples refer to example app

image

Additional remarks
Language

YandexMapkit always works with one language only.
Due to native constraints after the application is launched it can't be changed.

Android. Hybrid Composition

By default android views are rendered using Hybrid Composition.
To render the YandexMap widget on Android using Virtual Display(old composition), set AndroidYandexMap.useAndroidViewSurface to false.
Place this anywhere in your code, before using YandexMap widget.

AndroidYandexMap.useAndroidViewSurface = false;

所屬分類

依賴

依賴清單 3 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。