buildWidget method

  1. @override
Widget buildWidget(
  1. BuildContext context
)
override

build your widget here

Implementation

@override
Widget buildWidget(BuildContext context) {
  Widget rtn = Stack(children: [
    GoogleMap(
      onMapCreated: _onMapCreated,
      myLocationEnabled: showLocationOnMap,
      mapType: widget.controller.mapType ?? MapType.normal,
      myLocationButtonEnabled: false,
      // use our own button
      mapToolbarEnabled: false,
      zoomControlsEnabled: false,
      onCameraMove: _onCameraMove,
      onCameraIdle: _onCameraIdle,
      rotateGesturesEnabled: widget.controller.rotateEnabled,
      scrollGesturesEnabled: widget.controller.scrollEnabled,
      tiltGesturesEnabled: widget.controller.tiltEnabled,
      zoomGesturesEnabled: widget.controller.zoomEnabled,
      initialCameraPosition: CameraPosition(
          target: toLatLng(widget.controller.initialCameraPosition) ??
              widget.controller.defaultCameraLatLng,
          zoom: widget.controller.initialCameraZoom?.toDouble() ??
              widget.controller.defaultCameraZoom),
      markers: _getMarkers(),
    ),
    widget.controller.showToolbar
        ? MapsToolbar(
            margin: widget.controller.toolbarMargin,
            alignment: widget.controller.toolbarAlignment,
            top: widget.controller.toolbarTop,
            bottom: widget.controller.toolbarBottom,
            left: widget.controller.toolbarLeft,
            right: widget.controller.toolbarRight,
            onMapLayerChanged: widget.controller.showMapTypesButton
                ? (mapType) {
                    setState(() {
                      widget.controller.mapType = mapType;
                    });
                  }
                : null,
            onShowLocationButtonCallback: widget.controller.showLocationButton
                ? () => _moveCamera(MapsUtils.fromPosition(currentLocation))
                : null)
        : const SizedBox.shrink(),
    _overlayWidget != null && _selectedMarkerId != null
        ? MapsOverlay(
            _overlayWidget!,
            onScrolled: widget.controller.scrollableMarkerOverlay
                ? (isNext) =>
                    isNext ? _selectNextMarker() : _selectPreviousMarker()
                : null,
            onDismissed: widget.controller.dismissibleMarkerOverlay
                ? () => _clearSelectedMarker()
                : null,
            maxWidth: widget.controller.markerOverlayMaxWidth,
            maxHeight: widget.controller.markerOverlayMaxHeight,
          )
        : const SizedBox.shrink()
  ]);
  if (widget.controller.width != null || widget.controller.height != null) {
    rtn = SizedBox(
        width: widget.controller.width?.toDouble(),
        height: widget.controller.height?.toDouble(),
        child: rtn);
  }
  return rtn;
}