diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/config/Style.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/config/Style.kt index 24d185a..1db47ef 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/config/Style.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/config/Style.kt @@ -2,7 +2,6 @@ package net.codinux.banking.ui.config import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp object Style { @@ -13,6 +12,4 @@ object Style { val HeaderFontWeight: FontWeight = FontWeight.Bold - val DialogButtonWidth = 200.dp - } \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/BaseDialog.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/BaseDialog.kt index e071aee..f56b18f 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/BaseDialog.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/BaseDialog.kt @@ -9,6 +9,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.compose.ui.window.Dialog import androidx.compose.ui.window.DialogProperties @@ -44,24 +45,22 @@ fun BaseDialog( content() - Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) { - TextButton(onClick = onDismiss, Modifier.width(Style.DialogButtonWidth)) { - Text("Abbrechen", color = Colors.CodinuxSecondaryColor) + Row(Modifier.fillMaxWidth()) { + TextButton(onClick = onDismiss, Modifier.weight(0.5f)) { + Text("Abbrechen", color = Colors.CodinuxSecondaryColor, textAlign = TextAlign.Center, modifier = Modifier.fillMaxWidth()) } - Spacer(Modifier.width(8.dp)) - TextButton( - modifier = Modifier.width(Style.DialogButtonWidth), + modifier = Modifier.weight(0.5f), enabled = confirmButtonEnabled, onClick = { onConfirm?.invoke() ?: onDismiss() } ) { - Row(verticalAlignment = Alignment.CenterVertically) { + Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) { if (showProgressIndicatorOnConfirmButton) { CircularProgressIndicator(Modifier.padding(end = 6.dp)) } - Text(confirmButtonTitle, color = Colors.CodinuxSecondaryColor) + Text(confirmButtonTitle, color = Colors.CodinuxSecondaryColor, textAlign = TextAlign.Center, modifier = Modifier.fillMaxWidth()) } } } diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/ErrorDialog.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/ErrorDialog.kt index 3cbf857..047668e 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/ErrorDialog.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/ErrorDialog.kt @@ -1,7 +1,6 @@ package net.codinux.banking.ui.dialogs -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.width +import androidx.compose.foundation.layout.* import androidx.compose.material.AlertDialog import androidx.compose.material.Text import androidx.compose.material.TextButton @@ -27,8 +26,10 @@ fun ErrorDialog( } }, onDismissRequest = { onDismiss?.invoke() }, confirmButton = { - TextButton({ onDismiss?.invoke() }, Modifier.width(Style.DialogButtonWidth)) { - Text(confirmButtonText, color = Colors.CodinuxSecondaryColor) + Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) { + TextButton({ onDismiss?.invoke() }, Modifier.fillMaxWidth()) { + Text(confirmButtonText, color = Colors.CodinuxSecondaryColor, textAlign = TextAlign.Center) + } } } )