开发者

How to disable animation of marker rotation using animarker package

开发者 https://www.devze.com 2022-12-07 18:11 出处:网络
I am using flutter_animarker: ^3.4.0-beta.1 package. my code: void newLocationUpdate(LocationObj obj) {

I am using flutter_animarker: ^3.4.0-beta.1 package.

my code:

void newLocationUpdate(LocationObj obj) {
    var marker = RippleMarker(
        markerId: markerId,
        position: obj.latlng,
        ripple: false,
        alpha: 1,
        rotation: obj.rotat,
        icon: sourceIcon,
        anchor: const Offset(0.5, 0.5),
        onTap: () {
          // print('Tapped! $obj');
        });
    setState(() => markers[markerId] = marker);
  }

widget using:

Animarker(
          curve: Curves.linear,
          useRotation: true,
          rippleRadius: 0.5,
          angleThreshold: 1.5,
          duration: duration,
          runExpressAfter: 1,
          rippleDuration: const Duration(seconds: 2),
          mapId: controller.future.then<开发者_开发百科;int>((value) => value.mapId),
          markers: markers.values.toSet(),
          child: GoogleMap(
              polylines: {
                Polyline(
                    width: 2,
                    polylineId: const PolylineId('HTPolyline'),
                    points: locArr.map((element) => element.latlng).toList(),
                    color: const Color.fromARGB(179, 62, 191, 208)),
              },
              mapType: MapType.normal,
              initialCameraPosition: startPosition,
              onMapCreated: (gController) {
                getPositionsHistory().then((latlng) {
                  if (latlng.latitude > 0) {
                    gController.animateCamera(CameraUpdate.newCameraPosition(
                        CameraPosition(target: latlng, zoom: 14.5)));
                  }
                  stream.forEach((value) => newLocationUpdate(value));
                  controller.complete(gController);
                });
              }),
        )

In this image you can see the 360 degree animated rotation.

I tried the useRotation to false and also custom bearing functions but now I just want to disable the animation when marker is rotating.

0

精彩评论

暂无评论...
验证码 换一张
取 消