Giter Club home page Giter Club logo

flutter_map_animations's Introduction

flutter_map_animations's People

Contributors

github-actions[bot] avatar jaffaketchup avatar reinissprogis avatar rorystephenson avatar testeurmaniak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

flutter_map_animations's Issues

Cannot use mapController.move while using animatedRotate

Hi @TesteurManiak,

I was testing the animated rotation based on internal sensor bearing in flutter_map and I discovered that one cannot really zoom in when using the animatedRotate method. Do you know if there is anything that can be done about this? My animation duration is ~350ms and I believe the internal sensor sends data every ~370ms.

I was thinking to maybe not rotate if the change is < 10 degrees, which may give the other action time to take effect. This may be quite janky though.

Thanks :)

Tiles loading latency

I tried to add flutter_map_animations, but with that plugin my app has latency with loading tiles. With default MapController everything is okay. Where i can have a problem?

Example with AnimatedMapController: https://imgur.com/a/l5HEEPQ
Example with default MapController: https://imgur.com/a/hH9fQIs

code:

Variables.dart:

class Variables {
  static MapController mapC = MapController();

  static final AnimatedMapController _animatedMapController =
      AnimatedMapController(vsync: map.Map());

  static AnimatedMapController get animatedMapController =>
      _animatedMapController;

  static LatLng initialPosition =
      LatLng(49.062039830184474, 16.531229094389655);
  static double initialZoom = 4.0;

  static double zoomForAdding = 16.0; 
}

map.dart:

void moveMap(double latitude, double longitude) {
  LatLng coordinates = LatLng(latitude, longitude);
  //Variables.mapC.move(coordinates, Variables.zoomForAdding);
  Variables.animatedMapController.animateTo(dest: coordinates, zoom: Variables.zoomForAdding);
}

class MapLayer extends ConsumerStatefulWidget {
  @override
  Map createState() => Map();
}

class Map extends ConsumerState<MapLayer> with TickerProviderStateMixin {
  @override
  Ticker createTicker(TickerCallback onTick) {
    return Ticker(onTick, debugLabel: 'vsync');
  }

  @override
  Widget build(BuildContext context) {
    final markersOnMapLocal = ref.watch(markersOnMap);
    final List<LatLng> polylineCoordinatesLocal =
        ref.watch(polylineCoordinates);

    return map.FlutterMap(
      mapController: Variables.animatedMapController.mapController,
      options: map.MapOptions(
        initialCenter: Variables.initialPosition,
        maxZoom: 18.3,
        initialZoom: Variables.initialZoom,
        onTap: (tapPosition, point) {
          if (ref.watch(addingCustomMarker)) {
            int idMarker = UniqueKey().hashCode;

            ref.read(customMarkers.notifier).add(
                  Marker(
                    key: ValueKey<int>(idMarker),
                    width: 120.0,
                    height: 120.0,
                    point: point,
                    builder: (ctx) => Icon(Icons.location_on),
                  ),
                );
            ref.read(markersOnMap.notifier).add(
                  MarkerData(
                    id: ValueKey<int>(idMarker),
                    isCustomMarker: true,
                    latitude: point.latitude,
                    longitude: point.longitude,
                    color: Options.customMarkerColor,
                  ),
                );

            ref.read(addingCustomMarker.notifier).state = false;
          }
        },
      ),
      children: [
        map.TileLayer(
          urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
          userAgentPackageName: 'dev',
          errorTileCallback: (tile, error, stackTrace) {
            print(error);
            print(stackTrace);
          },
          tileProvider: FMTC.instance('mapStore').getTileProvider(),
        ),
        map.MarkerLayer(
          markers: [
            for (final marker in markersOnMapLocal)
              map.Marker(
                point: LatLng(marker.latitude!, marker.longitude!),
                child: Icon(Icons.location_on, color: marker.color, size: 40.0),
              ),
          ],
        ),
        map.PolylineLayer(
          polylines: [
            map.Polyline(
              points: polylineCoordinatesLocal,
              color: Colors.blue,
              strokeWidth: 5,
            ),
          ],
        )
      ],
    );
  }
}

Referencing`plugin_api.dart` in flutter_map v6, incorrect `mapController` type inference

I get the following error when building when using

  flutter_map: ^6.0.0
  flutter_map_animations: ^0.5.0-dev.1

Console Output

../../../.pub-cache/hosted/pub.dev/flutter_map_animations-0.5.0-dev.1/lib/src/animated_map_controller.dart:4:8:
Error: Error when reading '../../../.pub-cache/hosted/pub.dev/flutter_map-6.0.0/lib/plugin_api.dart': No such file
or directory

I figured this might be due to Plugin API removed in FlutterMap v6: https://docs.fleaflet.dev/v/v6/getting-started/migrating-to-v6#plugin-api-import-has-been-removed


Additionally, AnimatedMapController's mapController property's type is exposed as InvalidType. As such, reading the values such as _animatedMapController.mapController.bounds cannot be compared to null since it returns an InvalidType data type.

Topics

Thanks for adding topics to your package!

Due to a bug, we were not validating the names on package upload. This has been fixed and will be enforced when publishing new versions.

The guidelines for choosing topic names is https://dart.dev/tools/pub/pubspec#topics. Concretely we do not allow underscores.

Could you please update your topics names in the pubspec?

Thanks in advance and sorry for the inconvenience.

Add `offset` support for `animateTo`?

flutter_map supports a fixed pixel offset in its move method. It would be great if animateTo also allowed users to pass through an offset!

PR coming!

animated marker questions

is the animation happening when the marker appears or disappears from the map ? does it happen when a marker moves?

Missing rotation parameter on .animatedFitCamera()

Hi, I want to animate to a rectangular shape on my map and rotate my camera so that the box is level to my screen.

I expected to call .animateFitCamera(cameraFit: myFit, rotation: myRotation), but the rotation parameter is missing. I implemented the functionality myself like this:

double currentRotation = controller.mapController.camera.rotation;
double desiredRotation = ...;
controller.mapController.rotate(desiredRotation);
MapCamera mapCamera = cameraFit.fit(controller.mapController.camera);
controller.mapController.rotate(currentRotation);

state.controller.animateTo(
  dest: mapCamera.center,
  zoom: mapCamera.zoom,
  rotation: desiredRotation,
);

I think it would be a good extension to the current functionality.

Is it possible to add offset to the animation moves?

Hi, was wondering if it would be possible to add an offset like the mapController. I often want to animate to somewhere but want it to get with the an offset by px.

Currently only the main map controller has the offset

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.