mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Add support for enlarged fonts in ItemButton
This commit is contained in:
parent
4e429b026e
commit
44b2cd9e71
@ -14,7 +14,6 @@ import androidx.compose.foundation.layout.BoxScope
|
|||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.RowScope
|
import androidx.compose.foundation.layout.RowScope
|
||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.heightIn
|
import androidx.compose.foundation.layout.heightIn
|
||||||
@ -25,7 +24,6 @@ import androidx.compose.foundation.layout.wrapContentHeight
|
|||||||
import androidx.compose.foundation.layout.wrapContentSize
|
import androidx.compose.foundation.layout.wrapContentSize
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.itemsIndexed
|
import androidx.compose.foundation.lazy.itemsIndexed
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
||||||
import androidx.compose.material.ButtonColors
|
import androidx.compose.material.ButtonColors
|
||||||
import androidx.compose.material.Card
|
import androidx.compose.material.Card
|
||||||
import androidx.compose.material.CircularProgressIndicator
|
import androidx.compose.material.CircularProgressIndicator
|
||||||
@ -177,7 +175,7 @@ fun ItemButton(
|
|||||||
TextButton(
|
TextButton(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.height(60.dp),
|
.heightIn(min = 60.dp),
|
||||||
colors = colors,
|
colors = colors,
|
||||||
onClick = onClick,
|
onClick = onClick,
|
||||||
shape = RectangleShape,
|
shape = RectangleShape,
|
||||||
@ -185,18 +183,24 @@ fun ItemButton(
|
|||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.width(80.dp)
|
.width(80.dp)
|
||||||
.fillMaxHeight()
|
.height(60.dp)
|
||||||
|
.align(Alignment.CenterVertically)
|
||||||
) {
|
) {
|
||||||
icon()
|
icon()
|
||||||
}
|
}
|
||||||
Text(text, modifier = Modifier.fillMaxWidth(), style = xl)
|
Text(
|
||||||
|
text,
|
||||||
|
Modifier.fillMaxWidth()
|
||||||
|
.align(Alignment.CenterVertically),
|
||||||
|
style = xl
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun Cell(
|
fun Cell(
|
||||||
padding: Dp = 0.dp,
|
padding: Dp = 0.dp,
|
||||||
margin: Dp = 32.dp,
|
margin: Dp = LocalDimensions.current.margin,
|
||||||
content: @Composable () -> Unit
|
content: @Composable () -> Unit
|
||||||
) {
|
) {
|
||||||
CellWithPaddingAndMargin(padding, margin) { content() }
|
CellWithPaddingAndMargin(padding, margin) { content() }
|
||||||
@ -208,8 +212,8 @@ fun CellNoMargin(content: @Composable () -> Unit) {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun CellWithPaddingAndMargin(
|
fun CellWithPaddingAndMargin(
|
||||||
padding: Dp = 24.dp,
|
padding: Dp = LocalDimensions.current.smallMargin,
|
||||||
margin: Dp = 32.dp,
|
margin: Dp = LocalDimensions.current.margin,
|
||||||
content: @Composable () -> Unit
|
content: @Composable () -> Unit
|
||||||
) {
|
) {
|
||||||
Card(
|
Card(
|
||||||
@ -229,11 +233,11 @@ fun CellWithPaddingAndMargin(
|
|||||||
fun <T> TitledRadioButton(option: RadioOption<T>, onClick: () -> Unit) {
|
fun <T> TitledRadioButton(option: RadioOption<T>, onClick: () -> Unit) {
|
||||||
val color = if (option.enabled) LocalColors.current.text else LocalColors.current.disabled
|
val color = if (option.enabled) LocalColors.current.text else LocalColors.current.disabled
|
||||||
Row(
|
Row(
|
||||||
horizontalArrangement = Arrangement.spacedBy(16.dp),
|
horizontalArrangement = Arrangement.spacedBy(LocalDimensions.current.smallItemSpacing),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.runIf(option.enabled) { clickable { if (!option.selected) onClick() } }
|
.runIf(option.enabled) { clickable { if (!option.selected) onClick() } }
|
||||||
.heightIn(min = 60.dp)
|
.heightIn(min = 60.dp)
|
||||||
.padding(horizontal = 32.dp)
|
.padding(horizontal = LocalDimensions.current.margin)
|
||||||
.contentDescription(option.contentDescription)
|
.contentDescription(option.contentDescription)
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier
|
Column(modifier = Modifier
|
||||||
|
Loading…
Reference in New Issue
Block a user