Use dimensions in MessageDetail

This commit is contained in:
Andrew 2024-06-18 21:56:02 +09:30
parent 91f73010e0
commit 4e429b026e

View File

@ -151,12 +151,12 @@ fun MessageDetails(
Column( Column(
modifier = Modifier modifier = Modifier
.verticalScroll(rememberScrollState()) .verticalScroll(rememberScrollState())
.padding(vertical = 16.dp), .padding(vertical = LocalDimensions.current.smallItemSpacing),
verticalArrangement = Arrangement.spacedBy(16.dp) verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.smallItemSpacing)
) { ) {
state.record?.let { message -> state.record?.let { message ->
AndroidView( AndroidView(
modifier = Modifier.padding(horizontal = 32.dp), modifier = Modifier.padding(horizontal = LocalDimensions.current.margin),
factory = { factory = {
ViewVisibleMessageContentBinding.inflate(LayoutInflater.from(it)).mainContainerConstraint.apply { ViewVisibleMessageContentBinding.inflate(LayoutInflater.from(it)).mainContainerConstraint.apply {
bind( bind(
@ -192,7 +192,7 @@ fun CellMetadata(
state.apply { state.apply {
if (listOfNotNull(sent, received, error, senderInfo).isEmpty()) return if (listOfNotNull(sent, received, error, senderInfo).isEmpty()) return
CellWithPaddingAndMargin { CellWithPaddingAndMargin {
Column(verticalArrangement = Arrangement.spacedBy(16.dp)) { Column(verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.smallItemSpacing)) {
TitledText(sent) TitledText(sent)
TitledText(received) TitledText(received)
TitledErrorText(error) TitledErrorText(error)
@ -250,7 +250,7 @@ fun Carousel(attachments: List<Attachment>, onClick: (Int) -> Unit) {
val pagerState = rememberPagerState { attachments.size } val pagerState = rememberPagerState { attachments.size }
Column(verticalArrangement = Arrangement.spacedBy(16.dp)) { Column(verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.smallItemSpacing)) {
Row { Row {
CarouselPrevButton(pagerState) CarouselPrevButton(pagerState)
Box(modifier = Modifier.weight(1f)) { Box(modifier = Modifier.weight(1f)) {
@ -259,7 +259,7 @@ fun Carousel(attachments: List<Attachment>, onClick: (Int) -> Unit) {
ExpandButton( ExpandButton(
modifier = Modifier modifier = Modifier
.align(Alignment.BottomEnd) .align(Alignment.BottomEnd)
.padding(8.dp) .padding(LocalDimensions.current.xxsItemSpacing)
) { onClick(pagerState.currentPage) } ) { onClick(pagerState.currentPage) }
} }
CarouselNextButton(pagerState) CarouselNextButton(pagerState)
@ -337,10 +337,10 @@ fun PreviewMessageDetails(
fun FileDetails(fileDetails: List<TitledText>) { fun FileDetails(fileDetails: List<TitledText>) {
if (fileDetails.isEmpty()) return if (fileDetails.isEmpty()) return
CellWithPaddingAndMargin(padding = 0.dp) { Cell {
FlowRow( FlowRow(
modifier = Modifier.padding(vertical = 24.dp, horizontal = LocalDimensions.current.xsItemSpacing), modifier = Modifier.padding(horizontal = LocalDimensions.current.xsItemSpacing, vertical = LocalDimensions.current.itemSpacing),
verticalArrangement = Arrangement.spacedBy(16.dp) verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.smallItemSpacing)
) { ) {
fileDetails.forEach { fileDetails.forEach {
BoxWithConstraints { BoxWithConstraints {
@ -395,7 +395,7 @@ fun TitledText(
@Composable @Composable
fun TitledView(title: GetString, modifier: Modifier = Modifier, content: @Composable () -> Unit) { fun TitledView(title: GetString, modifier: Modifier = Modifier, content: @Composable () -> Unit) {
Column(modifier = modifier, verticalArrangement = Arrangement.spacedBy(4.dp)) { Column(modifier = modifier, verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.xxxsItemSpacing)) {
Text(title.string(), style = baseBold) Text(title.string(), style = baseBold)
content() content()
} }