패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.0.6

search_map_location

search_map_location은 이름으로 지리적 위치를 검색하는 데 사용되는 텍스트 검색 위젯입니다. 장소 검색을 처리하기 위한 여러 콜백 및 사용자 정의 옵션이 있습니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
99
좋아요
35
Pub 점수
130

패키지 설치

flutter pub add search_map_location

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

search_map_location은 이름으로 지리적 위치를 검색할 수 있는 텍스트 검색 위젯을 제공하는 플러터 패키지입니다. 사용자 정의 가능한 UI를 지원하며, 장소 검색 결과를 관리하기 위한 다양한 콜백 옵션을 제공하여 앱에 위치 검색 기능을 통합하기에 적합합니다. 이 패키지는 안드로이드, iOS, 웹, 맥OS, 윈도우, 리눅스에서 작동하여 모든 플랫폼에서 일관된 사용자 경험을 제공합니다.

사용 사례

  • 여행 앱에 위치 검색 통합
  • 배송 또는 물류 앱에서 장소 찾기
  • 양식 내 주소 입력 향상
  • 지도 기반 위치 선택 활성화
  • 이벤트 기획 앱에서 위치 정보 지원

주요 기능

  • 텍스트 기반 위치 검색
  • 사용자 정의 가능한 검색 위젯
  • 여러 콜백 핸들러
  • 크로스 플랫폼 호환성
  • 실시간 장소 제안
  • 지도와의 간편한 통합

적합한 대상

  • 위치 인식 앱을 개발하는 개발자
  • 주소 또는 장소 입력이 필요한 앱
  • 지도 상호작용이 필요한 프로젝트
  • 크로스 플랫폼 모바일 및 웹 애플리케이션
  • 사용자 경험 중심의 폼 디자인

고려 사항

  • 지오코딩을 위해 인터넷 연결이 필요합니다
  • 완전한 기능을 사용하려면 API 키가 필요할 수 있습니다
  • 성능은 네트워크 속도에 따라 달라집니다
  • 이름 기반 검색에 한정
  • 사용자 정의 스타일링을 위해서는 추가 코드가 필요할 수 있습니다
  • 기본 지도 서비스에 의존

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

search_map_location

search_map_location is a text search widget used to search geo location by name.It has severel call back and customization option to handle the place search.

Getting Started

To install, add it to your pubspec.yaml file:

dependencies:
    search_map_location: 0.0.6

After that, make sure you have the following APIs activated in your Google Cloud Platform:

  • Places

You can now import it to your file and use it on your app.

import 'package:search_map_location/search_map_location.dart';
Widget build(BuildContext context) {
  return Scaffold(
    body: Center(
      child: SearchLocation(
        apiKey: // YOUR GOOGLE MAPS API KEY
        onSelected: (Place place){
        print(place.description);

         },
      )
    )
  );
}

The constructor has 8 attributes related to the API:

  • String apiKey is the only required attribute. It is the Google Maps API Key your application is using
  • (Place) void onSelected is a callback function called when the user selects one of the autocomplete options.
  • (Place) void onSearch is a callback function called when the user clicks on the search icon.
  • String language is the Language used for the autocompletion. Default is 'en' (english). Check the full list of supported languages for the Google Maps API
  • String country you can allow the search work only for a specific country.While using country don't use location and radius .Use ISO(Use alpha 2) code for country name see iso code of countries
  • LatLng location is the point around which you wish to retrieve place information. If this value is provided, radius must be provided aswell.
  • int radius is the distance (in meters) within which to return place results. Note that setting a radius biases results to the indicated area, but may not fully restrict results to the specified area. If this value is provided, location must be provided aswell. See Location Biasing and Location Restrict in the Google Maps API documentation.
  • bool restrictBounds will return only those places that are strictly within the region defined by location and radius.
  • PlaceType placeType will allow you to filter Places by its type. For more information on available types, check supported types for Autocompletion. On default, no filters are passed to the request, which means all Place types will be shown on autocompletion.
The Place class

This class will be returned on the onSelected and onSearch methods. It allows us to get more information about the user selected place.

Initially, it provides you with only basic information:

  • description contains the human-readable name for the returned result. For establishment results, this is usually the business name.
  • placeIdA textual identifier that uniquely identifies a place. For more information about place IDs, see the Place IDs overview.
  • types contains an array of types that apply to this place. The array can contain multiple values. Learn more about Place types.
  • fullJSON has the full JSON response received from the Places API. Can be used to extract extra information. More info on the Places Autocomplete API documentation

However, you can get more information like the coordinates and the bounds of the place by calling

await place.geolocation;

Example

Here's an example of the widget using country :

return SearchLocation(
    apiKey: YOUR_API_KEY,
    // The language of the autocompletion
    language: 'en',
    //Search only work for this specific country
    country: 'BD',
    onSelected: (Place place) async {
        final geolocation = await place.geolocation;

        // Will animate the GoogleMap camera, taking us to the selected position with an appropriate zoom
        final GoogleMapController controller = await _mapController.future;
        controller.animateCamera(CameraUpdate.newLatLng(geolocation.coordinates));
        controller.animateCamera(CameraUpdate.newLatLngBounds(geolocation.bounds, 0));
    },
);

Here's an example of the widget using location and radius :

return SearchLocation(
    apiKey: YOUR_API_KEY,
    // The language of the autocompletion
    language: 'en',
    // location is the center of a place and the radius provided here are between this radius of this place search result
    //will be provided,you can set this LatLng dynamically by getting user lat and long in double value
    location: LatLng(latitude: 9.072264, longitude: 7.491302),
    radius: 1100,
    onSelected: (Place place) async {
        final geolocation = await place.geolocation;

        // Will animate the GoogleMap camera, taking us to the selected position with an appropriate zoom
        final GoogleMapController controller = await _mapController.future;
        controller.animateCamera(CameraUpdate.newLatLng(geolocation.coordinates));
        controller.animateCamera(CameraUpdate.newLatLngBounds(geolocation.bounds, 0));
    },
);

카테고리

의존성

의존성 목록 1 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.