skydoves / Balloon

:balloon: Modernized and sophisticated tooltips, fully customizable with an arrow and animations for Android.

Home Page:https://skydoves.github.io/libraries/balloon/html/balloon/com.skydoves.balloon/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Proposal] Add optional key parameter into rememberBalloonBuilder

egorikftp opened this issue · comments

commented

Is your feature request related to a problem?

I faced some issue when I switch app theme inside compose application.
I pass bgColor and textColor into Balloon.Builder and after change theme I need to update this values.

Dark mode
image

Light mode (wrong)
image

Light mode (expected)
image

Source code: https://github.com/egorikftp/GrodnoRoads/blob/43fcdea90af3233a29912d196d2ae53e5323855f/features/map/map-ui/src/main/kotlin/com/egoriku/grodnoroads/map/foundation/UsersCount.kt#L32

Describe the solution you'd like:

I suggest to add optional key parameter

@Composable
fun rememberBalloonBuilder(
    key: Any? = null,
    context: Context = LocalContext.current,
    block: Balloon.Builder.() -> Unit
): Balloon.Builder = remember(key) {
    Balloon.Builder(context).apply(block)
}

Describe alternatives you've considered:

A clear description of any alternative solutions you've considered.

This is a really great example. Thank you for raising the issue and sharing your sample project! 👍

Merged. This feature will be included in the next release. For now, you can also use it by importing snapshot version. Thanks!