https://kotlinlang.org logo
Join Slack
Powered by
# compose
  • z

    zalewski.se

    10/21/2025, 9:17 AM
    Hey! šŸ‘‹ When an item in a
    LazyColumn
    animates its size (e.g., using
    .layout
    modifier), I’m noticing the item shifts vertically instead of staying anchored in the viewport. For example, if an item is centered, I’d like it to expand/collapse ā€œin placeā€ from that center point. Instead, the scroll position seems to anchor to the top (or bottom?) of the item, causing it to shift. Is there a recommended way to keep an item’s visual position stable in the viewport while its size animates within a
    LazyColumn
    ?
    s
    • 2
    • 3
  • j

    jermainedilao

    10/21/2025, 1:14 PM
    Hey! šŸ‘‹ I'm currently implementing a collapsing toolbar behavior with a Header + LazyColumn using custom NestedScrollConnection implementation. Everything works perfectly on portrait mode, but I switch to landscape mode, the collapsing toolbar behavior is working BUT the contents of the header gets clipped (because it is longer than the screen height, and I marked it as scrollable in order to participate on nested scroll connection). Currently, my workaround is when receiving gesture, I consume the scroll to Header first until its fully scrolled, and then I send the scroll event to LazyColumn. But it feels like a hacky workaround. Does anyone have a working solution for this?
    s
    • 2
    • 8
  • s

    suika

    10/22/2025, 4:39 AM
    Why doesn't ReusableContentHost clean up remember in slottable?
    Copy code
    setContent {
        var active by remember { mutableStateOf(true) }
        Box {
            ReusableContentHost(active) {
                val innerData = remember { mutableStateOf("Za") }
            }
        }
        val outerData = remember { mutableStateOf("Zb") }
        val composition = currentComposer.composition
        LaunchedEffect(active) {
            // !!! When active changes from true to false, the Za stored in the slottable still remains and has not been cleaned up.
            // Group(25) key=207, nodes=0, size=2 aux=false, slots=[86: false]
            //   Group(26) key=-1685893985, nodes=0, size=1, slots=[87: σ(value=Za]
            composition.printSlotTable()
        }
        Box(
            Modifier
                .fillMaxSize()
                .clickable {
                    active = !active
                    Log.e("clickable", "$active")
                }) { }
    }
    • 1
    • 1
  • e

    efemoney

    10/22/2025, 9:18 AM
    Is there a way to tint a
    Painter
    using a
    Brush
    (eg gradients and other shaders)? I am thinking to use
    drawWithContent
    but the issue is that I have this chain:
    Copy code
    Modifier
      .drawWithContent(...) // <- I want to tint/blend *only* the painter but this will tint/blend everything underneath
      .paint(painter, ...)
      .otherContentOrOverlay()
      .(...)
  • m

    Mark

    10/22/2025, 2:37 PM
    Anyone noticed links behaving differently in compose 1.9.1? When I use:
    Copy code
    val link = LinkAnnotation.Clickable(
        tag = tag,
        linkInteractionListener = linkInteractionListener,
    )
    withLink(link) {
        ...
    }
    in compose 1.9.0 (and earlier) there is no coloring or underscore, but now in 1.9.1 there are both. To workaround this I do:
    Copy code
    val link = LinkAnnotation.Clickable(
        tag = tag,
        styles = TextLinkStyles(),
        linkInteractionListener = linkInteractionListener,
    )
    withLink(link) {
        ...
    }
    so that no styling is applied. Are these two samples supposed to behave differently?
    l
    • 2
    • 1
  • t

    Tower Guidev2

    10/22/2025, 4:17 PM
    Hi, i am having dfficulty showing a compose view inside an android xml layout whose parent is a ScrollView, the compose view is intermitently displaying, how can i get it to show consistently?
    • 1
    • 2
  • j

    Jonathan

    10/23/2025, 2:55 AM
    Has anyone used a
    NavigableSupportingPaneScaffold
    following the guide found here? I've copied and pasted the code; only change I've made is to add Gray and light Gray background. Try as I might I cannot get the scaffold to behave as I expect, when running on a phone (portrait) only a single pane is displayed at once. What I'm seeing testing on an Pixel 9 Pro XL (emulator as well) is both panes are visible and vertically stacked. The scaffold behaves correctly on tablets. I'm using the the following dependency versions:
    Copy code
    composeBom = "2025.10.01"
    adaptiveVersion = "1.2.0" // adaptive libraries
    Has anyone run into this issue before?
    j
    • 2
    • 16
  • w

    wwalkingg

    10/23/2025, 6:51 AM
    Hello everyone. I have a question about Popup that I'd like to ask. In short, I want to know how to make a Popup display covering the entire screen, including the system bar. After researching, I've written the following code:
    Copy code
    Box(modifier = Modifier.fillMaxSize().background(Color.Blue)) {
            Popup(
                properties = PopupProperties(
                    clippingEnabled = false,
                )
            ) {
                Box(
                    modifier = Modifier
                        .size(10000.dp) // After failing to use fillMaxSize, a particularly large value was set.
                        .background(Color.Red),
                )
            }
        }
    However, the result turned out to be strange - it's not long enough. The blue part indicates the missing section of the popup. What should I do?
    j
    • 2
    • 2
  • t

    thedroiddiv

    10/23/2025, 8:03 AM
    Do Compose-Multiplatform previews with composeResources work on Linux?
    • 1
    • 1
  • j

    Jonas

    10/24/2025, 7:38 PM
    When using a supporting pane layout how can I determine if the supporting pane is currently visible? I want to display a button to navigate to the supporting pane if it is not already expanded. I tried accessing
    navigator.scaffoldState.currentState.secondary
    but it is always hidden, even tho the support pane is expanded or the main content atm. Context: I am using CMP | adaptive versions: 1.2.0-beta01
    āœ… 1
    j
    • 2
    • 4
  • a

    Alex Styl

    10/25/2025, 5:54 AM
    Is there a way to scroll to the very last item of a column w Modifier.scrollable() in tests? (do we also need a #compose-testing channel maybe?)
    • 1
    • 2
  • a

    Alex Styl

    10/25/2025, 10:16 AM
    Help me figure out whether this is a bug or intended. • On Android, I can continue dragging a list even after its content is fully scrolled, and i keep receiving
    NestedScrollConnection
    events (see 1st video) • On Desktop however, I don't receive any events when i overscroll (see video in 🧵). I need this to be consistent because I am building bottom sheets and users cannot currently collapse them on desktop using the mousewhee/trackpad. The current behavior is so weird for UX and doesn't feel I (the dev) need to handle this a different way. If this somehow a limitation of the platform, the web platform (Compose) handles it the same way. But on macs, desktop lists do bounce (overscroll effect) and websites (html) bounce as well.
    android.movbrowser.movdesktop_scroll.mov
    a
    • 2
    • 6
  • i

    iamthevoid

    10/25/2025, 5:17 PM
    Hi, everyone. Can you say please if there is possible to create nested sticky header or multilevel sticky header The easiest way to explain what do I mean - imagine a catalog with parent/child categories. When you scroll to parent category - parent header sticks to top of lazy column, but when you continue scroll parent header remains sticked and child categories sticks under parent and replace each other, but not replace parent untill new parent header appears in list. New parent displace both - previous child and parent sticky headers Actually i don't have a structure like i describe above, but something similar. I have a panel which not a first element of column and it sticks. Further elements has date and time and I'd like to group them by date and also I'd like to use date as sub-sticky header, that not displace a panel, but displace each other
    • 1
    • 1
  • m

    Martin Noga

    10/25/2025, 5:33 PM
    Hello there, I'm fighting a little with HorizontalCenteredHeroCarousel, it does exactly what i want unless i'm scrolled all the way to one of the ends, as it is showing one big in the center and one small on each side, but once i'm scrolled all the way to one side, it is showing one big on the side and two small on the other side which is something i don't want, once i'm scrolled to the side i would like to show one big and one small, as i case when there is only two items. Is this possible with some kind of simple solution or am i bound to do some crazy stuff to override this behavior?
  • s

    Sunil Kumar

    10/26/2025, 11:06 AM
    how to apply top only shadow using dropShadow, i dont want shadow on bottom edges
    • 1
    • 1
  • c

    Colton Idle

    10/27/2025, 6:38 PM
    Bumping to material3, version 1.4.0 from 1.3.2 broke some of my designs (buttons specifically). Did I miss a memo? Looking at the release notes I don't notice any callouts there?
    k
    • 2
    • 8
  • e

    eygraber

    10/27/2025, 8:16 PM
    Is it expected that text with no HTML measures differently when coming from
    AnnotatedString.fromHtml
    vs a
    String
    or
    AnnotatedString(String)
    ?
  • m

    Max

    10/27/2025, 9:23 PM
    Hey everyone, i hope this is the right channel: Topic: Compose Multiplatform vs Jetpack Compose Letā€˜s say i have a KMP module/library where i use in commonMain Compose Multiplatform and specify a CustomButton composable there. Then i have an Android app which adds this module as dependency and uses the CustomButton (now fully in Android context). Will this Android app now have a transient dependency on Compose Multiplatform, or will the compiler translate all CMP to Jetpack compose and the Android app actually only depends on Jetpack Composeā“ In other words: will Compose Multiplatform ā€žleakā€œ into consuming Android apps or be resolved totally to Jetpack Compose? maybe @Andrei Salavei you know?
    j
    i
    • 3
    • 9
  • k

    Kyant

    10/28/2025, 7:50 AM
    Why is the
    Brush
    a sealed class? I can't customize it... Any way to hack the compose function to support other color spaces everywhere?
    Copy code
    internal fun NativePaint.setNativeColor(value: Color) {
        this.color = value.toArgb()
    }
    r
    • 2
    • 8
  • s

    Sudarshan

    10/28/2025, 9:59 AM
    Hi everyone, I’m working on a Compose Multiplatform project and wanted to use a custom folder for multiplatform resources: changing the default
    composeResources
    to
    resources
    . I followed the official documentation and updated my build script accordingly, but I’m now facing a runtime exception. More details are shared in the thread.
    • 1
    • 1
  • j

    Jonas

    10/28/2025, 12:05 PM
    Hi, I'm having trouble with restricting the size of an
    OutlinedTextField
    ;
    f
    • 2
    • 20
  • u

    ursus

    10/28/2025, 9:32 PM
    Why is compose on android in release so much faster? Is it just R8 doing it's magic? Or are there some compose flags being flipped during release task as well? (Do they even exist?)
    e
    j
    +2
    • 5
    • 23
  • u

    ursus

    10/29/2025, 2:12 PM
    Copy code
    @Composable
    private fun Link(
        modifier: Modifier,
        text: String,
        isQuiet: Boolean = false, <------
        isSecondary: Boolean = false, <------
        isSmall: Boolean = false, <----------
        onClick: () -> Unit
    ) {
        ...
    }
    How do you deal with creating variants of composables? I'd naturally expect to these be a separate composables however in this case, its a combination, i.e. I'd have to end up with
    Copy code
    LargeLoudPrimaryLink
    LargeQuietPrimaryLink
    ...
    all the combinations -- which seems not ideal
    e
    • 2
    • 2
  • j

    Jorge DomĆ­nguez

    10/29/2025, 4:34 PM
    Hey all, I’m running into an issue with
    AndroidViewBinding
    when hosting different fragments across two screens, hopefully someone here will be able to help me. In Screen A, I host
    FragmentA
    , and in Screen B, I host
    FragmentB
    , both are instances of the same fragment class. Even though I use the same composable function, each one is hosted in a different
    FragmentContainerView
    (I handle this by passing a
    bindingFactory
    lambda to
    AndroidViewBinding
    ). When navigating from Screen A → Screen B, everything works fine:
    FragmentManager
    properly removes
    FragmentA
    before showing
    FragmentB
    . However, when navigating back from Screen B → Screen A, their lifecycles seem to overlap: `AndroidViewBinding`’s
    onRelease
    from Screen B is called after the
    factory
    from Screen A. This ends up replacing
    FragmentA
    with
    FragmentB
    on Screen A 🧵
    i
    • 2
    • 18
  • d

    Doug McCluer

    10/29/2025, 8:14 PM
    Is there a way to restrict a function from being called outside the scope of a
    @Preview
    annotated function?
    s
    v
    t
    • 4
    • 9
  • n

    Nathan Fallet

    10/30/2025, 8:46 AM
    My coworker started working on a Compose Multiplateform implementation of Ant Design UI library https://github.com/guimauvedigital/ant-design-kmp This is a well known design system in the web ecosystem, now available for CMP šŸ˜„
    K 1
    K 5
  • x

    Xu Moria

    10/31/2025, 5:51 AM
    Hello, I am using
    LazyColumn
    inside
    HorizontalPager
    . When
    LazyColumn
    is scrolled by the user and enters the Fling state after the user's finger leaves the
    LazyColumn
    , the duration of this Fling is determined by
    FlingBehavior
    . However, when the Fling is in progress, the user's attempt to swipe horizontally on the
    HorizontalPager
    is completely blocked. This results in a poor UX experience. Is there any way to solve this? In
    ScrollingLogic
    ,
    Offset.singleAxisOffset()
    completely discards the value in the other direction. Shouldn't it be that scrolling in one direction blocks the other direction, while during Fling, the other direction should be allowed?
    • 1
    • 1
  • l

    lakakhara

    10/31/2025, 3:36 PM
    I wrote (copied) extension function
    Iterable<T>.sumOf(selector: (T) -> Dp): Dp
    but for some reason compiler want to use it even for other types like Int and Double. I added annotation
    OverloadResolutionByLambdaReturnType
    that if I got it right should alter preference, but it doesn't.
    Copy code
    @OptIn(ExperimentalTypeInference::class)
    @OverloadResolutionByLambdaReturnType
    @JvmName("sumOfDp")
    inline fun <T> Iterable<T>.sumOf(selector: (T) -> Dp): Dp {
        var sum: Dp = 0.dp
        for (element in this) {
            sum += selector(element)
        }
        return sum
    }
    I know that I can just sum Dp.value.toDouble() but I want to know where the problem is
    e
    • 2
    • 1
  • m

    maarten ha

    10/31/2025, 9:52 PM
    Are there tools like motion canvas, manim or remotion that uses compose? Would love to create some videos while reusing component that I already build
    a
    • 2
    • 1
  • d

    dleuck

    11/01/2025, 12:16 AM
    We just completed a large biotech (HTS) Compose and Compose for Desktop app called ClearWell. The app does plate analytics, dose response curves, artifact detection, plate comparison via the Gallery, and compound rendering for High-Throughput Screening (HTS), which is used for early drug discovery: https://en.wikipedia.org/wiki/High-throughput_screening ClearWell also has an embedded scripting language called KS (Ki Script) that draws heavily from Kotlin, Swift and F#. It is optionally typed, supports units of measure and has conditions for parameters beyond simple typing, making it ideal for STEM applications. KS can be utilized by ClearWell users to add functionality, access plate data, and create custom analytics. With Claude's assistance, we wrote the language from scratch, and we have hundreds of example scripts. Thanks to that collaboration, it only took about six weeks. We just released the Compose for Desktop version. We also have a (regular) Compose version under development. Our next set of features will include AI for helping with coding errors and artifact detection. I've attached screenshots. There is a minimal free version available on the site: https://www.fellstreet.bio We also have a series of ClearWell videos on the download page: https://www.fellstreet.bio/download.html Note: I'm not pitching ClearWell (it's for HTS labs), but I thought the community might be interested in a large scale Compose biotech app. It took us a little over a year to build with two developers and some help from Claude.ai.
    šŸ‘ 1
    šŸ”„ 5
    s
    • 2
    • 2