https://kotlinlang.org logo
#compose
Title
# compose
b

Bino

08/03/2022, 1:39 PM
I’m trying to create a custom layout, where children are placed in a new line if the odd space isn’t enough. Its a similar approach like the FlowRow in accompanist. https://gist.github.com/thebino/2d7385d5b3e51c036fa1873bac7b7ac7
c

Colton Idle

08/03/2022, 3:39 PM
Is there a question here?
or am i missing something? 😅
b

Bino

08/03/2022, 3:45 PM
Yes, sorry. When using the open posted code in the gist. An error occured, saying the node was already placed. Chip 6 and others should be placed in a 2nd, 3rd or further rows instead of right.
c

Colton Idle

08/03/2022, 3:50 PM
does the accompanist code not work for you? or are you trying to write your own just for practice?
b

Bino

08/03/2022, 3:51 PM
both 😸
c

Colton Idle

08/03/2022, 3:52 PM
Hm. I def have used flowRow and it 100% works as expected. let me dig up what im doing exactly.
Copy code
Column(Modifier.fillMaxSize().padding(horizontal = 16.dp)) {
    FlowRow(mainAxisSpacing = 8.dp, crossAxisSpacing = 8.dp) {
      allTags?.forEach {
        TextChip(
            text = it?.title!!,
            modifier =
                Modifier.clip(CircleShape)
                    .clickable { ... }
                    .padding(horizontal = 16.dp, vertical = 8.dp))
      }
    }
  }
3 Views