buildMarker function

Marker buildMarker(
  1. HybridModel user, {
  2. bool singleMarker = false,
  3. Widget? marker,
})

Builds a marker for the given user

Implementation

Marker buildMarker(HybridModel user,
    {bool singleMarker = false, Widget? marker}) {
  return Marker(
    anchorPos: AnchorPos.align(AnchorAlign.center),
    height: 75,
    width: 50,
    point: user.latLng!,
    // ignore: prefer_if_null_operators
    builder: (ctx) => marker != null
        ? marker
        : (singleMarker
            ? Stack(
                alignment: Alignment.center,
                children: [
                  Positioned(
                    bottom: 25,
                    child: SizedBox(
                      width: 40,
                      height: 40,
                      child: CustomPaint(
                        painter: CircleMarkerPainter(
                            color: AllColors().WHITE,
                            paintingStyle: PaintingStyle.fill),
                      ),
                    ),
                  ),
                  Positioned(
                    top: 10,
                    child: Icon(
                      Icons.circle,
                      size: 40,
                      color: AllColors().DARK_BLUE,
                    ),
                  ),
                ],
              )
            : Stack(
                alignment: Alignment.center,
                children: [
                  Positioned(
                    bottom: 25,
                    child: CustomPaint(
                      size: Size(40, (40 * 1.137455469677715).toDouble()),
                      painter: RPSCustomPainter(),
                    ),
                  ),
                  Positioned(
                    top: 10,
                    child: CircleAvatar(
                      radius: 15,
                      backgroundColor: AllColors().ORANGE,
                      child: user.image != null
                          ? CustomCircleAvatar(
                              byteImage: user.image, nonAsset: true, size: 30)
                          : ContactInitial(
                              initials: user.displayName,
                              size: 30,
                              backgroundColor: AllColors().ORANGE,
                            ),
                    ),
                  ),
                ],
              )),
  );
}