Skip to content

Add support for centrally places tooltips (screen center)#36

Merged
ankitk77 merged 3 commits intoankitk77:masterfrom
pstanoev:master
Oct 5, 2025
Merged

Add support for centrally places tooltips (screen center)#36
ankitk77 merged 3 commits intoankitk77:masterfrom
pstanoev:master

Conversation

@pstanoev
Copy link
Copy Markdown
Contributor

image

Used to create tours that have popup dialog style, with central tips, example:
image

Copy link
Copy Markdown
Owner

@ankitk77 ankitk77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Thanks for the adding the feature

@ankitk77
Copy link
Copy Markdown
Owner

I think we should also add support for Arrow type None
bcz when placing tooltip centrally client may don't want to show any arrow on ballon

@pstanoev
Copy link
Copy Markdown
Contributor Author

I think we should also add support for Arrow type None bcz when placing tooltip centrally client may don't want to show any arrow on ballon

Yes, I did that in our project by making the Arrow nullable.
But Arrow.none will be way better design.

public fun tooltipBalloonShape(
  arrow: Arrow?,
  density: Density,
  radius: Dp
): GenericShape = GenericShape { size, _ ->

  val cornerRadiusPx = radius.toPx(density)
  if (arrow != null) {
    // rounded rect and arrow top / bottom / left / right
    addRoundRect(
      RoundRect(
        left = arrow.startPadding.toPx(density),
        right = size.width - arrow.endPadding.toPx(density),
        top = arrow.topPadding.toPx(density),
        bottom = size.height - arrow.bottomPadding
          .toPx(density),
        cornerRadius = CornerRadius(cornerRadiusPx)
      )
    )
    addPath(arrow.draw(size, density))
  } else {
    // now arrow, just rounded rect
    addRoundRect(
      RoundRect(
        rect = Rect(
          offset = Offset.Zero,
          size = size
        ),
        cornerRadius = CornerRadius(cornerRadiusPx)
      )
    )

    return@GenericShape
  }

@pstanoev
Copy link
Copy Markdown
Contributor Author

Btw. I can not merge this PR, it says that it is waiting for approval and/or build status to be reported.

@ankitk77 ankitk77 merged commit bcdc222 into ankitk77:master Oct 5, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants