Build Layouts with Jetpack Compose

Sep 10 2024 · Kotlin 1.9, Android 14, Android Studio Iguana | 2023.2

Lesson 04: Utilize Flow Layouts

Demo

Episode complete

Play next episode

Next

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

Open the Starter project in the 04-utilize-flow-layouts directory of the m3-ljp-materials repo in Android Studio Hedgehog or later.

private suspend fun getPublicRepositories() {
    val result = repository.getPublicRepositories().filter {
        it.description != null && it.owner.avatarUrl != null
    }.take(20)

    val requests = result.map { repo ->
        viewModelScope.async(Dispatchers.IO) {
            val languages = repository.getLanguages(repo.languagesURL).entries.take(5).associate { it.toPair() }
            repo.languages = languages
            repo        }
    }
    val updatedResult = requests.map { it.await() }

    _state.postValue(updatedResult)
}
FlowRow(
    modifier = Modifier.padding(8.dp),
    horizontalArrangement = Arrangement.spacedBy(4.dp)) {

}
repo.languages.forEach { (language, _) ->
        Chip(onClick = {}) {
            Text(text = language, textAlign = TextAlign.Start, maxLines = 1)
        }
    }
@file:OptIn(ExperimentalLayoutApi::class, ExperimentalMaterialApi::class)
See forum comments
Cinema mode Download course materials from Github
Previous: Instruction Next: Conclusion