mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 08:17:04 +05:30
refactor(common): move Material3RichText
initialization higher up
This commit is contained in:
parent
8e7a625750
commit
e483ceea5f
2 changed files with 12 additions and 3 deletions
|
@ -7,6 +7,7 @@ import androidx.compose.material3.lightColorScheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.runtime.ProvidedValue
|
import androidx.compose.runtime.ProvidedValue
|
||||||
|
import com.halilibo.richtext.ui.material3.SetupMaterial3RichText
|
||||||
|
|
||||||
val LightThemeColors =
|
val LightThemeColors =
|
||||||
lightColorScheme(
|
lightColorScheme(
|
||||||
|
@ -73,6 +74,8 @@ fun LobstersTheme(
|
||||||
content: @Composable () -> Unit,
|
content: @Composable () -> Unit,
|
||||||
) {
|
) {
|
||||||
CompositionLocalProvider(*providedValues) {
|
CompositionLocalProvider(*providedValues) {
|
||||||
MaterialTheme(colorScheme = colorScheme, typography = AppTypography, content = content)
|
MaterialTheme(colorScheme = colorScheme, typography = AppTypography) {
|
||||||
|
SetupMaterial3RichText { content() }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,8 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import com.halilibo.richtext.markdown.Markdown
|
import com.halilibo.richtext.markdown.Markdown
|
||||||
import com.halilibo.richtext.ui.material3.Material3RichText
|
import com.halilibo.richtext.ui.RichText
|
||||||
|
import com.halilibo.richtext.ui.RichTextStyle
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ThemedRichText(
|
fun ThemedRichText(
|
||||||
|
@ -18,6 +19,11 @@ fun ThemedRichText(
|
||||||
LocalTextStyle provides MaterialTheme.typography.bodyLarge,
|
LocalTextStyle provides MaterialTheme.typography.bodyLarge,
|
||||||
LocalContentColor provides MaterialTheme.colorScheme.onBackground,
|
LocalContentColor provides MaterialTheme.colorScheme.onBackground,
|
||||||
) {
|
) {
|
||||||
Material3RichText(modifier) { Markdown(text) }
|
RichText(
|
||||||
|
modifier = modifier,
|
||||||
|
style = RichTextStyle.Default,
|
||||||
|
) {
|
||||||
|
Markdown(text)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue