updateInfoWindow method

void updateInfoWindow(
  1. BuildContext context,
  2. GoogleMapController controller,
  3. LatLng location,
  4. double infoWindowWidth,
  5. double markerOffset,
)

Implementation

void updateInfoWindow(
    BuildContext context,
    GoogleMapController controller,
    LatLng location,
    double infoWindowWidth,
    double markerOffset,
    ) async {
  ScreenCoordinate screenCoordinate =
  await controller.getScreenCoordinate(location);
  double devicePixelRatio =
  Platform.isAndroid ? MediaQuery.of(context).devicePixelRatio : 1.0;
  double left = (screenCoordinate.x.toDouble() / devicePixelRatio) -
      (infoWindowWidth / 2);
  double top =
      (screenCoordinate.y.toDouble() / devicePixelRatio) - markerOffset;
  if (left < 0 || top < 0) {
    _tempHidden = true;
  } else {
    _tempHidden = false;
    _leftMargin = left;
    _topMargin = top;
  }
}