Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ce2b379

Browse files
authoredFeb 23, 2023
1 parent 8c015d6 commit ce2b379

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed
 

‎compose/snippets/src/main/java/com/example/compose/snippets/phases/PhasesSnippets.kt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ private fun OptimizeStateReadsBefore() {
124124
painterResource(id = android.R.drawable.star_on),
125125
contentDescription = null,
126126
// [END_EXCLUDE]
127-
// ..
128127
// Non-optimal implementation!
129128
Modifier.offset(
130129
with(LocalDensity.current) {
@@ -134,10 +133,10 @@ private fun OptimizeStateReadsBefore() {
134133
)
135134
)
136135

137-
LazyColumn(state = listState)
138-
// [START_EXCLUDE]
139-
{}
140-
// [END_EXCLUDE]
136+
LazyColumn(state = listState) {
137+
// [START_EXCLUDE]
138+
// [END_EXCLUDE]
139+
}
141140
}
142141
// [END android_compose_phases_optimize_state_reads_before]
143142
}
@@ -153,18 +152,17 @@ private fun OptimizeStateReadsAfter() {
153152
painterResource(id = android.R.drawable.star_on),
154153
contentDescription = null,
155154
// [END_EXCLUDE]
156-
// ..
157155
// Non-optimal implementation!
158156
Modifier.offset {
159157
// State read of firstVisibleItemScrollOffset in Layout
160158
IntOffset(x = 0, y = listState.firstVisibleItemScrollOffset / 2)
161159
}
162160
)
163161

164-
LazyColumn(state = listState)
165-
// [START_EXCLUDE]
166-
{}
167-
// [END_EXCLUDE]
162+
LazyColumn(state = listState) {
163+
// [START_EXCLUDE]
164+
// [END_EXCLUDE]
165+
}
168166
}
169167
// [END android_compose_phases_optimize_state_reads_after]
170168
}

0 commit comments

Comments
 (0)
Failed to load comments.