Place Picker with OpenStreetMap

Hi everyone, to safe some money and to make it more customer friendly, i integrated a Place Picker with OpenStreeMap.  [Image] location_picker_flutter_map | Flutter Package (pub.dev)   Here is what u have to do: Create a custom Widget, with following Parameters and Name: [image.png]Then create 2 local states: [image.png][image.png] Use this code:

 import 'package:location_picker_flutter_map/location_picker_flutter_map.dart';

class PlacePicker extends StatefulWidget {
  const PlacePicker({
    Key? key,
    this.width,
    this.height,
    required this.action,
  }) : super(key: key);

  final double? width;
  final double? height;
  final Future Function() action;


  @override
  _PlacePickerState createState() => _PlacePickerState();
}

class _PlacePickerState extends State {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: FlutterLocationPicker(
                selectLocationButtonText: 'Select Location',
          initZoom: 11,
          minZoomLevel: 5,
          maxZoomLevel: 16,
          trackMyPosition: true,
          onPicked: (pickedData) {       
            setState(() {
              FFAppState().adress = pickedData.address;
              FFAppState().locationLatLng = LatLng(
                  pickedData.latLong.latitude, pickedData.latLong.longitude);
              widget.action.call();
            });
          }),
    );
  }
} 

Have fun. If u have question, im there for u!   Sometimes it doesnt work in the preview, but it always works in the app!

1
9 replies