FormField to pick one or more locations from open streat map

Overview

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))),
    );
  }));
    
Comments
  • Bounding box moves around map when zooming on phone

    Bounding box moves around map when zooming on phone

    When the widget was used to select a city which has a bounding box on the map then when zooming, the bounding box leaves the place and flies around the map.

    opened by thunderbug1 4
  • Map is blank in dark mode

    Map is blank in dark mode

    Despite map tiles are loaded correctly, they're not getting displayed in the view and it's not flutter_map's problem: https://github.com/fleaflet/flutter_map/issues/1221

    opened by xmine64 3
  • Getting address as coordinates

    Getting address as coordinates

    This not an issue am a newbie to programming , after picking an address how do i get the coordinates of that address latitude and longitude..and thanks for creating such an awesome package

    opened by Isaac37 3
  • Search does sometimes not really work

    Search does sometimes not really work

    The search often seems to not find places. Tested with version 0.0.9 Here is a video of what I mean: https://user-images.githubusercontent.com/1395321/165893154-e8eeebbb-ea5e-438d-b97d-68f0ac3b1eb8.mp4

    opened by thunderbug1 2
  • FormattedLocation.fromLatLng wrong argument order in geojson

    FormattedLocation.fromLatLng wrong argument order in geojson

    The arguments in FormattedLocation.fromLatLng are in the wrong order when no geojson is provided.

    https://github.com/mo-ah-dawood/open_location_picker/blob/56f90484c3b2c0337c8d04db87d57e922f531f20/lib/src/location_model.dart#L158

    Providing the geojson when calling the method works around this issue:

    FormattedLocation.fromLatLng(
         lat: value.latitude,
         lon: value.longitude,
         geojson: GeoGeometry.point(
              LatLng(value.latitude, value.longitude),
              Color((Random().nextDouble() * 0xFFFFFF).toInt()).withOpacity(1.0)),
    );
    
    opened by franzmueller 1
  • initial location from [latitude, longitude]

    initial location from [latitude, longitude]

    The OpenMapPicker class takes as its' initialValue an instance of a FormattedLocation which does not allow to initialize the location by a [latitude, longitude] pair. Is there a way to create an instance of FormattedLocation for initialization?

    opened by thunderbug1 1
  • Customization

    Customization

    Hi. Great plugin. It possible more map picker customization? For example icons, fonts, hint text, navigation bar,hide back button, bottom bar. This will be useful. Thanks.

    opened by alejandrogiubel 1
  • adding support for Multipolygon

    adding support for Multipolygon

    adding support for multipolygon type. Previously it was not possible to search for cities like "malaga" for example and to get the correct result as it has the multipolygon type.

    The code isn't the prettiest but I couldn't get it working otherwise.

    Possibly there is still an issue with displaying the multipolygon, haven't really tested that yet. At least parsing works with this and the results are shown properly.

    opened by thunderbug1 0
  • Workaround for location parsing bug

    Workaround for location parsing bug

    related to https://github.com/mo-ah-dawood/open_location_picker/issues/10

    Sometimes the API returns json objects which crash the FormattedLocation.from method. This leads to an exception and no results being shown. This workaround does NOT yet resolve the bug, but makes it at least a lot less severe since all other search results will still be shown.

    opened by thunderbug1 0
Releases(0.1.3)
Owner
Mohamed Dawood
Full stack developer
Mohamed Dawood
Polymaker is an application that can create polygon locations dynamically in mobile apps and save the data into SQFlite to be permanent.

Polymaker Polymaker is an application that can create polygon locations dynamically in mobile apps and save the data into SQFlite to be permanent. Ins

Yusril Rapsanjani 15 Apr 17, 2022
World-time - A simple application that tells time from different locations by using worldtime api

world_time A new Flutter project. Getting Started This project is a starting poi

Ryan Egbejule-jalla 1 Feb 6, 2022
Place picker for Flutter using open street, Here maps and google map

Flutter Place Picker A Flutter plugin which provides 'Picking Place' using Open Street, Here Maps and Google Maps widget. Much thanks to Terry Kwon Th

Samuel Annin Yeboah 15 Oct 27, 2022
Google one tap sign in - Flutter Google One Tap Sign In (Android)

Google One Tap Sign In Google One Tap Sign In (Android) A Flutter Plugin for Goo

null 6 Nov 23, 2022
One Dungeon is a ​1-Bit-style platformer game that consists of one level

One Dungeon is a ​1-Bit-style platformer game that consists of one level. It developed during the Midyear 2022 Flame Game Jam.

Bulent Baris Kilic 6 Sep 21, 2022
Call Kit is a prebuilt feature-rich call component, which enables you to build one-on-one and group voice/video calls into your app with only a few lines of code.

Call Kit (ZegoUIKitPrebuiltCall) Call Kit is a prebuilt feature-rich call component, which enables you to build one-on-one and group voice/video calls

ZEGOCLOUD 9 Dec 26, 2022
An app to pick, upload and display images from camera and gallery with size and extension constraints.

image_uploader A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started i

Ehmad Saeed⚡ 4 Mar 7, 2022
Upload Files To Firebase Storage with Flutter. Pick images, videos, or other files from your device and upload them to Firebase.

Flutter Tutorial - Upload Files To Firebase Storage Upload Files To Firebase Storage with Flutter. Pick images, videos, or other files from your devic

Johannes Milke 30 Dec 28, 2022
A simple, private tool to help pick a baby name.

Nom de Bébé A simple, private tool to help pick a baby name. https://nomdebebe.app/ Motivation I need to choose a name. There's lots of tools and apps

Kenton Hamaluik 257 Nov 23, 2022
In this repo you will see how to pick images from the image library and also, see how to store the selected images on Firebase.

flutterimageapp Flutter Tutorial - Upload Images using Firebase Storage. Flutter Tutorial - Upload Images using Firebase Storage Video series can be w

Whatsupcoders 60 Nov 4, 2022
Imagepickerweb - A picker with which you can pick images and videos from your Flutter web app

ImagePickerWeb This Web-Plugin allows Flutter Web to pick images (as File, Widget or Uint8List) and videos (as File or Uint8List). Many thanks goes to

Rebar Ahmad 40 Sep 26, 2022
Flutter package to show and pick country code

country list pick Flutter plugin to pick country with output name, code, dialcode and flag of country Usage To use this plugin, add country_list_pick

fiaz 69 Nov 13, 2022
A Flutter widget to show an icon collection to pick. This widget extend TextField and has a similar behavior as TextFormField

icon_picker A Flutter widget to show an icon collection to pick. This widget extend TextField and has a similar behavior as TextFormField Usage In the

m3uzz Soluções em TI 11 Sep 27, 2022
Weather app using Bloc architecture pattern & generic HTTP client with interface implementation and much more for more detail read Readme

weather Weather application for current weather, hourly forecast for 48 hours, Daily forecast for 7 days and national weather alerts. How to Run Insta

Jibran Ahmed SiddiQui 9 Oct 29, 2022
More than 130+ pages in this beautiful app and more than 45 developers has contributed to it.

flutter-ui-nice ❤️ Star ❤️ the repo to support the project or ?? Follow Me.Thanks! Facebook Page Twitter Medium QQ Group Flutter Open NieBin Flutter O

Flutter开源社区 3.4k Jan 3, 2023
An extended version of Flutter Colors with more swatches and more flexibility to generate your own custom swatch.

Colours An extended version of Flutter Colors with more swatches and more flexibility to generate your own custom swatch. Getting Started In your flut

Salman S 4 Nov 23, 2021
More than 130+ pages in this beautiful app and more than 45 developers has contributed to it.

flutter-ui-nice ❤️ Star ❤️ the repo to support the project or ?? Follow Me.Thanks! Facebook Page Twitter Medium QQ Group Flutter Open NieBin Flutter O

Flutter开源社区 3.4k Jan 5, 2023
An easy-to-use flutter http network requests handler with more functionality than http but more simpler than dio.

network_requests An easy-to-use flutter http network requests handler with more functionality than http but more simpler than dio. Platform Supported

Coder_Manuel 3 Dec 15, 2022
IMP - an innovative open source application that will help people memorize text more easily

InnoMemorizerApp IMP - an innovative open source application that will help people memorize text more easily Home page Upload page Home page provides

null 3 Jul 13, 2022