Skip to content

Instantly share code, notes, and snippets.

@t-artikov
Created May 22, 2019 18:43
Show Gist options
  • Save t-artikov/25d0591828358ca3a67af47bdcabf5ac to your computer and use it in GitHub Desktop.
Save t-artikov/25d0591828358ca3a67af47bdcabf5ac to your computer and use it in GitHub Desktop.
flutter_map
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong/latlong.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: MyPage(),
);
}
}
class MyPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Map'),
),
body: FlutterMap(
options: MapOptions(
center: LatLng(54.857891, 83.111043),
zoom: 16.0,
maxZoom: 50.0,
minZoom: 2.0,
),
layers: [
TileLayerOptions(
urlTemplate: 'https://{s}.maps.2gis.com/tiles?x={x}&y={y}&z={z}',
subdomains: ['tile0', 'tile1', 'tile2', 'tile3'],
),
MarkerLayerOptions(
markers: [
Marker(
width: 32,
height: 32,
point: LatLng(54.859225, 83.109842),
builder: (ctx) => FlutterLogo(),
),
],
)
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment