flutter_map_marker_popup 0.1.4

  • Readme
  • Changelog
  • Example
  • Installing
  • 95

flutter_map_marker_popup #

Makes adding marker popups to flutter_map easy.

If you have any suggestions/problems please don't hesitate to open an issue.

Getting Started #

See the example/ directory for a demo app which resulting in the following:

Example

[0.0.1] - 17/04/20 #

  • Initial release.

[0.0.2] - 17/04/20 #

  • Allow constraining of the uuid type.

[0.0.3] - 17/04/20 #

  • More detailed description
  • Improve README.md

[0.1.0] - 20/04/20 #

  • Complete rewrite. Now PopupMarkerLayer is a replacement for MarkerLayer and is not compatible with the clustering plugin. Popups for the clustering plugin will be proposed via PR on the marker clustering project.

[0.1.1] - 20/04/20 #

  • Add example gif

[0.1.2] - 22/04/20 #

  • Possible to hide any of a list of markers. If the popup is showing for any of the provided markers it will be hidden. Otherwise nothing happens.
  • Added extension_api.dart to be imported by plugins extending this one. This is initially for flutter_map_marker_cluster.

[0.1.3] - 22/04/20 #

  • Move PopupBuilder to its own file and export it in extension_api.dart so that it can be used without having to import the layer options.

[0.1.4] - 23/04/20 #

  • Fix bug where the popup state did not change when selected another marker when the popup was already showing.
  • Add showPopupFor(Marker) method to PopupController if the user wants plain show behaviour instead of toggle behaviour.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map_marker_popup_example/example_popup.dart';
import 'package:latlong/latlong.dart';
import 'package:flutter_map_marker_popup/flutter_map_marker_popup.dart';

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

class MyApp extends StatelessWidget {
  final GlobalKey<_MapPageState> _mapPageStateKey = GlobalKey<_MapPageState>();

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'Marker Popup Demo',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: MapPage(_mapPageStateKey),
        builder: (context, navigator) {
          return Scaffold(
            appBar: AppBar(
              title: Text("Marker Popup Demo"),
            ),
            body: navigator,
            floatingActionButton: FloatingActionButton(
              onPressed: () {
                _mapPageStateKey.currentState.showPopupForFirstMarker();
              },
              child: Icon(Icons.mode_comment),
              backgroundColor: Colors.green,
            ),
          );
        });
  }
}

class MapPage extends StatefulWidget {
  MapPage(GlobalKey<_MapPageState> key) : super(key: key);
  @override
  _MapPageState createState() => _MapPageState();
}

class _MapPageState extends State<MapPage> {
  static final List<LatLng> _points = [
    LatLng(44.421, 10.404),
    LatLng(45.683, 10.839),
    LatLng(45.246, 5.783),
  ];

  static const _markerSize = 40.0;
  List<Marker> _markers;

  // Used to trigger showing/hiding of popups.
  final PopupController _popupLayerController = PopupController();

  @override
  void initState() {
    super.initState();

    _markers = _points
        .map(
          (LatLng point) => Marker(
            point: point,
            width: _markerSize,
            height: _markerSize,
            builder: (_) => Icon(Icons.location_on, size: _markerSize),
            anchorPos: AnchorPos.align(AnchorAlign.top),
          ),
        )
        .toList();
  }

  @override
  Widget build(BuildContext context) {
    return FlutterMap(
      options: new MapOptions(
        zoom: 5.0,
        center: _points.first,
        plugins: [PopupMarkerPlugin()],
        onTap: (_) => _popupLayerController
            .hidePopup(), // Hide popup when the map is tapped.
      ),
      layers: [
        TileLayerOptions(
          urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
          subdomains: ['a', 'b', 'c'],
        ),
        PopupMarkerLayerOptions(
          markers: _markers,
          popupSnap: PopupSnap.top,
          popupController: _popupLayerController,
          popupBuilder: (BuildContext _, Marker marker) => ExamplePopup(marker),
        ),
      ],
    );
  }

  void showPopupForFirstMarker() {
    _popupLayerController.togglePopup(_markers.first);
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_map_marker_popup: ^0.1.4

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_map_marker_popup/flutter_map_marker_popup.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
90
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
95
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform android

Because:

  • package:flutter_map_marker_popup/flutter_map_marker_popup.dart that imports:
  • package:flutter_map_marker_popup/src/popup_marker_layer_plugin.dart that imports:
  • package:flutter_map_marker_popup/src/popup_marker_layer_options.dart that imports:
  • package:flutter_map_marker_popup/src/popup_controller.dart that imports:
  • package:flutter_map_marker_popup/src/popup_event.dart that imports:
  • package:flutter_map/plugin_api.dart that imports:
  • package:flutter_map/src/map/map.dart that imports:
  • package:flutter_map/flutter_map.dart that imports:
  • package:flutter_map/src/layer/tile_provider/tile_provider.dart that imports:
  • package:flutter_map/src/layer/tile_provider/mbtiles_image_provider.dart that imports:
  • package:path_provider/path_provider.dart that imports:
  • package:path_provider_linux/path_provider_linux.dart that declares support for platforms: linux

Package does not support Flutter platform ios

Because:

  • package:flutter_map_marker_popup/flutter_map_marker_popup.dart that imports:
  • package:flutter_map_marker_popup/src/popup_marker_layer_plugin.dart that imports:
  • package:flutter_map_marker_popup/src/popup_marker_layer_options.dart that imports:
  • package:flutter_map_marker_popup/src/popup_controller.dart that imports:
  • package:flutter_map_marker_popup/src/popup_event.dart that imports:
  • package:flutter_map/plugin_api.dart that imports:
  • package:flutter_map/src/map/map.dart that imports:
  • package:flutter_map/flutter_map.dart that imports:
  • package:flutter_map/src/layer/tile_provider/tile_provider.dart that imports:
  • package:flutter_map/src/layer/tile_provider/mbtiles_image_provider.dart that imports:
  • package:path_provider/path_provider.dart that imports:
  • package:path_provider_linux/path_provider_linux.dart that declares support for platforms: linux

Package does not support Flutter platform linux

Because:

  • package:flutter_map_marker_popup/flutter_map_marker_popup.dart that imports:
  • package:flutter_map_marker_popup/src/popup_marker_layer_plugin.dart that imports:
  • package:flutter_map_marker_popup/src/popup_marker_layer_options.dart that imports:
  • package:flutter_map_marker_popup/src/popup_controller.dart that imports:
  • package:flutter_map_marker_popup/src/popup_event.dart that imports:
  • package:flutter_map/plugin_api.dart that imports:
  • package:flutter_map/src/map/map.dart that imports:
  • package:flutter_map/flutter_map.dart that imports:
  • package:flutter_map/src/layer/tile_provider/tile_provider.dart that imports:
  • package:flutter_map/src/layer/tile_provider/mbtiles_image_provider.dart that imports:
  • package:sqflite/sqflite.dart that declares support for platforms: android, ios, macos

Package does not support Flutter platform macos

Because:

  • package:flutter_map_marker_popup/flutter_map_marker_popup.dart that imports:
  • package:flutter_map_marker_popup/src/popup_marker_layer_plugin.dart that imports:
  • package:flutter_map_marker_popup/src/popup_marker_layer_options.dart that imports:
  • package:flutter_map_marker_popup/src/popup_controller.dart that imports:
  • package:flutter_map_marker_popup/src/popup_event.dart that imports:
  • package:flutter_map/plugin_api.dart that imports:
  • package:flutter_map/src/map/map.dart that imports:
  • package:flutter_map/flutter_map.dart that imports:
  • package:flutter_map/src/layer/tile_provider/tile_provider.dart that imports:
  • package:flutter_map/src/layer/tile_provider/mbtiles_image_provider.dart that imports:
  • package:path_provider/path_provider.dart that imports:
  • package:path_provider_linux/path_provider_linux.dart that declares support for platforms: linux

Package does not support Flutter platform web

Because:

  • package:flutter_map_marker_popup/flutter_map_marker_popup.dart that imports:
  • package:flutter_map_marker_popup/src/popup_marker_layer_plugin.dart that imports:
  • package:flutter_map_marker_popup/src/popup_marker_layer_options.dart that imports:
  • package:flutter_map_marker_popup/src/popup_controller.dart that imports:
  • package:flutter_map_marker_popup/src/popup_event.dart that imports:
  • package:flutter_map/plugin_api.dart that imports:
  • package:flutter_map/src/map/map.dart that imports:
  • package:flutter_map/flutter_map.dart that imports:
  • package:flutter_map/src/layer/tile_provider/tile_provider.dart that imports:
  • package:flutter_map/src/layer/tile_provider/mbtiles_image_provider.dart that imports:
  • package:sqflite/sqflite.dart that declares support for platforms: android, ios, macos

Package does not support Flutter platform windows

Because:

  • package:flutter_map_marker_popup/flutter_map_marker_popup.dart that imports:
  • package:flutter_map_marker_popup/src/popup_marker_layer_plugin.dart that imports:
  • package:flutter_map_marker_popup/src/popup_marker_layer_options.dart that imports:
  • package:flutter_map_marker_popup/src/popup_controller.dart that imports:
  • package:flutter_map_marker_popup/src/popup_event.dart that imports:
  • package:flutter_map/plugin_api.dart that imports:
  • package:flutter_map/src/map/map.dart that imports:
  • package:flutter_map/flutter_map.dart that imports:
  • package:flutter_map/src/layer/tile_provider/tile_provider.dart that imports:
  • package:flutter_map/src/layer/tile_provider/mbtiles_image_provider.dart that imports:
  • package:sqflite/sqflite.dart that declares support for platforms: android, ios, macos

Package not compatible with SDK dart

Because:

  • flutter_map_marker_popup that is a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
flutter_map >=0.8.0 <1.0.0 0.10.1
latlong >=0.6.0 <1.0.0 0.6.1
Transitive dependencies
ansicolor 1.0.2
async 2.4.2
cached_network_image 2.2.0+1 2.3.0-rc
charcode 1.1.3
clock 1.0.1
collection 1.14.12 1.14.13
console_log_handler 1.1.6
convert 2.1.1
crypto 2.1.5
file 5.2.1
flutter_cache_manager 1.4.1
flutter_image 3.0.0
http 0.12.1
http_parser 3.1.4
intl 0.16.1
lists 0.1.6
logging 0.11.4
matcher 0.12.8
meta 1.1.8 1.2.2
mgrs_dart 1.0.1
path 1.7.0
path_provider 1.6.11
path_provider_linux 0.0.1+2
path_provider_macos 0.0.4+3
path_provider_platform_interface 1.0.2
pedantic 1.9.0 1.9.2
platform 2.2.1
plugin_platform_interface 1.0.2
positioned_tap_detector 1.0.3
process 3.0.13
proj4dart 1.0.5
quiver 2.1.3
rxdart 0.24.1
sky_engine 0.0.99
source_span 1.7.0
sqflite 1.3.1
sqflite_common 1.0.2+1
stack_trace 1.9.5
string_scanner 1.0.5
synchronized 2.2.0+1
term_glyph 1.1.0
transparent_image 1.0.0
tuple 1.0.3
typed_data 1.1.6 1.2.0
unicode 0.2.4
uuid 2.2.0
validate 1.7.0
vector_math 2.0.8 2.1.0-nullsafety
wkt_parser 1.0.7
xdg_directories 0.1.0
Dev dependencies
flutter_test