Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Balloon tooltip is not showing a shadow for the bottom arrow. #454

Closed
Digipom opened this issue May 25, 2023 · 2 comments
Closed

Balloon tooltip is not showing a shadow for the bottom arrow. #454

Digipom opened this issue May 25, 2023 · 2 comments

Comments

@Digipom
Copy link

Digipom commented May 25, 2023

  • Library Version: 1.0.5
  • Affected Device(s): All

Code to reproduce:

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            BalloonBugTheme {
                Scaffold(
                    bottomBar = {
                        BottomAppBar(actions = {
                            val backgroundColor = MaterialTheme.colorScheme.primaryContainer
                            val builder = rememberBalloonBuilder {
                                setArrowPositionRules(ArrowPositionRules.ALIGN_ANCHOR)
                                setPadding(16)
                                setCornerRadius(12f)
                                setBackgroundColor(backgroundColor)
                                setDismissWhenTouchOutside(false)
                            }
                            Balloon(
                                builder = builder,
                                balloonContent = {
                                    Text(
                                        color = MaterialTheme.colorScheme.onPrimaryContainer,
                                        text = "Hello, world!"
                                    )
                                }
                            ) { balloonWindow ->
                                IconButton(
                                    onClick = { }) {
                                    Icon(
                                        imageVector = Icons.Default.MoreVert,
                                        contentDescription = null
                                    )
                                }
                                LaunchedEffect(Unit) {
                                    balloonWindow.showAlignTop()
                                }
                            }
                        })
                    }
                ) {
                    Greeting(modifier = Modifier.padding(it), name = "Android")
                }
            }
        }
    }
}

@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
    Text(
        text = "Hello $name!",
        modifier = modifier
    )
}

Screenshot attached.
image

@skydoves
Copy link
Owner

skydoves commented May 28, 2023

You should use setArrowElevation inside of the builder.

Also, the elevation will be only applied when the arrow is towards the bottom.
Because the arrow is placed on the body of the balloon, elevation will invade the body, and that will look weird.

@Digipom
Copy link
Author

Digipom commented May 29, 2023

Hmm, I tried that and ran into #159 and #156. Is that the reason why the default for the bubble elevation and arrow elevation are not the same?

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

No branches or pull requests

2 participants