showLiksCount static method

void showLiksCount({
  1. required BuildContext context,
  2. SuperTooltip? tooltip,
  3. required List<CommentLike> list,
})

Implementation

static void showLiksCount({
  required BuildContext context,
  SuperTooltip? tooltip,
  required List<CommentLike> list,
}) {
  var renderBox = context.findRenderObject() as RenderBox;
  final overlay =
      Overlay.of(context)!.context.findRenderObject() as RenderBox?;
  var targetGlobalCenter = renderBox
      .localToGlobal(renderBox.size.center(Offset.zero), ancestor: overlay);
  tooltip = SuperTooltip(
    maxWidth: 200,
    maxHeight: 90,
    arrowTipDistance: 0.0,
    arrowBaseWidth: 0.0,
    arrowLength: 0.0,
    shadowColor: kBlack.withOpacity(0.1),
    borderColor: kTransparent,
    popupDirection: TooltipDirection.up,
    content: Scaffold(
      body: Container(
        width: 200,
        height: 45,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            for (int x = 0; x < list.length; x++)
              if (list[x].emojiCount > 0)
                Column(
                  children: [
                    CustomText(
                      text: list[x].emoji,
                      fontSize: 20,
                    ),
                    SizedBox(
                      height: 5,
                    ),
                    CustomText(
                      text: list[x].emojiCount > 1000
                          ? '${(list[x].emojiCount / 1000).toStringAsFixed(2)}K'
                          : '${list[x].emojiCount}',
                      fontSize: 11,
                      fontWeight: FontWeight.bold,
                    )
                  ],
                )
          ],
        ),
      ),
    ),
  );
  tooltip.show(context);
}