Widget build()

in packages/google_maps_flutter/google_maps_flutter/example/lib/place_marker.dart [290:416]


  Widget build(BuildContext context) {
    final MarkerId? selectedId = selectedMarker;
    return Stack(children: [
      Column(
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        crossAxisAlignment: CrossAxisAlignment.stretch,
        children: <Widget>[
          Expanded(
            child: GoogleMap(
              onMapCreated: _onMapCreated,
              initialCameraPosition: const CameraPosition(
                target: LatLng(-33.852, 151.211),
                zoom: 11.0,
              ),
              markers: Set<Marker>.of(markers.values),
            ),
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: <Widget>[
              TextButton(
                child: const Text('Add'),
                onPressed: _add,
              ),
              TextButton(
                child: const Text('Remove'),
                onPressed:
                    selectedId == null ? null : () => _remove(selectedId),
              ),
            ],
          ),
          Wrap(
            alignment: WrapAlignment.spaceEvenly,
            children: <Widget>[
              TextButton(
                child: const Text('change info'),
                onPressed:
                    selectedId == null ? null : () => _changeInfo(selectedId),
              ),
              TextButton(
                child: const Text('change info anchor'),
                onPressed: selectedId == null
                    ? null
                    : () => _changeInfoAnchor(selectedId),
              ),
              TextButton(
                child: const Text('change alpha'),
                onPressed:
                    selectedId == null ? null : () => _changeAlpha(selectedId),
              ),
              TextButton(
                child: const Text('change anchor'),
                onPressed:
                    selectedId == null ? null : () => _changeAnchor(selectedId),
              ),
              TextButton(
                child: const Text('toggle draggable'),
                onPressed: selectedId == null
                    ? null
                    : () => _toggleDraggable(selectedId),
              ),
              TextButton(
                child: const Text('toggle flat'),
                onPressed:
                    selectedId == null ? null : () => _toggleFlat(selectedId),
              ),
              TextButton(
                child: const Text('change position'),
                onPressed: selectedId == null
                    ? null
                    : () => _changePosition(selectedId),
              ),
              TextButton(
                child: const Text('change rotation'),
                onPressed: selectedId == null
                    ? null
                    : () => _changeRotation(selectedId),
              ),
              TextButton(
                child: const Text('toggle visible'),
                onPressed: selectedId == null
                    ? null
                    : () => _toggleVisible(selectedId),
              ),
              TextButton(
                child: const Text('change zIndex'),
                onPressed:
                    selectedId == null ? null : () => _changeZIndex(selectedId),
              ),
              TextButton(
                child: const Text('set marker icon'),
                onPressed: selectedId == null
                    ? null
                    : () {
                        _getAssetIcon(context).then(
                          (BitmapDescriptor icon) {
                            _setMarkerIcon(selectedId, icon);
                          },
                        );
                      },
              ),
            ],
          ),
        ],
      ),
      Visibility(
        visible: markerPosition != null,
        child: Container(
          color: Colors.white70,
          height: 30,
          padding: EdgeInsets.only(left: 12, right: 12),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceAround,
            mainAxisSize: MainAxisSize.max,
            children: [
              markerPosition == null
                  ? Container()
                  : Expanded(child: Text("lat: ${markerPosition!.latitude}")),
              markerPosition == null
                  ? Container()
                  : Expanded(child: Text("lng: ${markerPosition!.longitude}")),
            ],
          ),
        ),
      ),
    ]);
  }