map 1.0.1 copy "map: ^1.0.1" to clipboard
map: ^1.0.1 copied to clipboard

outdated

Map widget for Flutter written in 100% Dart. Supports Android, iOS, Web and Desktop.

example/lib/main.dart

import 'package:example/pages/custom_tile_page.dart';
import 'package:example/pages/day_night_page.dart';
import 'package:example/pages/interactive_page.dart';
import 'package:example/pages/markers_page.dart';
import 'package:example/pages/metro_lines_page.dart';
import 'package:example/pages/raster_map_page.dart';
import 'package:example/pages/vector_map_page.dart';
import 'package:flutter/material.dart';

void main() => runApp(MapApp());

class MapApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Map Examples',
      theme: ThemeData(
        primarySwatch: Colors.purple,
      ),
      home: HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Map Examples'),
      ),
      body: ListView(
        children: [
          ListTile(
            title: Text('Raster Map'),
            subtitle: Text('Raster tiles from Google, OSM and etc.'),
            trailing: Icon(Icons.chevron_right_sharp),
            onTap: () => _push(RasterMapPage()),
          ),
          ListTile(
            title: Text('Vector Map'),
            subtitle: Text('OSM light-themed vector maps.'),
            trailing: Icon(Icons.chevron_right_sharp),
            onTap: () => _push(VectorMapPage()),
            enabled: false,
          ),
          ListTile(
            title: Text('Markers'),
            subtitle:
                Text('Drop multiple fixed and centered markers on the map.'),
            trailing: Icon(Icons.chevron_right_sharp),
            onTap: () => _push(MarkersPage()),
          ),
          ListTile(
            title: Text('Interactive'),
            subtitle: Text('Say where on the earth user has clicked.'),
            trailing: Icon(Icons.chevron_right_sharp),
            onTap: () => _push(InteractiveMapPage()),
          ),
          ListTile(
            title: Text('Custom Tiles'),
            subtitle: Text('Use any Widget as map tiles.'),
            trailing: Icon(Icons.chevron_right_sharp),
            onTap: () => _push(CustomTilePage()),
          ),
          ListTile(
            title: Text('Metro Lines (Work in Progress)'),
            subtitle: Text('Draw polyline overlays (Tehran Metro).'),
            trailing: Icon(Icons.chevron_right_sharp),
            onTap: () => _push(MetroLinesPage()),
          ),
          ListTile(
            title: Text('Custom Projection'),
            subtitle: Text('How we convert LatLng to XY. Useful for games.'),
            trailing: Icon(Icons.chevron_right_sharp),
            onTap: _showNotImplemented,
            enabled: false,
          ),
          ListTile(
            title: Text('Day & Night Map'),
            subtitle: Text('Shows a map for day and night.'),
            trailing: Icon(Icons.chevron_right_sharp),
            onTap: () => _push(DayNightPage()),
          ),
        ],
      ),
    );
  }

  void _showNotImplemented() {
    final snackBar =
        SnackBar(content: Text('This demo is not implemented yet.'));
    ScaffoldMessenger.of(context).showSnackBar(snackBar);
  }

  void _push(Widget page) {
    Navigator.of(context).push(
      MaterialPageRoute(
        builder: (context) => page,
      ),
    );
  }
}
299
likes
0
pub points
94%
popularity

Publisher

verified publisherpwa.ir

Map widget for Flutter written in 100% Dart. Supports Android, iOS, Web and Desktop.

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

fixnum, flutter, latlng, protobuf

More

Packages that depend on map