Clipping content

This commit is contained in:
ThomasSession 2024-08-22 22:26:13 +10:00
parent 4dd84331de
commit 356b105b98
2 changed files with 8 additions and 2 deletions

View File

@ -30,6 +30,7 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.verticalScroll import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface import androidx.compose.material3.Surface
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
@ -37,6 +38,7 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
@ -284,7 +286,10 @@ private fun CarouselPager(
attachments: List<Attachment>, attachments: List<Attachment>,
onClick: (Int) -> Unit onClick: (Int) -> Unit
) { ) {
Cell { Cell(
modifier = Modifier
.clip(MaterialTheme.shapes.small)
) {
HorizontalPager(state = pagerState) { i -> HorizontalPager(state = pagerState) { i ->
GlideImage( GlideImage(
contentScale = ContentScale.Crop, contentScale = ContentScale.Crop,

View File

@ -258,12 +258,13 @@ fun PrewviewItemButton() {
@Composable @Composable
fun Cell( fun Cell(
modifier: Modifier = Modifier,
padding: PaddingValues = PaddingValues(all = 0.dp), padding: PaddingValues = PaddingValues(all = 0.dp),
margin: PaddingValues = PaddingValues(all = 0.dp), margin: PaddingValues = PaddingValues(all = 0.dp),
content: @Composable () -> Unit content: @Composable () -> Unit
) { ) {
Box( Box(
modifier = Modifier modifier = modifier
.padding(margin) .padding(margin)
.background( .background(
color = LocalColors.current.backgroundSecondary, color = LocalColors.current.backgroundSecondary,