Coverage Summary for Class: MainScreenKt (com.javiersc.samples.features.main)
Class |
Method, %
|
Branch, %
|
Line, %
|
Instruction, %
|
MainScreenKt |
0%
(0/2)
|
0%
(0/22)
|
0%
(0/7)
|
0%
(0/146)
|
MainScreenKt$Character$1 |
|
MainScreenKt$MainScreen$1 |
0%
(0/1)
|
|
0%
(0/1)
|
MainScreenKt$MainScreen$2 |
0%
(0/1)
|
0%
(0/10)
|
0%
(0/4)
|
0%
(0/67)
|
MainScreenKt$MainScreen$2$1 |
0%
(0/1)
|
|
0%
(0/2)
|
0%
(0/23)
|
MainScreenKt$MainScreen$2$1$1 |
0%
(0/1)
|
0%
(0/8)
|
0%
(0/3)
|
0%
(0/51)
|
MainScreenKt$MainScreen$2$1$1$1$1 |
0%
(0/1)
|
|
0%
(0/5)
|
0%
(0/24)
|
MainScreenKt$MainScreen$2$1$invoke$$inlined$items$default$1 |
|
MainScreenKt$MainScreen$2$1$invoke$$inlined$items$default$2 |
|
MainScreenKt$MainScreen$2$1$invoke$$inlined$items$default$3 |
|
MainScreenKt$MainScreen$2$1$invoke$$inlined$items$default$4 |
|
MainScreenKt$MainScreen$3 |
|
Total |
0%
(0/7)
|
0%
(0/40)
|
0%
(0/22)
|
0%
(0/311)
|
package com.javiersc.samples.features.main
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.Button
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.javiersc.samples.strategies.characters.Character
import java.util.*
@Composable
fun MainScreen(
state: MainState,
onAddCharacter: (Character) -> Unit = {},
) {
Scaffold(
topBar = {
TopAppBar(
title = { Text(text = "Characters") },
)
},
content = {
if (state.isLoading) CircularProgressIndicator()
LazyColumn(
modifier = Modifier.padding(it).padding(16.dp),
content = {
item {
Button(
onClick = {
val uuid = UUID.randomUUID().toString()
onAddCharacter(
Character(
id = uuid,
name = "Foo + ${uuid.take(7)}",
),
)
},
content = { Text(text = "Add") },
)
}
items(state.characters) { character ->
Character(
name = character.name,
)
}
}
)
}
)
}
@Composable
fun Character(name: String) {
Text(name)
}