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

apple maps flutter

a flutter plugin that provides an apple maps widget.

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.

apple maps plugin was based on the google_maps_flutter plugin. instead of reinventing the wheel it also uses the flutter implementation of the google_maps_flutter plugin. this was also done to simplify the process of combining the google_maps_flutter plugin with apple_maps_flutter to create a cross platform implementation for android/ios called flutter_platform_maps.

screenshots

example 1 example 2
example_img01 apple-maps

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

there is no android implementation, but there will be a package to combine apple_maps_flutter and the google_maps_flutter plugin to have the typical map implementations for android/ios (coming soon).

sample usage

class applemapsexample extends statelesswidget {
  applemapcontroller mapcontroller;

  void _onmapcreated(applemapcontroller controller) {
    mapcontroller = controller;
  }

  @override
  widget build(buildcontext context) {
    return column(
      mainaxisalignment: mainaxisalignment.spaceevenly,
      crossaxisalignment: crossaxisalignment.stretch,
      children: <widget>[
        expanded(
          child: container(
            child: applemap(
              onmapcreated: _onmapcreated,
              initialcameraposition: const cameraposition(
                target: latlng(0.0, 0.0),
              ),
            ),
          ),
        ),
        row(
          mainaxisalignment: mainaxisalignment.spaceevenly,
          children: <widget>[
            column(
              children: <widget>[
                flatbutton(
                  onpressed: () {
                    mapcontroller.movecamera(
                      cameraupdate.newcameraposition(
                        const cameraposition(
                          heading: 270.0,
                          target: latlng(51.5160895, -0.1294527),
                          pitch: 30.0,
                          zoom: 17,
                        ),
                      ),
                    );
                  },
                  child: const text('newcameraposition'),
                ),
                flatbutton(
                  onpressed: () {
                    mapcontroller.movecamera(
                      cameraupdate.newlatlngzoom(
                        const latlng(37.4231613, -122.087159),
                        11.0,
                      ),
                    );
                  },
                  child: const text('newlatlngzoom'),
                ),
              ],
            ),
            column(
              children: <widget>[
                flatbutton(
                  onpressed: () {
                    mapcontroller.movecamera(
                      cameraupdate.zoomin(),
                    );
                  },
                  child: const text('zoomin'),
                ),
                flatbutton(
                  onpressed: () {
                    mapcontroller.movecamera(
                      cameraupdate.zoomout(),
                    );
                  },
                  child: const text('zoomout'),
                ),
                flatbutton(
                  onpressed: () {
                    mapcontroller.movecamera(
                      cameraupdate.zoomto(16.0),
                    );
                  },
                  child: const text('zoomto'),
                ),
              ],
            ),
          ],
        )
      ],
    );
  }
}

todo’s:

  • [x] add zoomlevelbounds
  • [x] add zoomby functionality
  • [x] add getter for the visible map region
  • [ ] add ability to set latlngbounds to map
  • [ ] add ability to add padding to the map
  • [ ] add scrollby functionality
  • [ ] add ability to place a polyline
  • [ ] add ability to place a polygon
  • [ ] add ability to place a circle
  • [ ] . . .

suggestions and pr’s to make this plugin better are always welcome.


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.