open_location_picker
用於從 OpenStreetMap 選擇一個或多個位置的 FormField
- 星標
- 13
- 分支
- 9
- 最近推送(UTC)
- 2023年11月20日
- 專案狀態
- 未封存
原始 README
以下為英文專案原文快照,最新內容請造訪 GitHub。
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))),
);
}));
語言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
如何選擇適合專案的儲存庫?
先依使用情境篩選,再比較專案活躍情況,最後到原始儲存庫確認使用要求。
- 透過儲存庫名稱、作者或描述搜尋,再依技術分類縮小範圍。
- 綜合星標、分支與最近推送比較專案;星標反映社群關注,不保證品質。
- 使用前在 GitHub 確認 README、授權條款與 Issues。
來源與維護
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗