Fix ItemButton TextStyle

This commit is contained in:
Andrew 2024-06-26 12:44:56 +09:30
parent 5294cd45a0
commit 40c08143f3

View File

@ -52,6 +52,7 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.contentDescription import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.viewinterop.AndroidView import androidx.compose.ui.viewinterop.AndroidView
@ -116,7 +117,7 @@ fun LargeItemButtonWithDrawable(
colors: ButtonColors = transparentButtonColors(), colors: ButtonColors = transparentButtonColors(),
onClick: () -> Unit onClick: () -> Unit
) { ) {
ItemButtonWithDrawable(textId, icon, modifier.heightIn(min = LocalDimensions.current.minLargeItemButtonHeight), colors, onClick) ItemButtonWithDrawable(textId, icon, modifier.heightIn(min = LocalDimensions.current.minLargeItemButtonHeight), h8, colors, onClick)
} }
@Composable @Composable
@ -124,6 +125,7 @@ fun ItemButtonWithDrawable(
@StringRes textId: Int, @StringRes textId: Int,
@DrawableRes icon: Int, @DrawableRes icon: Int,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
textStyle: TextStyle = xl,
colors: ButtonColors = transparentButtonColors(), colors: ButtonColors = transparentButtonColors(),
onClick: () -> Unit onClick: () -> Unit
) { ) {
@ -139,6 +141,7 @@ fun ItemButtonWithDrawable(
modifier = Modifier.align(Alignment.Center) modifier = Modifier.align(Alignment.Center)
) )
}, },
textStyle = textStyle,
colors = colors, colors = colors,
onClick = onClick onClick = onClick
) )
@ -152,7 +155,7 @@ fun LargeItemButton(
colors: ButtonColors = transparentButtonColors(), colors: ButtonColors = transparentButtonColors(),
onClick: () -> Unit onClick: () -> Unit
) { ) {
ItemButton(textId, icon, modifier.heightIn(min = LocalDimensions.current.minLargeItemButtonHeight), colors, onClick) ItemButton(textId, icon, modifier.heightIn(min = LocalDimensions.current.minLargeItemButtonHeight), h8, colors, onClick)
} }
/** /**
@ -163,6 +166,7 @@ fun ItemButton(
@StringRes textId: Int, @StringRes textId: Int,
@DrawableRes icon: Int, @DrawableRes icon: Int,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
textStyle: TextStyle = xl,
colors: ButtonColors = transparentButtonColors(), colors: ButtonColors = transparentButtonColors(),
onClick: () -> Unit onClick: () -> Unit
) { ) {
@ -176,6 +180,7 @@ fun ItemButton(
modifier = Modifier.align(Alignment.Center) modifier = Modifier.align(Alignment.Center)
) )
}, },
textStyle = textStyle,
colors = colors, colors = colors,
onClick = onClick onClick = onClick
) )
@ -191,6 +196,7 @@ fun ItemButton(
text: String, text: String,
icon: @Composable BoxScope.() -> Unit, icon: @Composable BoxScope.() -> Unit,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
textStyle: TextStyle = xl,
colors: ButtonColors = transparentButtonColors(), colors: ButtonColors = transparentButtonColors(),
onClick: () -> Unit onClick: () -> Unit
) { ) {
@ -214,7 +220,7 @@ fun ItemButton(
.fillMaxWidth() .fillMaxWidth()
.padding(vertical = LocalDimensions.current.xsItemSpacing) .padding(vertical = LocalDimensions.current.xsItemSpacing)
.align(Alignment.CenterVertically), .align(Alignment.CenterVertically),
style = xl style = textStyle
) )
} }
} }