mu-dawood/open_location_picker
OpenStreetMap에서 하나 이상의 위치를 선택하기 위한 FormField
- Stars
- 13
- Forks
- 9
- 최근 푸시(UTC)
- 2023. 11. 20.
- 프로젝트 상태
- 활성
언어DartC++CMakeHTMLRubySwiftCKotlinObjective-C
사용 중인 의존성
의존성 목록 9 개
- flutter
{"sdk":"flutter"} - flutter_map
^5.0.0 - freezed_annotation
^2.4.1 - http
^1.1.0 - latlong2
^0.9.0 - flutter_test개발 의존성
{"sdk":"flutter"} - flutter_lints개발 의존성
^2.0.1 - freezed개발 의존성
^2.0.3+1 - build_runner개발 의존성
^2.1.5
원본 README
아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
README 펼치기 / 접기
FormField to pick one or more locations from open streat map
Features
- Pick single location
- Pick multi locations
- display open street maps
- can work with bloc pattern
- respective to dark theme
Getting started
At first you have to put your configration settings
- handle how you get your current location
- you can use location or geolocator package or any thing you want
return OpenMapSettings(
onError: (context, error) {},
getCurrentLocation: _getCurrentLocationUsingLocationPackage,
reverseZoom: ReverseZoom.suburb,
getLocationStream: () => location.onLocationChanged.map((event) => LatLng(event.latitude!, event.longitude!)),
child: MaterialApp(
title: 'Flutter Demo',
locale: const Locale("ar"),
localizationsDelegates: const [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: const [
Locale('en', ''), // English, no country code
Locale('ar', ''), // Spanish, no country code
],
theme: ThemeData.light(),
darkTheme: ThemeData.dark(),
themeMode: ThemeMode.dark,
home: const MyHomePage(title: 'open_location_picker demo'),
),
);
Usage
- There are 3 ways to this pcakge
OpenMapPicker
OpenMapPicker(
decoration: const InputDecoration(hintText: "My location"),
onSaved: (FormattedLocation? newValue) {
/// save new value
},
),
MultiOpenMapPicker
MultiOpenMapPicker(
decoration: const InputDecoration(hintText: "My multi location"),
onSaved: (List<FormattedLocation> newValue) {
/// save new value
},
),
Custom
- first create your own bloc
class CustomBloc extends Cubit<OpenMapState> implements OpenMapBloc {
CustomBloc(OpenMapState initialState) : super(initialState);
}
- second use it
Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) {
return OpenStreetMaps(
options: OpenMapOptions(),
bloc: CustomBloc(const OpenMapState.selected(SelectedLocation.single(null))),
);
}));