mirror of
https://github.com/Myzel394/NumberHub.git
synced 2025-06-20 09:15:26 +02:00
Fix UnittoListItem size
This commit is contained in:
parent
9f864ea108
commit
93ca31a955
@ -34,6 +34,7 @@ import androidx.compose.material3.Icon
|
|||||||
import androidx.compose.material3.LocalContentColor
|
import androidx.compose.material3.LocalContentColor
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.ProvideTextStyle
|
import androidx.compose.material3.ProvideTextStyle
|
||||||
|
import androidx.compose.material3.RadioButton
|
||||||
import androidx.compose.material3.Switch
|
import androidx.compose.material3.Switch
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@ -58,8 +59,8 @@ fun UnittoListItem(
|
|||||||
Row(
|
Row(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.background(MaterialTheme.colorScheme.surface)
|
.background(MaterialTheme.colorScheme.surface)
|
||||||
.heightIn(min = 56.dp)
|
.padding(start = 16.dp, end = 24.dp)
|
||||||
.padding(top = 14.dp, bottom = 14.dp, start = 16.dp, end = 24.dp),
|
.heightIn(min = if (supportingContent == null) 56.dp else 72.dp),
|
||||||
horizontalArrangement = Arrangement.spacedBy(16.dp),
|
horizontalArrangement = Arrangement.spacedBy(16.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
@ -70,7 +71,7 @@ fun UnittoListItem(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Column(Modifier.weight(1f)) {
|
Column(Modifier.weight(1f).padding(vertical = 8.dp)) {
|
||||||
ProvideTextStyle(
|
ProvideTextStyle(
|
||||||
color = MaterialTheme.colorScheme.onSurface,
|
color = MaterialTheme.colorScheme.onSurface,
|
||||||
textStyle = MaterialTheme.typography.bodyLarge,
|
textStyle = MaterialTheme.typography.bodyLarge,
|
||||||
@ -161,42 +162,44 @@ private fun ProvideColor(
|
|||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
fun PreviewUnittoListItem1() {
|
fun PreviewUnittoListItem1() {
|
||||||
UnittoListItem(
|
Column {
|
||||||
modifier = Modifier,
|
UnittoListItem(
|
||||||
headlineContent = { Text("Headline") },
|
modifier = Modifier,
|
||||||
supportingContent = { Text("Support") },
|
headlineContent = { Text("Headline") },
|
||||||
leadingContent = {
|
supportingContent = { Text("Support") },
|
||||||
Icon(
|
leadingContent = {
|
||||||
imageVector = Icons.Default.Home,
|
Icon(
|
||||||
contentDescription = null
|
imageVector = Icons.Default.Home,
|
||||||
)
|
contentDescription = null
|
||||||
},
|
)
|
||||||
)
|
},
|
||||||
}
|
)
|
||||||
|
|
||||||
@Preview
|
UnittoListItem(
|
||||||
@Composable
|
modifier = Modifier,
|
||||||
private fun PreviewUnittoListItem2() {
|
headlineContent = { Text("Headline") },
|
||||||
UnittoListItem(
|
leadingContent = {
|
||||||
icon = Icons.Default.Home,
|
RadioButton(selected = false, onClick = {})
|
||||||
headlineText = "Text text",
|
},
|
||||||
supportingText = "Support text support text support text support text",
|
)
|
||||||
modifier = Modifier,
|
|
||||||
trailing = {},
|
|
||||||
iconDescription = ""
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Preview
|
UnittoListItem(
|
||||||
@Composable
|
icon = Icons.Default.Home,
|
||||||
private fun PreviewUnittoListItem3() {
|
headlineText = "Text text",
|
||||||
UnittoListItem(
|
supportingText = "Support text support text support text support text",
|
||||||
icon = Icons.Default.Home,
|
modifier = Modifier,
|
||||||
headlineText = "Text text",
|
trailing = {},
|
||||||
supportingText = "Support text support text support text support text",
|
iconDescription = ""
|
||||||
modifier = Modifier,
|
)
|
||||||
onSwitchChange = {},
|
|
||||||
iconDescription = "",
|
UnittoListItem(
|
||||||
switchState = true,
|
icon = Icons.Default.Home,
|
||||||
)
|
headlineText = "Text text",
|
||||||
|
supportingText = "Support text support text support text support text",
|
||||||
|
modifier = Modifier,
|
||||||
|
onSwitchChange = {},
|
||||||
|
iconDescription = "",
|
||||||
|
switchState = true,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user