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,17 +49,17 @@ 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))
Row(horizontalArrangement = Arrangement.SpaceBetween) {
for (i in Task.Priority.HIGH..Task.Priority.NONE) { for (i in Task.Priority.HIGH..Task.Priority.NONE) {
PriorityButton( PriorityButton(
priority = i, priority = i,
@ -71,10 +69,12 @@ fun Priority(
) )
} }
} }
}
} }
@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,6 +87,9 @@ fun PriorityButton(
desaturate = desaturate, desaturate = desaturate,
) )
) )
CompositionLocalProvider(
LocalMinimumTouchTargetEnforcement provides false,
) {
RadioButton( RadioButton(
selected = priority == selected, selected = priority == selected,
onClick = { onClick(priority) }, onClick = { onClick(priority) },
@ -94,7 +97,11 @@ fun PriorityButton(
selectedColor = color, selectedColor = color,
unselectedColor = color, unselectedColor = color,
), ),
modifier = Modifier
.weight(1f)
.padding(vertical = 20.dp)
) )
}
} }
@ExperimentalComposeUiApi @ExperimentalComposeUiApi

Loading…
Cancel
Save