• g

    Gabriel

    1 year ago
    If I have a Row, with background colour and rounded corners, when I have achild in that row with a different background colour how can I make it fit the rounded corners of the parent without also needing to tell it about rounded corners?
    g
    TheMrCodes
    2 replies
    Copy to Clipboard
  • Spikey Sanju

    Spikey Sanju

    1 year ago
    Hi guys, how to send data class as an arguments instead of each type in the data class? P.S -> I'm having list of items in home screen when onClick I need to pass the data as a class!
    Spikey Sanju
    Arkadii Ivanov
    +2
    11 replies
    Copy to Clipboard
  • m

    Malte Heitmüller

    1 year ago
    Hey guys, what do you think is the best way to implement a vertical grid with items that could fit full width and half width (so sometimes there is empty space in a column)?
    m
    1 replies
    Copy to Clipboard
  • Sergey Y.

    Sergey Y.

    1 year ago
    Hi, on the android show talked about the experimental api for multithreaded composition. Is it available in beta1? does it need to be turned on somehow? because apparently all my composition functions are always called from the main thread. Thanks.
    Sergey Y.
    Adriano Celentano
    2 replies
    Copy to Clipboard
  • natario1

    natario1

    1 year ago
    Is it possible to nest a LazyColumn in a scrollable Column? Like a RecyclerView with
    height="wrap_content"
    .
    natario1
    Dominaezzz
    +1
    12 replies
    Copy to Clipboard
  • r

    robnik

    1 year ago
    What is the difference between
    rememberSavable
    and
    savedInstanceState
    . Both are mentioned in https://developer.android.com/jetpack/compose/state. They look like they do the same thing.
    r
    Dominaezzz
    3 replies
    Copy to Clipboard
  • A. Sachdeva

    A. Sachdeva

    1 year ago
    Hi, I was trying to create notes app like screen and ran into some bugs and crashes, probably due to my implementation. below file contains the code. • My ui would  consists of a list of notes, each note consisting of text, a button to edit(that will just change notes text directly on click) , a button to delete  and an overall toast on item click. • so from what i know, for this  i would need an item ui composable, a list ui composable , a state controller composable(state hoisting i guess?) and finally setting all of this to setContentView, right? • so i did all this .the  list was showing correctly. I was also using
    SnapshotStateList
    directly for learning purposes instead of using
    mutableStatelistof.
    But:1. the  on click log and delete action seems to work, but when done too quickly, started giving index out of bounds. is it because of my implementation? 2. my main goal was to show a toast on item click, but could not access 
    LocalContext.current
     , so had to test with logs. how to get context? 3. onEdit was not working immediately, but would show effect after scrolling. if it was recycler view, i would say a classic problem of adapter not reflecting latest changes due to lack of notifydatasetchanged call. so again, what did i missed?
    A. Sachdeva
    j
    4 replies
    Copy to Clipboard
  • g

    Gabriel

    1 year ago
    I have a composable that represents a screen, with a list of items, a fab to add new items, edit buttons, delete buttons, so like 6 things I'm passing into this screen from the viewmodel
    g
    Adam Powell
    5 replies
    Copy to Clipboard
  • Tash

    Tash

    1 year ago
    Using the Pager in Jetcaster and trying to introduce a draggable component in one of the Pages of the Pager. What’s the best way to make the draggable component in the Page completely consume the pointer events so that the parent Pager doesn’t react to them?
    Tash
    1 replies
    Copy to Clipboard
  • d

    Daniel

    1 year ago
    Hi, I have a composable that takes one heavy parameter that should never change and one lightweight parameter that should change a lot. I initially wrote it like this
    @Composable
    private fun Page(page: PageRenderer /* @Immutable data class, never changes */, turn: Dp = 0.dp /* changes frequently in animations */) {
        Surface(
            Modifier
                .fillMaxSize()
                .background(page.background)
                .offset {
                    IntOffset(
                        -turn
                            .toPx()
                            .roundToInt(), 0
                    )
                }
                .drawWithCache {
                    onDrawWithContent {
                        drawContent()
                        drawIntoCanvas {
                            Timber.i("Drawing into canvas")
                            page.paint(it)
                        }
                    }
                },
            elevation = 15.dp
        ) {}
    }
    Based on my logs, I noticed that
    drawIntoCanvas
    was called every time
    turn
    changed, which I was very surprised by. (I thought the whole point of offset taking a lambda would prevent that) I fixed the issue by adding another component, but I'm confused by why this was necessary
    @Composable
    private fun Page(page: PageRenderer, turn: Dp = 0.dp) {
        Surface(
            Modifier
                .fillMaxSize()
                .background(page.background)
                .offset {
                    IntOffset(
                        -turn
                            .toPx()
                            .roundToInt(), 0
                    )
                },
            elevation = 15.dp
        ) {
            Canvas(Modifier.fillMaxSize()) {
                drawIntoCanvas {
                    Timber.i("Drawing into canvas")
                    page.paint(it)
                }
            }
        }
    d
    1 replies
    Copy to Clipboard