Skip to content
Snippets Groups Projects
Verified Commit 9472cffb authored by Mikolai Gütschow's avatar Mikolai Gütschow
Browse files

remember list in ThreadItemView preview

parent 6f0708dc
Branches
No related tags found
No related merge requests found
Pipeline #13331 passed
......@@ -34,11 +34,13 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.selection.selectable
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment.Companion.Center
import androidx.compose.ui.Alignment.Companion.CenterVertically
import androidx.compose.ui.Modifier
......@@ -67,14 +69,19 @@ import kotlin.random.Random
@Suppress("HardCodedStringLiteral")
fun main() = preview {
LazyColumn {
for (i in 1..5) {
item {
ThreadItemView(
item = ForumPostItem(
val list = remember {
(0..8).map { i ->
ForumPostItem(
h = getRandomForumPostHeader(),
text = getRandomString(Random.nextInt(1, 1337)),
).apply { setLevel(Random.nextInt(0, 6)) },
).apply { setLevel(i % 7) }
}
}
LazyColumn {
items(list) { item ->
ThreadItemView(
item = item,
maxNestingLevel = 3,
selectedPost = null,
onPostSelected = {},
......@@ -82,7 +89,6 @@ fun main() = preview {
}
}
}
}
@Composable
fun ThreadItemView(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment