Fix priority button spacing

pull/2068/head
Alex Baker 2 years ago
parent 9787a420d9
commit 71b70c43b2

@ -3,11 +3,9 @@ package org.tasks.compose.edit
import android.content.res.Configuration import android.content.res.Configuration
import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.material.MaterialTheme import androidx.compose.material.*
import androidx.compose.material.RadioButton
import androidx.compose.material.RadioButtonDefaults
import androidx.compose.material.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
@ -51,30 +49,32 @@ fun Priority(
.fillMaxWidth() .fillMaxWidth()
.wrapContentHeight() .wrapContentHeight()
.padding( .padding(
top = dimensionResource(id = R.dimen.half_keyline_first), end = dimensionResource(id = R.dimen.keyline_first)
bottom = dimensionResource(id = R.dimen.half_keyline_first),
end = 16.dp
), ),
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
Text( Text(
text = stringResource(id = R.string.TEA_importance_label), text = stringResource(id = R.string.TEA_importance_label),
style = MaterialTheme.typography.body1, style = MaterialTheme.typography.body1,
modifier = Modifier.padding(end = 16.dp)
) )
Spacer(modifier = Modifier.weight(1f)) Spacer(modifier = Modifier.weight(1f))
for (i in Task.Priority.HIGH..Task.Priority.NONE) { Row(horizontalArrangement = Arrangement.SpaceBetween) {
PriorityButton( for (i in Task.Priority.HIGH..Task.Priority.NONE) {
priority = i, PriorityButton(
selected = selected, priority = i,
onClick = onClick, selected = selected,
desaturate = desaturate, onClick = onClick,
) desaturate = desaturate,
)
}
} }
} }
} }
@OptIn(ExperimentalMaterialApi::class)
@Composable @Composable
fun PriorityButton( fun RowScope.PriorityButton(
@Task.Priority priority: Int, @Task.Priority priority: Int,
selected: Int, selected: Int,
desaturate: Boolean, desaturate: Boolean,
@ -87,14 +87,21 @@ fun PriorityButton(
desaturate = desaturate, desaturate = desaturate,
) )
) )
RadioButton( CompositionLocalProvider(
selected = priority == selected, LocalMinimumTouchTargetEnforcement provides false,
onClick = { onClick(priority) }, ) {
colors = RadioButtonDefaults.colors( RadioButton(
selectedColor = color, selected = priority == selected,
unselectedColor = color, onClick = { onClick(priority) },
), colors = RadioButtonDefaults.colors(
) selectedColor = color,
unselectedColor = color,
),
modifier = Modifier
.weight(1f)
.padding(vertical = 20.dp)
)
}
} }
@ExperimentalComposeUiApi @ExperimentalComposeUiApi

Loading…
Cancel
Save