パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v4.2.0

google_places_autocomplete_text_field

Flutter用のiOS、Android、Web対応の完全カスタマイズ可能なGoogle Places自動補完TextFormField。

AndroidiOSmacOSWindowsLinux
30日間ダウンロード
3120
いいね数
38
Pub ポイント
160

パッケージをインストール

flutter pub add google_places_autocomplete_text_field

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

iOS、Android、Web プラットフォームをサポートするカスタマイズ可能な Flutter テキストフィールドで、Google プレースの自動補完に対応しています。Google プレース API によって提供されるリアルタイムの提案を使用して、ユーザーが場所を検索および選択できるようにします。住所や場所の入力が必要なフォームへのスムーズな統合を目的としており、スタイルや動作の柔軟性を提供します。ユーザーが入力した住所から正確な地理情報データを必要とするアプリに最適です。

用途

  • フォーム内の住所入力
  • 旅行アプリにおける場所の選択
  • 配送先住所の入力
  • 位置情報に基づくサービス
  • ユーザープロファイルのセットアップ

主な機能

  • リアルタイムの場所の提案
  • カスタマイズ可能な UI とスタイル
  • クロスプラットフォーム対応(iOS、Android、Web)
  • Google Places API との統合
  • 組み込みエラー処理と検証

適している対象

  • 位置入力を必要とするモバイルおよびウェブアプリケーション
  • 配達またはマッピング機能を備えたアプリ
  • 正確な住所入力が必要なフォーム
  • Google Places API を使用する開発者
  • 自動補完を重視するUXのプロジェクト

注意事項

  • Google Places API キーが必要です
  • 照会に基づいて使用料が発生する可能性があります
  • インターネット接続に依存します
  • 提案リストの外観のカスタマイズが限定的
  • 高負荷時の応答時間に遅延が生じる可能性

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

google_places_autocomplete_text_field

This Flutter package helps you build a TextField that provides autocompletion suggestions from the new Google Places API.

Go check it out on pub.dev!

Add the dependency to pubspec.yml ➕

dependencies:
  flutter:
    sdk: flutter
  google_places_autocomplete_text_field: <last-version>

Integrate the Google AutoComplete TextField Widget in your code 🧩

    GooglePlacesAutoCompleteTextFormField(
        textEditingController: controller,
        config: const GoogleApiConfig(
          apiKey: 'YOUR_GOOGLE_API_KEY',
          // only needed if you build for the web
          proxyURL: 'https://your-proxy.com/',
          countries: ['de'], // optional, by default the list is empty (no restrictions)
          fetchPlaceDetailsWithCoordinates: true,  // if you require the coordinates from the place details
          debounceTime: 400, // defaults to 600 ms
          locationRestriction: LocationConfig.circle(
            circleCenter: const Coordinates(latitude: 52.5200, longitude: 13.4050),
            circleRadiusInKilometers: 1000,
          ), // either this or locationBias (or nothing)
          placeTypeRestriction: PlaceType.city, // if you want specific place types
        ),
        onPredictionWithCoordinatesReceived: (prediction) {
         // this method will return latlng with place detail
        print("Coordinates: (${prediction.lat},${prediction.lng})");
        // the place details are returned on the prediction as well
        print("Address: ${prediction.formattedAddress}");
        print("Components: ${prediction.addressComponents}");
        }, // this callback is called when fetchPlaceDetailsWithCoordinates is true
        onSuggestionClicked: (prediction) {
         controller.text = prediction.description;
          controller.selection = TextSelection.fromPosition(TextPosition(offset: prediction.description.length));
        }
    )

Integrate the Google AutoComplete TextField Widget in your Web code 🌐

In case you're building for the web, you need to pass the widget a proxy URL, otherwise you will receive a CORS-Error, as there are calls to the Google Maps API being made from the frontend. If you are not Google, your domain will probably be different, thus leading to the CORS-Error. If you are Google: how ya doin 😏? I'd love to do an internship.

Customization Option

You can customize the GooglePlacesAutoCompleteTextFormField as you would with any other TextFormField.

カテゴリー

依存関係

依存関係一覧 3 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。