RenderEngine method

  1. @override
dynamic RenderEngine()
override

Implementation

@override
RenderEngine() {
  double? lat = _config.Engine.CurrentLocation?.lat;
  double? lng = _config.Engine.CurrentLocation?.lng;
  List<Polyline> polylineList = [];
  List<Marker> markerList = [];
  List<Polygon> polygonList = [];
  // List<CircleMarker> circleList = [];
  if (polyline != null) {
    List<LatLng> points = [];
    for (var element in polyline!.Points) {
      points.add(LatLng(element.lat, element.lng));
    }

    polylineList.add(
      Polyline(
          polylineId: const PolylineId("001"),
          points: points,
          color: polyline!.color,
          width: 2,
          // strokeWidth: 5,
          patterns: const []),
    );
  }
  for (var element in Markers) {
    var marker = Marker(
      markerId: MarkerId(element.Id),
      // width: element.Width,
      // height: element.Height,
      position: LatLng(element.Positions!.lat, element.Positions!.lng),
      icon: BitmapDescriptor.defaultMarker,

      // child: Builder(builder: (context) {
      //   return RotationTransition(
      //       turns: AlwaysStoppedAnimation(element.Bearing ?? 0),
      //       child: InkWell(
      //           onTap: element.onTap, child: Image.asset(element.Image)));
      // }),
      flat: false,
      // alignment: element.alignment,
    );
    markerList.add(marker);
  }

  if (Fences != null) {
    for (var element in Fences!) {
      if (element is PolygonRF) {
        List<LatLng> latLng = [];
        for (var item in element.Points) {
          latLng.add(LatLng(item.lat, item.lng));
        }
        polygonList.add(Polygon(
          polygonId: const PolygonId("001"),
          points: latLng,
          fillColor: element.color,
          //strokeWidth: element.strokeWidth,
          // borderColor: element.BorderColor,
          // borderStrokeWidth: element.BorderStrokeWidth,
          // hitValue:
        ));
        // } else if (element is CircleRF) {
        //   circleList.add(CircleMarker(
        //       point: LatLng(element.Points.lat, element.Points.lng),
        //       radius: element.Radius,
        //       borderStrokeWidth: element.BorderStrokeWidth,
        //       borderColor: element.BorderColor,
        //       color: element.color));
        // }
      }
    }
  }

  return GoogleMap(
    initialCameraPosition: _kGooglePlex,
    onMapCreated: (GoogleMapController controller) {
      googleMapCOntroller.complete(controller);
    },
    myLocationEnabled: true,
    markers: {
      Marker(
        markerId: const MarkerId(
          "001",
        ),
        position: LatLng(
          _config.Engine.CurrentLocation?.lat ?? 0,
          _config.Engine.CurrentLocation?.lng ?? 0,
        ),
      )
    },
    polygons: polygonList.toSet(),
  );
}