Skip to content

Commit

Permalink
perf: PlaylistPage use LazyColumn to wrap music item
Browse files Browse the repository at this point in the history
  • Loading branch information
hpp2334 committed Dec 2, 2024
1 parent 2003a42 commit cacb0d8
Showing 1 changed file with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
Expand Down Expand Up @@ -400,13 +402,16 @@ private fun PlaylistItemsBlock(
mutableStateOf<MusicId?>(null)
}

Column(
LazyColumn(
modifier = Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState())
.padding(0.dp)
) {
Box(modifier = Modifier.height(48.dp))
for (item in items) {
item {
Box(modifier = Modifier.height(48.dp))
}
items(items) {
val item = it;
val playing = item.id == currentMusicState.id

key(item.id) {
Expand All @@ -424,10 +429,12 @@ private fun PlaylistItemsBlock(
)
}
}
BottomBarSpacer(
hasCurrentMusic = currentMusicState.id != null,
scaffoldPadding = scaffoldPadding,
)
item {
BottomBarSpacer(
hasCurrentMusic = currentMusicState.id != null,
scaffoldPadding = scaffoldPadding,
)
}
}
}

Expand Down

0 comments on commit cacb0d8

Please sign in to comment.