mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-11 18:54:21 +00:00
Refactor DialogButton
This commit is contained in:
parent
5841ab0218
commit
c13eb75128
@ -19,7 +19,6 @@ import androidx.compose.ui.text.style.TextAlign
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
import org.thoughtcrime.securesms.ui.color.LocalColors
|
import org.thoughtcrime.securesms.ui.color.LocalColors
|
||||||
import org.thoughtcrime.securesms.ui.components.BorderlessButton
|
|
||||||
|
|
||||||
class DialogButtonModel(
|
class DialogButtonModel(
|
||||||
val text: GetString,
|
val text: GetString,
|
||||||
@ -65,25 +64,14 @@ fun AlertDialog(
|
|||||||
buttons?.takeIf { it.isNotEmpty() }?.let {
|
buttons?.takeIf { it.isNotEmpty() }?.let {
|
||||||
Row {
|
Row {
|
||||||
it.forEach {
|
it.forEach {
|
||||||
TextButton(
|
DialogButton(
|
||||||
|
text = it.text(),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.contentDescription(it.contentDescription())
|
.contentDescription(it.contentDescription())
|
||||||
.weight(1f),
|
.weight(1f)
|
||||||
shape = RectangleShape,
|
|
||||||
onClick = {
|
|
||||||
it.onClick
|
|
||||||
onDismissRequest()
|
|
||||||
}
|
|
||||||
) {
|
) {
|
||||||
Text(
|
it.onClick()
|
||||||
it.text(),
|
onDismissRequest()
|
||||||
color = LocalColors.current.text,
|
|
||||||
style = largeBold,
|
|
||||||
modifier = Modifier.padding(
|
|
||||||
top = 16.dp,
|
|
||||||
bottom = 24.dp
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,6 +83,20 @@ fun AlertDialog(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun DialogButton(text: String, contentDescription: String, onClick: () -> Unit) {
|
fun DialogButton(text: String, modifier: Modifier, onClick: () -> Unit) {
|
||||||
BorderlessButton(text, modifier = Modifier.contentDescription(contentDescription), onClick = onClick)
|
TextButton(
|
||||||
|
modifier = modifier,
|
||||||
|
shape = RectangleShape,
|
||||||
|
onClick = onClick
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text,
|
||||||
|
color = LocalColors.current.text,
|
||||||
|
style = largeBold,
|
||||||
|
modifier = Modifier.padding(
|
||||||
|
top = 16.dp,
|
||||||
|
bottom = 24.dp
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user