참조를 사용하여 주소 검색 필드와 자동 완성 기능을 제공하는 플러터 패키지입니다. 사용자가 빠르게 주소를 입력하고 선택할 수 있게 하여 두 지점 간 방향 계산과 같은 위치 기반 서비스가 필요한 애플리케이션에 이상적입니다. 폼 및 지도에 원활하게 통합되어 수동 입력 오류를 줄이며 사용자 경험을 향상시킵니다. 위치 인식 앱에서 주소 입력을 위한 가벼운 솔루션을 찾는 개발자를 위해 설계되었습니다.
사용 사례
지도에서 위치 찾기
목적지 간 경로 계산 중
주소 제안을 통한 폼 입력 향상
배송 또는 라이드셰어링 앱 만들기
여행 앱에서 위치 정보 통합
주요 기능
주소 자동완성 입력
참조 기반 주소 검색
경량이며 통합이 쉬움
위치 기반 라우팅을 지원합니다
주소 선택을 위한 간단한 API
적합한 대상
내비게이션 앱을 개발하는 개발자
주소 입력 폼이 필요한 앱
위치 인식 모바일 애플리케이션
여행 및 물류 플랫폼
지도 통합 사용자 인터페이스
고려 사항
주소 검색을 위해 인터넷 연결이 필요합니다
참조 소스에 기반한 지원 지역에 제한됨
사용자 지정 스타일링을 위해 추가 구성이 필요할 수 있습니다
외부 지오코딩 서비스에 의존합니다
오프라인 주소 해석에 적합하지 않습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Address Search Field
Widget builders to create 'address search widgets' which helps to autocomplete an address using a reference. They can be used to get Directions beetwen two places with optional waypoints. These widgets are made to be showed by onTap in a TextField with the showDialog function.
It uses Dio, Google Maps for Flutter, Flutter Riverpod plugins. (This last plugin is to use extended objects that can be usable with GoogleMap Widget).
On Android you'll need to add the internet permission to your Android Manifest file (located under android/app/src/main). To do so add next lines as direct child of the manifest> tag:
final geoMethods = GeoMethods(
googleApiKey: 'GOOGLE_API_KEY',
language: 'en',
countryCode: 'us',
countryCodes: ['us', 'es', 'co'],
country: 'United States',
city: 'New York',
);
// It will search in unite states, espain and colombia. It just can filter up to 5 countries.
geoMethods.autocompletePlace(query: 'place streets or reference');
geoMethods.geoLocatePlace(
coords: Coords(0.10, 0.10,)
);
geoMethods.getPlaceGeometry(
reference: 'place streets',
placeId: 'ajFDN3662fNsa4hhs42FAjeb5n',
);
// It needs a specific region, it will search in unite states.
geoMethods.getDirections(
origin: Address(coords: Coords(0.10, 0.10)),
destination: Address(coords: Coords(0.10, 0.10))
);
AddressSearchBuilder
This widget can search addresses and permits you to work with them using an Address object.
AddressSearchDialog.custom provides you a widget builder with the parameters and methods to create your own AddressSearchDialog and work with the addresses information.
This widget is a simple way to get an address reference in a TextEditingController from coordinates when the AddressSearchDialog is not created into a RouteSearchBox.
Example:
Coords coords;
GeoMethods geoMethods;
TextEditingController controller;
Address initialAddress;
// using coordinates you can get an address reference to be predefined in the widget and save all the address data in a variable.AddressLocator(
coords: coords,
geoMethods: geoMethods,
controller: controller,
child: TextField(
controller: controller,
onTap: () => showDialog(
context: context,
builder: (BuildContext context) => AddressSearchDialog(
controller: controller,
geoMethods: geoMethods,
onDone: (Address address) => initialAddress = address;,
),
),
),
);
RouteSearchBox
This widget helps you to works using a provider from flutter_riverpod. It permits you to work with AddressSearchDialog to search an origin Address, destination Address and optionally waypoints in a List<Address>. This widget is used to get directions from the addresses gotten by an AddressSearchDialog. provider.findRoute() function permits to set an address as origin or destination from a coordinates parameter.
A completed example of how to use this widget could be found here.