https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
compose
  • z

    zt

    09/27/2022, 11:21 PM
    How would I fit a label indicating the current value to the right of a slider from the material 3 lib?
    e
    r
    6 replies · 3 participants
  • e

    elye

    09/28/2022, 12:29 AM
    Everyone else got some reply.... but not this one https://kotlinlang.slack.com/archives/CJLTWPH7S/p1664285056093139 😞 Hopes someone can shed some light on the use of
    ViewRootForInspector
    . It is used by
    Dialog
    ,
    Popup
    etc... I'm trying to understand how should it be used along with
    AbstractCompose
    . Thanks 🙏
    e
    2 replies · 2 participants
  • s

    svenjacobs

    09/28/2022, 6:52 AM
    Cross-post because of topic overlap.
    a
    2 replies · 2 participants
  • a

    abu naser

    09/28/2022, 7:00 AM
    hello guys . i am working on a compose textfield and use option to use different google font for the user . i am using this method https://proandroiddev.com/downloadable-fonts-with-jetpack-compose-561c6301b919 but the problem is if the font is not pre-downloaded then its takes a while to take effect . ( user select a name of google font from dropdown that contain almost 100 font names ) is there a way to download all this font when the user first open my apps ?
    j
    a
    3 replies · 3 participants
  • h

    Hengjiang Liu

    09/28/2022, 7:16 AM
    About NestedScrollConnection in compose, I nested a
    lazyColum
    inside a
    LazyColum
    and I need to do something use the NestedScrollConnection. I created two
    NestedScrollConnection
    object, one for child and another one for parent. But I don’t know why the child’s available in
    onPostScroll()
    can’t transit to parent while onPreScroll works fine. I wonder how to connect two NestedScrollConnection as child and parent, is it automatic?
    i
    2 replies · 2 participants
  • c

    czuckie

    09/28/2022, 7:32 AM
    When you tap back, your UiState is still going to be UiState.Content which will trigger a navigation by the looks of it. Navigation is typically triggered by events (button clicks for example) rather than state change. I think this is why the navigation host doesn't take an observable state value as its current destination. You always have to trigger navigation via a navigation controller. I've not found a brilliant way to manage this, navigation in general always becomes quite tricky in complicated apps and there always seems to be a desire to separate navigation from the view layer, but it's really difficult to do it nicely.
    s
    1 reply · 2 participants
  • o

    oday

    09/28/2022, 7:59 AM
    so I am facing an issue when trying to change the background of
    TopAppBar
    , the Composable itself has a parameter
    backgroundColor
    , ok, but I was expecting to be able to change its background through Modifier as well…not only does that not work but it’s like you didn’t even pass anything to the modifier if you try that setting backgroundColor on the TopAppBar does work though
    j
    3 replies · 2 participants
  • c

    Christoph Wiesner

    09/28/2022, 8:02 AM
    Hi, to avoid unnecessary hierarchies when displaying conditional elements i use the following approach:
    val iconContent: @Composable () -> Unit = {
                    Icon(...)
    }
    
    if (someCondition) {
        // wrap the icon in a box to display some overlapping composable
        Box(...) {
            iconContent()
            OverlayingComposable()
        }
    } else {
        // 99% of the time the overlay is hidden - so only display the icon without the Box wrapper
        iconContent()
    }
    is this unnecessary optimization? bc. readability gets worse - or is there another approach?
    j
    s
    4 replies · 3 participants
  • r

    Ruben Quadros

    09/28/2022, 12:31 PM
    Hi everyone, how can I limit max characters in
    Text
    component?
    z
    a
    3 replies · 3 participants
  • j

    Jhonatan Sabadi

    09/28/2022, 4:50 PM
    You can use this in any context
    AndroidView(
        factory = { context ->
            TimePicker(context)
        }
    )
  • c

    Chris Fillmore

    09/28/2022, 6:08 PM
    I’m translating a design from Figma and I’ve realized I’m not sure what the equivalent of
    position: absolute
    is in Compose.
    c
    14 replies · 2 participants
  • m

    Mia Clapham

    09/28/2022, 6:34 PM
    @Test
    fun priceAlerts_LetsGoButton() {
        setUpPriceAlertsComposable()
        val button =
            composeRule.onNodeWithText(context.getString(
                R.string.improved_onboarding_V1_lets_go_button))
                .assertExists()
        button.assertIsDisplayed()
        button.performClick().assertExists()
        verify(mockViewModel).letsGoClick(any())
    }
    a
    6 replies · 2 participants
  • z

    zt

    09/28/2022, 10:59 PM
    Is this the correct way to use movableContentOf? If i start the app in portrait then rotate to landscape and rotate back it crashes.
    FATAL EXCEPTION: main
    Process: com.hyperion, PID: 13405
    java.lang.ArrayIndexOutOfBoundsException: length=7430; index=7431
    	at androidx.compose.runtime.SlotTableKt.hasMark(SlotTable.kt:3169)
    	at androidx.compose.runtime.SlotTableKt.access$hasMark(SlotTable.kt:1)
    	at androidx.compose.runtime.SlotReader.hasMark(SlotTable.kt:827)
    	at androidx.compose.runtime.ComposerImpl.reportFreeMovableContent$reportGroup(Composer.kt:3500)
    	at androidx.compose.runtime.ComposerImpl.reportFreeMovableContent(Composer.kt:3593)
    + 300 more lines
    a
    3 replies · 2 participants
  • m

    Markus Fung

    09/29/2022, 2:01 AM
    and it has a little space between the second and third line ( as well as sixth and seventh ) is it the problem why my red circle is off the place ?
    c
    d
    8 replies · 3 participants
  • w

    willyrs

    09/29/2022, 7:19 AM
    Hey all, I'm trying to setup a seek bar for a video player with Slider, but since I'm recomposing it every second to update the progress bar I'm not able to seek it manually (with my finger) because it keeps going back to the "current" progress. Do you have any tip on how to handle this?
    s
    s
    4 replies · 3 participants
  • g

    Guilherme Delgado

    09/29/2022, 10:02 AM
    Hey! I’m using Android Studio Electric Eel | 2022.1.1 Beta 1 (Build #AI-221.6008.13.2211.9039819, built on September 8, 2022), I’m deploying to API 33 simulator, latest compose-ui/compiler versions, permissions in developer settings to enable view attribute inspection, and LayoutInspector shows nothing, not compose tree 🤷‍♂️ Any configuration missing?
  • m

    Marco Pierucci

    09/29/2022, 10:30 AM
    Hello! Is there something equivalent to
    focusable:false
    ?
    z
    5 replies · 2 participants
  • j

    Jasmin Fajkic

    09/29/2022, 11:16 AM
    Hello, Is it possible with navigation to achieve this? I’m using the accompanist bottom sheet to create a nested graph. The first route I open in the bottom sheet, and I want all subsequent routes to open as normal screens inside the bottom sheet.
    i
    n
    7 replies · 3 participants
  • o

    okaymak

    09/29/2022, 11:55 AM
    Is there a way to hide the selection handle that appears on a
    TextField
    ? I basically want the
    TextField
    to be just for input and without selection, magnifier, copy or paste.
    s
    a
    10 replies · 3 participants
  • q

    qlitzler

    09/29/2022, 12:09 PM
    Hello, does anyone know if there’s a way to tell the compose compiler to ignore / exclude a file / class ? I was looking for an @Ignore annotation but could not find any. Let me explain my problem: I’m using the compiler metric feature, and I don’t want some classes to show up in the compiler report (because these classes are not meant to be used by jetpack compose)
    s
    5 replies · 2 participants
  • l

    louiscad

    09/29/2022, 3:00 PM
    Looking forward to a Kotlin 1.7.20 compatible Compose Compiler 👀 Anyone knows when we can expect it?
    j
    j
    +6
    43 replies · 9 participants
  • c

    Chuck Stein

    09/29/2022, 3:51 PM
    I want one destination in my main app nav graph (which uses Fragment Navigation) to be a navigation-compose nav graph. Would the best way to do this be to declare a Fragment destination in the main app nav graph, and put the composable
    NavHost
    inside a
    ComposeView
    in that Fragment?
    i
    2 replies · 2 participants
  • c

    Chris Fillmore

    09/29/2022, 4:15 PM
    I have a screen with
    AnimatedContent
    that uses an enum for state. I’d like to switch to a sealed interface, to pass arguments, but I would lose the use of
    Enum.ordinal
    . Any recommendations?
    c
    5 replies · 2 participants
  • z

    Zach Klippenstein (he/him) [MOD]

    09/29/2022, 4:22 PM
    If snapshots and compose state seem like magic to you, I recently gave a talk you might be interested in. Links in 🧵
    m
    m
    +1
    33 replies · 4 participants
  • z

    zsperske

    09/29/2022, 4:33 PM
    Is there any way to use
    R.attr
    references in a Compose Preview? We use attribute references & themes for colors/drawables/text styles, however when running a preview they don’t resolve properly. This Composable fails to render a Preview.
    @Preview
    @Composable
    fun MyComposable() {
       val attrPainter = attrPainter(R.attr.myAttr) //custom painter to get a drawable from an attr reference
       Image(attrPainter, contentDescription = "some description")
    }
    m
    14 replies · 2 participants
  • m

    MikeH

    09/30/2022, 8:50 AM
    Hello 👋 We currently use espresso AccessibilityChecks to have automated accessibility testing for our android views during espresso tests. This scans for touch target size, contrast, missing content descriptions etc. Does anyone have any alternatives for compose?
    z
    1 reply · 2 participants
  • a

    Anton Krutko

    09/30/2022, 9:33 AM
    Hi folks, have faced a problem with Binder transaction. Having a Single-Activity app entirely based on Compose and utilizing compose navigation, we have many destinations and quite complex screens. Naturally users can navigate between them as they like, even making loops. E.g. user searches for an item and navigates to its details, from where it is possible to navigate to another similar item or even trigger another search, making a back stack grow very fast. The problem is that every screen has its state, which is saved in the Activity’s Bundle. While user explores the app state Bundle grows very fast beyond Binder’s transaction limit. As a consequence we have thousands of crashes. As this use case seems to me quite natural, I wonder whether you have any experience dealing with such issue. Any help or advice is highly appreciated.
  • r

    reactormonk

    09/30/2022, 11:59 AM
    I wanted to create a scrolling log - LazyColumn looks like the right container for that, but how would I scroll to the newest item whenever one is added?
    s
    1 reply · 2 participants
  • n

    nuhkoca

    09/30/2022, 1:48 PM
    Hello, I’d like to have a radial gradient that revolves a circle in clockwise infinitely. I did something with
    LinearBrush
    not
    RadialBrush
    but it is not I expect. More in thread.
    r
    3 replies · 2 participants
  • n

    Nikolas Guillen Leon

    09/30/2022, 3:35 PM
    hi guys, are you aware of any sort of issues regarding compose and xml interoperability? To be precise: I have a LazyColumn (and some other stuff) inside a ComposeView, which is inside the XML of a Fragment, which is called inside the FragmentContainerView of the Main Activity. The lazyColumn is terribly laggy. I mean, it's pretty unusable, even in release. I already specified a key and the contentType but that doesn't seem to have any effect.
    r
    6 replies · 2 participants
Powered by Linen
Title
n

Nikolas Guillen Leon

09/30/2022, 3:35 PM
hi guys, are you aware of any sort of issues regarding compose and xml interoperability? To be precise: I have a LazyColumn (and some other stuff) inside a ComposeView, which is inside the XML of a Fragment, which is called inside the FragmentContainerView of the Main Activity. The lazyColumn is terribly laggy. I mean, it's pretty unusable, even in release. I already specified a key and the contentType but that doesn't seem to have any effect.
r

Richard Z

09/30/2022, 6:43 PM
I think it’s pretty hard to tell from just what you’ve said… nothing about that setup sounds wrong. I think you may have to share source code in order for somebody to know what might be wrong. Or more details about what might be happening in your composition.
n

Nikolas Guillen Leon

09/30/2022, 7:20 PM
this is the screen with the lazy column
fun CartScreen(
    productWrappers: List<ProdottoWrapper>,
    totalCost: Float,
    onUIEvent: (UIEvent) -> Unit,
    loading: Boolean,
    alertDialog: AlertDialog?
) {

    val focusManager = LocalFocusManager.current
    val listSize = productWrappers.size.toString()

    Box(modifier = Modifier.fillMaxSize()) {

        Scaffold(
            bottomBar = {
                SendOrderBar(
                    totalCost = totalCost,
                    onSendClick = { onUIEvent(Submit) }
                )
            }
        ) { paddingValues ->
            Box(
                modifier = Modifier
                    .fillMaxSize()
                    .clickable(
                        onClick = { if (!loading) focusManager.clearFocus() },
                        indication = null,
                        interactionSource = remember {
                            MutableInteractionSource()
                        }
                    )
            ) {
                Column(
                    modifier = Modifier
                        .fillMaxSize()
                        .padding(paddingValues)
                        .padding(horizontal = 16.dp)
                ) {
                    Text(
                        text = stringResource(R.string.carrello),
                        style = MaterialTheme.typography.h5,
                        fontWeight = FontWeight.Bold
                    )
                    Spacer(modifier = Modifier.height(16.dp))
                    if (productWrappers.isNotEmpty()) {
                        Text(
                            text = listSize + stringResource(id = R.string.articoli_nel_carrello),
                            style = MaterialTheme.typography.subtitle1,
                            fontWeight = FontWeight.Medium
                        )
                        Spacer(modifier = Modifier.height(16.dp))
                        ProductsListHeader()
                        Spacer(modifier = Modifier.height(8.dp))
                        Divider()
                        LazyColumn(modifier = Modifier.fillMaxSize()) {
                            items(
                                items = productWrappers,
                                key = { productWrapper -> productWrapper.prodotto.id },
                                contentType = { productWrapper -> productWrapper }
                            ) { productWrapper ->
                                RevealSwipe(
                                    directions = setOf(RevealDirection.EndToStart),
                                    hiddenContentEnd = {
                                        Icon(
                                            imageVector = Icons.Default.Delete,
                                            contentDescription = null,
                                            tint = Color.White,
                                            modifier = Modifier.padding(horizontal = 25.dp)
                                        )
                                    },
                                    onBackgroundEndClick = { onUIEvent(Delete(productWrapper)) },
                                    backgroundCardEndColor = Color.Red,
                                    contentColor = Color.Black
                                ) {
                                    Box(
                                        modifier = Modifier
                                            .drawBehind {
                                                drawRect(Color.White)
                                            }
                                            .padding(vertical = 10.dp)
                                    ) {
                                        ProductRow(
                                            productWrapper = productWrapper,
                                            onUmChanged = { um -> onUIEvent(UmChanged(productWrapper, um)) },
                                            onAdd = { onUIEvent(Add(productWrapper)) },
                                            onRemove = { onUIEvent(Remove(productWrapper)) },
                                            onEditQuantity = { quantity -> onUIEvent(EditQuantity(productWrapper, quantity)) },
                                            onFocusRemoved = { onUIEvent(QuantityFocusOut(productWrapper)) }
                                        )
                                    }
                                }
                                Divider()
                            }
                        }
                    } else {
                        if (!loading) {
                            Box(modifier = Modifier.fillMaxSize()) {
                                Text(
                                    text = stringResource(R.string.carrello_nessun_articolo),
                                    style = MaterialTheme.typography.h5,
                                    fontWeight = FontWeight.Bold,
                                    textAlign = TextAlign.Center,
                                    modifier = Modifier.align(Alignment.Center)
                                )
                            }
                        }
                    }
                }
            }
        }
        if (alertDialog != null) {
            AlertDialog(
                onDismissRequest = { alertDialog.onDismiss?.invoke() },
                title = {
                    Text(
                        text = alertDialog.title,
                        fontWeight = FontWeight.Bold
                    )
                },
                text = { Text(text = alertDialog.msg) },
                buttons = {
                    Row(
                        horizontalArrangement = Arrangement.End,
                        modifier = Modifier
                            .fillMaxWidth()
                            .padding(horizontal = 8.dp)
                    ) {
                        if (alertDialog.onCancel != null) {
                            TextButton(onClick = alertDialog.onCancel::invoke) {
                                Text(
                                    text = stringResource(id = R.string.annulla_label),
                                    color = Color.Gray
                                )
                            }
                        }
                        if (alertDialog.onConfirm != null) {
                            TextButton(onClick = alertDialog.onConfirm::invoke) {
                                Text(
                                    text = stringResource(id = R.string.ok_label),
                                    color = Color.Gray
                                )
                            }
                        }
                    }
                }
            )
        }
        LoadingOverlay(isVisible = loading)
    }
}
this is the "product row" composable
fun ProductRow(
    productWrapper: ProdottoWrapper,
    onUmChanged: (Um) -> Unit,
    onAdd: () -> Unit,
    onRemove: () -> Unit,
    onEditQuantity: (String) -> Unit,
    onFocusRemoved: () -> Unit
) {

    val product = productWrapper.prodotto
    val um = productWrapper.um
    val price = productWrapper.prezzo
    val quantity by remember(productWrapper.quantita) {
        derivedStateOf {
            productWrapper.quantita
        }
    }
    var dropdownVisibility by remember { mutableStateOf(false) }
    var dropdownWidth by remember { mutableStateOf(Size.Zero) }

    Row(
        modifier = Modifier
            .fillMaxWidth()
            .drawBehind {
                drawRect(Color.White)
            },
        horizontalArrangement = Arrangement.SpaceEvenly,
        verticalAlignment = Alignment.CenterVertically
    ) {
        Column(
            modifier = Modifier
                .fillMaxWidth()
                .weight(3f)
        ) {
            Text(
                text = "Cod. ${product.codice}",
                fontWeight = FontWeight.Bold,
                maxLines = 1,
                overflow = TextOverflow.Visible
            )
            Text(
                text = product.descrizione,
                maxLines = 4,
                overflow = TextOverflow.Ellipsis
            )
            Text(
                text = "Prezzo unitario ${BuildConfig.VALUTA} ${
                    Formatter.formatPrezzo(
                        LocalContext.current, productWrapper.prezzo_unitario
                    )
                }/${product.um_default.descrizione}",
                fontSize = 12.sp,
                fontWeight = FontWeight.Medium,
                color = colorResource(id = R.color.os_dark_grey),
                maxLines = 1,
                overflow = TextOverflow.Visible
            )
        }
        Column(
            modifier = Modifier
                .fillMaxSize()
                .weight(1f)
                .onGloballyPositioned { layoutCoordinates ->
                    dropdownWidth = layoutCoordinates.size.toSize()
                },
            horizontalAlignment = Alignment.CenterHorizontally,
            verticalArrangement = Arrangement.Center
        ) {
            if (product.um.size > 1) {
                Card(
                    backgroundColor = Color.Transparent,
                    border = BorderStroke(1.dp, colorResource(id = R.color.medium_dark)),
                    elevation = 0.dp,
                    modifier = Modifier
                        .fillMaxWidth()
                        .height(40.dp)
                        .clickable { dropdownVisibility = true },
                ) {
                    Row(
                        horizontalArrangement = Arrangement.SpaceBetween,
                        verticalAlignment = Alignment.CenterVertically,
                        modifier = Modifier.padding(all = 5.dp)
                    ) {
                        Text(text = um.descrizione)
                        Icon(
                            imageVector = Icons.Default.KeyboardArrowDown,
                            contentDescription = ""
                        )
                    }
                }
                DropdownMenu(
                    expanded = dropdownVisibility,
                    onDismissRequest = { dropdownVisibility = false },
                    modifier = Modifier.widthIn(min = with(LocalDensity.current) { dropdownWidth.width.toDp() })
                ) {
                    product.um.forEach {
                        Row(modifier = Modifier
                            .clickable {
                                onUmChanged(it)
                                dropdownVisibility = false
                            }
                            .fillMaxWidth()
                            .padding(horizontal = 10.dp, vertical = 5.dp)) {
                            Text(text = it.descrizione, overflow = TextOverflow.Ellipsis)
                        }
                    }
                }
            } else {
                Text(text = um.descrizione, fontWeight = FontWeight.Bold)
            }

        }
        Column(
            modifier = Modifier
                .fillMaxSize()
                .weight(2f)
                .padding(horizontal = 16.dp),
            horizontalAlignment = Alignment.CenterHorizontally,
            verticalArrangement = Arrangement.Center
        ) {
            QuantitySelector(
                quantity = quantity,
                onAdd =  onAdd,
                onRemove = onRemove,
                onEditQuantity = {
                    onEditQuantity(it)
                },
                onFocusRemoved = onFocusRemoved
            )
        }
        Column(
            modifier = Modifier
                .fillMaxWidth()
                .weight(1f),
            horizontalAlignment = Alignment.CenterHorizontally,
            verticalArrangement = Arrangement.Center
        ) {
            Text(
                text = "${BuildConfig.VALUTA} ${
                    Formatter.formatPrezzo(
                        LocalContext.current,
                        price
                    )
                }",
                fontWeight = FontWeight.Bold,
                textAlign = TextAlign.End
            )
        }
    }
}
and this is the "quantity selector"
fun QuantitySelector(
    quantity: String,
    onAdd: () -> Unit,
    onRemove: () -> Unit,
    onEditQuantity: (String) -> Unit,
    onFocusRemoved: () -> Unit
) {

    val interactionSource = remember { MutableInteractionSource() }
    val focused = remember { mutableStateOf(false) }
    val focusManager = LocalFocusManager.current

    Card(
        backgroundColor = Color.Transparent,
        border = BorderStroke(1.dp, colorResource(id = R.color.medium_dark)),
        elevation = 0.dp,
        modifier = Modifier
            .wrapContentWidth()
            .height(40.dp)
    ) {
        Row(
            horizontalArrangement = Arrangement.SpaceBetween,
            verticalAlignment = Alignment.CenterVertically
        ) {
            IconButton(onClick = onRemove, modifier = Modifier.weight(1f)) {
                Icon(
                    painter = painterResource(id = R.drawable.ic_baseline_remove_24),
                    contentDescription = null,
                    tint = colorResource(id = R.color.os_dark_grey),
                    modifier = Modifier.fillMaxSize(0.7f)
                )
            }
            BasicTextField(
                value = quantity,
                onValueChange = {
                    onEditQuantity(it)
                },
                textStyle = LocalTextStyle.current.copy(textAlign = TextAlign.Center),
                singleLine = true,
                interactionSource = interactionSource,
                keyboardOptions = KeyboardOptions(
                    keyboardType = KeyboardType.Number,
                    imeAction = ImeAction.Done
                ),
                keyboardActions = KeyboardActions(onDone = {
                    onFocusRemoved()
                    focusManager.clearFocus()
                }),
                modifier = Modifier
                    .weight(2f)
                    .fillMaxWidth()
                    .onFocusChanged {
                        if (!it.isFocused && focused.value) {
                            onFocusRemoved()
                        }
                        focused.value = it.isFocused
                    }
            ) {
                TextFieldDefaults.TextFieldDecorationBox(
                    value = quantity,
                    innerTextField = it,
                    enabled = true,
                    singleLine = true,
                    visualTransformation = VisualTransformation.None,
                    interactionSource = interactionSource,
                    contentPadding = TextFieldDefaults.textFieldWithoutLabelPadding(
                        top = 0.dp,
                        bottom = 0.dp,
                        start = 0.dp,
                        end = 0.dp
                    )
                )
            }
            IconButton(onClick = onAdd, modifier = Modifier.weight(1f)) {
                Icon(
                    imageVector = Icons.Default.Add,
                    contentDescription = null,
                    tint = colorResource(id = R.color.os_dark_grey),
                    modifier = Modifier.fillMaxSize(0.7f)
                )
            }
        }
    }
}
I noticed that when I click on a button in the Quantity Selector and trigger its action, the whole QuantitySelector recomposes.
in addition, clicking on those buttons triggers the recomposition of every single ProductRow within the lazy column
View count: 2