tlserver / flutter_map_location_marker

A flutter map plugin for displaying device current location.
https://pub.dev/packages/flutter_map_location_marker
BSD 3-Clause "New" or "Revised" License
97 stars 81 forks source link

How to toggle navigation #23

Closed Farrukh1198 closed 2 years ago

Farrukh1198 commented 2 years ago

How can I toggle navigation mode. If navigation turned on I would like to show marker without rotation at the center of the map, if navigation turned of I would like to show marker with rotation on current location position.

tlserver commented 2 years ago

Do you mean 'hiding heading sector' for 'without rotation'?

You can set LocationMarkerLayerOptions.showHeadingSector to false to hide the heading sector.

E.g.

      FlutterMap(
        options: MapOptions(
          center: LatLng(0, 0),
          zoom: 1,
          maxZoom: 19,
        ),
        children: [
          TileLayerWidget(
            options: TileLayerOptions(
              urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
              subdomains: ['a', 'b', 'c'],
              maxZoom: 19,
            ),
          ),
          LocationMarkerLayerWidget(
            options: LocationMarkerLayerOptions(
              showHeadingSector: !_navigationMode,
            ),
          ),
        ],
      )
Farrukh1198 commented 2 years ago

Do you mean 'hiding heading sector' for 'without rotation'?

You can set LocationMarkerLayerOptions.showHeadingSector to false to hide the heading sector.

E.g.

      FlutterMap(
        options: MapOptions(
          center: LatLng(0, 0),
          zoom: 1,
          maxZoom: 19,
        ),
        children: [
          TileLayerWidget(
            options: TileLayerOptions(
              urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
              subdomains: ['a', 'b', 'c'],
              maxZoom: 19,
            ),
          ),
          LocationMarkerLayerWidget(
            options: LocationMarkerLayerOptions(
              showHeadingSector: !_navigationMode,
            ),
          ),
        ],
      )

Not exactly what I meant. When navigation mode is on, the camera follows the marker in the center. When navigation mode is disabled, the user can explore the map, but the marker will remain at the user's current position.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 2 years ago

This issue was closed because it has been stalled for 7 days with no activity.

tlserver commented 2 years ago

Version 4.1.0 is ready, in this version, navigation mode can be implemented easily. You may check this example.