ChatKitMessagePopMenu constructor

ChatKitMessagePopMenu(
  1. ChatMessage message,
  2. BuildContext context, {
  3. PopMenuAction? popMenuAction,
  4. ChatUIConfig? chatUIConfig,
})

Implementation

ChatKitMessagePopMenu(this.message, this.context,
    {this.popMenuAction, this.chatUIConfig}) {
  double arrowTipDistance = 30;
  TooltipDirection popupDirection = TooltipDirection.up;

  RenderBox? box = context.findRenderObject() as RenderBox?;
  if (box != null) {
    Offset offset = box.localToGlobal(Offset.zero);
    if (offset.dy < 240) {
      popupDirection = TooltipDirection.down;
    }
  }
  arrowTipDistance = (context.size!.height / 2).roundToDouble() + 10;

  bool isSelf() {
    return message.nimMessage.messageDirection ==
        NIMMessageDirection.outgoing;
  }

  _tooltip = SuperTooltip(
    popupDirection: popupDirection,
    minimumOutSidePadding: 0,
    arrowTipDistance: arrowTipDistance,
    arrowBaseWidth: 10.0,
    arrowLength: 10.0,
    right: isSelf() ? 60 : null,
    left: isSelf() ? null : 60,
    borderColor: Colors.white,
    backgroundColor: Colors.white,
    shadowColor: Colors.black26,
    hasShadow: true,
    borderWidth: 1.0,
    showCloseButton: ShowCloseButton.none,
    touchThroughAreaShape: ClipAreaShape.rectangle,
    content: _getTooltipAction(context, chatUIConfig, message),
  );
}