• c

    Christoph

    1 year ago
    I'm struggling with the use-case of configuring childs of a composable (
    TopAppBar
    ) conditionally. I want to set a
    navigationIcon
    depending on a condition. but doing
    navigationIcon = {
                if (showBackArrow) {
                    IconButton(onClick = onBackClick) {
                        Icon(Icons.Default.ArrowBack)
                    }
                }
            }
    this results in a "empty" composable set to the app bar and therefore the title is inset. what's the best approach here?
    c
    Zach Klippenstein (he/him) [MOD]
    +1
    12 replies
    Copy to Clipboard
  • Dominaezzz

    Dominaezzz

    1 year ago
    Is there much difference between
    SnapshotStateList<T>
    and
    MutableState<List<T>>
    ? In particular, is there any difference in the granularity of how mutations trigger recomposition? (Like in a
    LazyColumnFor
    )
    Dominaezzz
    Adam Powell
    +1
    8 replies
    Copy to Clipboard
  • Cyril Find

    Cyril Find

    1 year ago
    Hi, I'm using ExoPlayer and paging-compose in a LazyColumn to display a scrollable list of Posts with videos clips with various sizes fetched from the backend I tried a lot of things but I can't get it to scroll smoothly and don't understand why Does anyone know how to do this / have tips / code examples ? Thanks a lot 🙏
    Cyril Find
    3 replies
    Copy to Clipboard
  • Luis Daivid

    Luis Daivid

    1 year ago
    Image is shown using Lazy Column For. It is natural when you scroll down, but when you scroll up again, the entire image is rendered instantaneously instead of showing a new image from the bottom, making the scroll unnatural. How can I fix the image size to the original image width and height? If I do Modifier.size(100.dp), it works naturally.
    Luis Daivid
    a
    2 replies
    Copy to Clipboard
  • Luis Daivid

    Luis Daivid

    1 year ago
    here is my code
    @Composable
    fun ImageItem(image: ImageModel, onClickImage: (ImageModel) -> Unit) {
        Surface(modifier = Modifier.clickable(onClick = { onClickImage(image) })) {
            Column {
                Box(
                ) {
                    GlideImage(
                        imageModel = image.imagePath.toUri(),
                        requestOptions = RequestOptions()
                            .override(500, 500)
                            .diskCacheStrategy(DiskCacheStrategy.ALL)
                    )
                }
                Text(text = image.name)
            }
        }
    }
    Luis Daivid
    Andrey Kulikov
    5 replies
    Copy to Clipboard
  • k

    Kshitij Patil

    1 year ago
    Is it possible to set
    maxLines=1
    for a
    TextField
    in compose 'alpha06' ?
    k
    a
    5 replies
    Copy to Clipboard
  • a

    allan.conda

    1 year ago
    Seems savedInstanceState, and rememberLazyListState stopped working on alpha07.
    a
    1 replies
    Copy to Clipboard
  • r

    Rosen Dimov

    1 year ago
    Hi everybody, I'm trying to create a "Chat bubble" composable, basically a
    Text
    with vector image as a background. With the XML approach I just had to set padding of
    TextView
    and its background (there I could use gradient drawable as well). But now it seems a bit more work is involved. I tried creating a custom layout with
    Layout
    (having
    Text
    and
    Image
    as its children, positioned on top of each other). Then I measured the text and set its measures to the image behind it + some padding for the bubble. Looking at the preview, the measures/placement are correct. But the image doesn't stretch horizontally (vertical stretch is ok, on the screenshot you can see the blue border - that's the image composable's rectangle, but the image inside it is not stretched). The image I'm using is SVG converted to vector drawable. I tried setting
    ContentScale.FillWidth
    (it gets stretched, but it's distorted) and
    Modifier.fillMaxWidth()
    (did nothing) on the image. The
    Layout
    itself has
    fillMaxWidth
    set. Any ideas how to fix it, or maybe there's a better approach?
    r
    gildor
    3 replies
    Copy to Clipboard
  • c

    ciscorucinski

    1 year ago
    Is it correct in saying that the current alpha version of Compose suffers from where you put certain code, even though it shouldn't? Take a look at
    padding(...)
    . This works with padding towards the end.
    Image(
                    modifier = Modifier
                        .width(70.dp).height(70.dp)
                        .border(
                            border = BorderStroke(2.dp, color = Color.White),
                            shape = CircleShape)
                        .clip(shape = CircleShape)
                        .padding(8.dp),  // * * HERE near bottom - works * * //
                    asset = Icons.Filled.Person,
                    colorFilter = ColorFilter.tint(color = Color.White)
                )
    However, move it towards the top, and no padding is added at all.
    Image(
                    modifier = Modifier
                        .width(70.dp).height(70.dp)
                        .padding(8.dp)  // * * HERE near top - fails * * //
                        .border(
                            border = BorderStroke(2.dp, color = Color.White),
                            shape = CircleShape)
                        .clip(shape = CircleShape),
                    asset = Icons.Filled.Person,
                    colorFilter = ColorFilter.tint(color = Color.White)
                )
    c
    j
    5 replies
    Copy to Clipboard
  • a

    Ashwani Singh

    1 year ago
    Hi All, I want to create a bottom tab bar which have have some offset from bottom like in attached image. I tried to create bottom bar using below code
    Scaffold(
        bottomBar = {
            //  Bottom bar code
        },
    )
    But bottom Bar render in bottom, with any offset from bottom or transparent margin. Is there any way/sample?
    a
    Timo Drick
    19 replies
    Copy to Clipboard