buildLayer method

  1. @override
Widget buildLayer(
  1. BuildContext context,
  2. MapState map
)
override

override this function for every map layers

Implementation

@override
Widget buildLayer(BuildContext context, MapState map) {
  final pixelOrigin = map.pixelOrigin;
  final scale = map.getZoomScale(map.zoom, map.zoom);
  final nw = map.project(bounds.northWest);
  final se = map.project(bounds.southEast);

  final topLeft = (nw * scale) - pixelOrigin;
  final bottomRight = (se * scale) - pixelOrigin;

  final double top = topLeft.y;
  final double left = topLeft.x;
  final width = bottomRight.x - topLeft.x;
  final height = bottomRight.y - topLeft.y;

  return Positioned(
    top: top,
    left: left,
    width: width,
    height: height,
    child: InteractiveGestureDetector(
      position: bounds,
      data: data,
      options: options,
      child: VideoOverlayPlayer(
        videoUrl,
        bounds: bounds,
        looping: looping,
        options: options,
        data: data,
        onReady: onReady,
      ),
    ),
  );
}