File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
compose/snippets/src/main/java/com/example/compose/snippets/mentalmodel Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import androidx.compose.foundation.layout.Row
2525import androidx.compose.foundation.lazy.LazyColumn
2626import androidx.compose.foundation.lazy.items
2727import androidx.compose.material3.Button
28+ import androidx.compose.material3.Card
2829import androidx.compose.material3.Checkbox
2930import androidx.compose.material3.HorizontalDivider
3031import androidx.compose.material3.MaterialTheme
@@ -108,15 +109,16 @@ fun ListComposable(myList: List<String>) {
108109
109110// [START android_compose_thinking_in_compose_incorrect]
110111@Composable
111- @Deprecated(" Example with bug" )
112112fun ListWithBug (myList : List <String >) {
113113 var items = 0
114114
115115 Row (horizontalArrangement = Arrangement .SpaceBetween ) {
116116 Column {
117117 for (item in myList) {
118- Text (" Item: $item " )
119- items++ // Avoid! Side-effect of the column recomposing.
118+ Card {
119+ Text (" Item: $item " )
120+ items++ // Avoid! Side-effect of the column recomposing.
121+ }
120122 }
121123 }
122124 Text (" Count: $items " )
You can’t perform that action at this time.
0 commit comments