Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

platform_maps_flutter

a flutter package that provides a native map to both android and ios devices.

the plugin relies on flutter’s mechanism for embedding android and ios views. as that mechanism is currently in a developers preview, this plugin should also be considered a developers preview.

this package combines the google_maps_flutter plugin with apple_maps_flutter to create a cross platform implementation of native maps for android/ios.

screenshots

android ios
example 1 example 2
example 1 example 2

current functionality

  • camera movement including bearing, heading, tilt (also animated)
  • markers, including custom marker images and info windows
  • different map types
  • map manipulation, enable/disable gestures, show current location, show compass …

ios

to use this plugin on ios you need to opt-in for the embedded views preview by adding a boolean property to the app’s info.plist file, with the key io.flutter.embedded_views_preview and the value yes. you will also have to add the key privacy - location when in use usage description with the value of your usage description.

android

specify your api key in the application manifest android/app/src/main/androidmanifest.xml:

<manifest ...
  <application ...
    <meta-data android:name="com.google.android.geo.api_key"
               android:value="your key here"/>

sample usage

class homepage extends statelesswidget {
  @override
  widget build(buildcontext context) {
    return scaffold(
      body: platformmap(
        initialcameraposition: cameraposition(
          target: const latlng(47.6, 8.8796),
          zoom: 16.0,
        ),
        markers: set<marker>.of(
          [
            marker(
              markerid: markerid('marker_1'),
              position: latlng(47.6, 8.8796),
              consumetapevents: true,
              infowindow: infowindow(
                title: 'platformmarker',
                snippet: "hi i'm a platform marker",
              ),
              ontap: () {
                print("marker tapped");
              },
            ),
          ],
        ),
        mylocationenabled: true,
        mylocationbuttonenabled: true,
        ontap: (location) => print('ontap: $location'),
        oncameramove: (cameraupdate) => print('oncameramove: $cameraupdate'),
        compassenabled: true,
        onmapcreated: (controller) {
          future.delayed(duration(seconds: 2)).then(
            (_) {
              controller.animatecamera(
                cameraupdate.newcameraposition(
                  const cameraposition(
                    bearing: 270.0,
                    target: latlng(51.5160895, -0.1294527),
                    tilt: 30.0,
                    zoom: 18,
                  ),
                ),
              );
            },
          );
        },
      ),
    );
  }
}

suggestions and pr’s to make this plugin better are always welcome. please notice that the features provided by this package depend on the apple_maps_flutter plugin, which will improve in the future.


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.