Thread
#compose
    a

    allan.conda

    1 year ago
    Does the LazyItemScope work like a Column? It seems so. Wondering if I need to wrap content of item in a Column or call
    item{}
    multiple times, since it says
    Adds a single item to the scope.
    in the doc.
    LazyColumn {
       item { Text("Title") }
       item { Header() }
       items(items) { ... }
    }
    // or
    LazyColumn {
       item {
          Text("Title)
          Header()
       } 
       items { ... } 
    }
    Ok seems I’m not able to align the items, so I probably have to wrap the components in a Column
    Andrey Kulikov

    Andrey Kulikov

    1 year ago
    there is a
    horizontalAlignment
    alignment on
    LazyColumn
    . but it will be applied for all the items. if you define your title and the header with two separate item calls it will work a bit more efficient as once you will scroll up so the header is visible it will only need to create a Header for displaying, not both title and header. but you can put both of them in the same
    item
    , it also works
    a

    allan.conda

    1 year ago
    Ahhh, it makes sense having multiple item{} is actually more efficient than a single one. For some reason I thought that would be less performant. Thanks! For centering a single item though, not sure if I need to wrap it in a Column now to be able to align it. I’m just trying to center an inline CircularProgressIndicator
    item {
        Column(Modifier.fillMaxSize()) {
            CircularProgressIndicator(modifier = Modifier.align(Alignment.CenterHorizontally))
        }
    }
    I guess a Box would work as well