universe 0.0.2-nullsafety copy "universe: ^0.0.2-nullsafety" to clipboard
universe: ^0.0.2-nullsafety copied to clipboard

outdated

The easy & flexible way to use interactive maps in Flutter.

Universe #

The easy & flexible way to use interactive maps in Flutter.
Inspired by Leaflet.js.

universe

Getting Started #

Add dependency to your flutter project:

dependencies:
  universe: ^0.0.2-nullsafety
dependencies:
  universe:
    git: 
      url: git://github.com/salkuadrat/universe.git

Then run flutter pub get.

Add internet & location permissions to your AndroidManifest.xml.

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

Example Project #

There is a complete example project in the example folder.
Check it out to learn the many use cases of using Universe library.

You can also try a working example with universe.apk.

Usage #

Inspired by the simplicity of Leaflet.js, now you can add maps functionality in your flutter project with as simple as adding this lines of code:

import 'package:universe/universe.dart';
U.OpenStreetMap(
  center: [-6.175329, 106.827253],
  type: OpenStreetMapType.HOT,
  zoom: 15,
)

Universe comes with built-in support for 3 maps provider: OpenStreetMap, Google Maps and MapBox.

OpenStreetMap #

U.OpenStreetMap(
  center: [-6.175329, 106.827253],
  type: OpenStreetMapType.Mapnik,
  zoom: 15,
)

Complete OpenStreetMap example

Google Maps #

U.GoogleMap(
  center: [-6.175329, 106.827253],
  type: GoogleMapType.Street,
  zoom: 15,
)

Complete Google Maps example

MapBox #

U.MapBox(
  accessToken: yourAccessTokenHere,
  center: [-6.175329, 106.827253],
  type: MapBoxType.Street,
  zoom: 15,
)

You can get your own MapBox access token from here. Please always use your own access token in your projects.

Complete MapBox example

Markers #

You can add marker to your maps with as simple as the following code:

U.OpenStreetMap(
  center: [51.555158, -0.108343],
  type: OpenStreetMapType.HOT,
  zoom: 15,
  markers: U.MarkerLayer([51.556669, -0.108123]),
)

Complete marker examples:

Simple Marker
Marker with Data
Multiple Marker
Multiple Marker with Different Styles
Multiple Marker with Data
Marker Icon
Marker Image
Marker SVG
Marker Widget
Tap to Add Marker

Live Maps #

U.OpenStreetMap(
  center: [51.555158, -0.108343],
  type: OpenStreetMapType.HOT,
  zoom: 15,
  live: true,
)

Complete live maps examples:

Default Live Map
Simple Live Map
Live Map with Location Marker

Static Maps #

U.OpenStreetMap(
  center: [51.555158, -0.108343],
  type: OpenStreetMapType.Mapnik,
  zoom: 15,
  interactive: false,
)

Complete static maps examples:

Simple Static Map
Static Map with Marker
Static Map with Rotation

Other Examples #

Complex Map

Map with Initial Rotation
Map with Disabled Rotation
Map with MaxBounds
Map with FitBounds

MapController
MapController: Move Map
MapController: Zoom Map
MapController: Rotate Map
MapController: Find Location

Circle
Custom Circle
Multiple Circles
Multiple Circles with Different Styles
Circle with Data
Multiple Circles with Data

Polyline
Custom Polyline
Multiple Polylines
Multiple Polylines with Different Styles

Polygon
Multiple Polygons
Multiple Polygons with Diffrent Styles
Polygon with Data
Multiple Polygons with Data

Rectangle
Custom Rectangle
Multiple Rectangles
Multiple Rectangles with Different Styles
Rectangle with Data
Multiple Rectangles with Data

Image Overlay
Widget Overlay
Video Overlay

TileProvider: NetworkTileProvider
TileProvider: NetworkRetryTileProvider
TileProvider: CachedNetworkTileProvider
TileProvider: Offline AssetTileProvider

Map with Custom Compass
Map with Custom Locator
Map with Custom Scale Indicator
Map with Custom Location Indicator

Map Geolocator: Center by Address
Map Geolocator: Find LatLng by Address
Map Geolocator: Move by Address