Widgets

The SDK provides two widgets for generating static maps: StaticMapImage and StaticMapBuilder.

Make sure the SDK has been initialized before using one of the widgets below.

StaticMapImage

To generate a static map, use the StaticMapImage widget. You can customize the map by passing in various parameters, such as the center, zoom level, and markers.

StaticMapImage(
	options: StaticMapOptions(
		center: StaticMapLatLng(34.04566, -118.25198),
		zoom: 7,
		width: 300,
		height: 300,
		scale: 2,
	)
);

The code above will generate the following static map:

StaticMapBuilder

The StaticMapBuilder widget generates an url you can use in a child widget of your choice. This is useful if you want to use a different widget than the built-in StaticMap widget.

StaticMapBuilder(
	options: StaticMapOptions(
		center: StaticMapLatLng(37.762828, -122.446528),
		zoom: 10,
		width: 256,
		height: 256,
		scale: 2,
	),
	builder: (BuildContext context, String url) {
      return Image.network(url);
  },
)

The static map builder will provide the following url parameter:

https://api.journey.tech/v1/static-map?key=your_api_key_here&width=256&height=256&lat=37.762828&lng=-122.446528&zoom=10&scale=2