mirror of
https://github.com/greenart7c3/Amber.git
synced 2026-10-05 19:08:23 +00:00
Replace Column+verticalScroll with LazyColumn for request cards
With Column, all N request cards are composed simultaneously regardless of visibility. With LazyColumn, only visible cards (~5-10) are in the composition tree, so select/deselect all only recomposes visible items instead of every item in the list. https://claude.ai/code/session_01PRSKjmFms1Tj1QJ5FhfqZm
This commit is contained in:
+5
-7
@@ -9,8 +9,8 @@ import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.Card
|
||||
import androidx.compose.material3.CardDefaults
|
||||
@@ -146,12 +146,10 @@ fun BunkerMultiEventHomeScreen(
|
||||
Text(stringResource(R.string.select_deselect_all))
|
||||
}
|
||||
|
||||
Column(
|
||||
Modifier
|
||||
.weight(1f)
|
||||
.verticalScroll(rememberScrollState()),
|
||||
LazyColumn(
|
||||
Modifier.weight(1f),
|
||||
) {
|
||||
bunkerRequests.forEach { bunkerRequest ->
|
||||
items(bunkerRequests, key = { it.request.id }) { bunkerRequest ->
|
||||
BunkerRequestCard(
|
||||
context = context,
|
||||
bunkerRequest = bunkerRequest,
|
||||
|
||||
+5
-7
@@ -11,8 +11,8 @@ import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.Card
|
||||
import androidx.compose.material3.CardDefaults
|
||||
@@ -154,12 +154,10 @@ fun IntentMultiEventHomeScreen(
|
||||
Text(stringResource(R.string.select_deselect_all))
|
||||
}
|
||||
|
||||
Column(
|
||||
Modifier
|
||||
.weight(1f)
|
||||
.verticalScroll(rememberScrollState()),
|
||||
LazyColumn(
|
||||
Modifier.weight(1f),
|
||||
) {
|
||||
intents.forEach { intent ->
|
||||
items(intents, key = { it.id }) { intent ->
|
||||
IntentRequestCard(
|
||||
context = context,
|
||||
intent = intent,
|
||||
|
||||
Reference in New Issue
Block a user