From 056b1a92267cc80646a7515262a9adddca2a36d8 Mon Sep 17 00:00:00 2001 From: Sebastiano Poggi Date: Wed, 14 Feb 2024 15:37:18 +0100 Subject: [PATCH] Improve Markdown readme sample --- markdown/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/markdown/README.md b/markdown/README.md index a6add7cf1..4f5b3800f 100644 --- a/markdown/README.md +++ b/markdown/README.md @@ -65,17 +65,18 @@ The second pass is done in the composition, and essentially renders a series of @Composable fun Markdown(blocks: List) { val isDark = JewelTheme.isDark + val markdownStyling = + remember(isDark) { if (isDark) MarkdownStyling.dark() else MarkdownStyling.light() } val blockRenderer = remember(markdownStyling, isDark) { if (isDark) MarkdownBlockRenderer.dark() else MarkdownBlockRenderer.light() } - val scrollState = rememberScrollState() SelectionContainer(Modifier.fillMaxSize()) { Column( - state = scrollState, + modifier = Modifier.verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(markdownStyling.blockVerticalSpacing), ) { - items(markdownBlocks) { blockRenderer.render(it) } + blockRenderer.render(blocks) } } }