Skip to content

Commit 35a1c9f

Browse files
committed
chore: simplify code examples to remove Modifiers
1 parent f1f26b2 commit 35a1c9f

1 file changed

Lines changed: 4 additions & 16 deletions

File tree

README.md

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,7 @@ sourceSets {
6767
To display styled HTML in a Text composable:
6868

6969
```kotlin
70-
Text(
71-
text = remember(html) { htmlToAnnotatedString(html) },
72-
modifier = Modifier.fillMaxWidth()
73-
)
70+
Text(text = remember(html) { htmlToAnnotatedString(html) })
7471
```
7572

7673
> If called from inside a `@Composable` function, in most cases it is recommended to use `remember()` to cache the result of the conversion, to avoid recomputation on each recomposition.
@@ -105,10 +102,7 @@ val convertedText = remember(html, linkColor) {
105102
)
106103
)
107104
}
108-
Text(
109-
text = convertedText,
110-
modifier = Modifier.fillMaxWidth()
111-
)
105+
Text(text = convertedText)
112106
```
113107

114108
### Colored text
@@ -122,10 +116,7 @@ val convertedText = remember(html) {
122116
style = HtmlStyle(isTextColorEnabled = true)
123117
)
124118
}
125-
Text(
126-
text = convertedText,
127-
maxLines = 3
128-
)
119+
Text(text = convertedText)
129120
```
130121

131122
- Text coloring is available for supported HTML **inline** tags only, through the CSS `"style"` attribute: `span`, `strong`, `b`, `em`, `cite`, `dfn`, `i`, `big`, `small`, `tt`, `code`, `a`, `u`, `del`, `s`, `strike`, `sup`, `sub`.
@@ -157,10 +148,7 @@ val convertedText = remember(html) {
157148
}
158149
)
159150
}
160-
Text(
161-
text = convertedText,
162-
modifier = Modifier.fillMaxWidth()
163-
)
151+
Text(text = convertedText)
164152
```
165153

166154
### Bug when showing hyperlinks in combination with maxLines in Compose 1.7

0 commit comments

Comments
 (0)