Center text in LoadingView, SuccessView, and ErrorView

This commit is contained in:
cketti 2024-01-26 21:46:49 +01:00
parent 65f8920039
commit e9fb4ecd57
3 changed files with 13 additions and 3 deletions

View file

@ -13,6 +13,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.R
import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonText
@ -54,6 +55,7 @@ fun ErrorView(
)
TextSubtitle1(
text = title,
textAlign = TextAlign.Center,
)
}

View file

@ -10,6 +10,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.atom.CircularProgressIndicator
import app.k9mail.core.ui.compose.designsystem.atom.text.TextSubtitle1
@ -36,7 +37,10 @@ fun LoadingView(
verticalArrangement = Arrangement.Center,
) {
if (message != null) {
TextSubtitle1(text = message)
TextSubtitle1(
text = message,
textAlign = TextAlign.Center,
)
}
Row(
modifier = Modifier.height(MainTheme.sizes.larger),

View file

@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.requiredSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.atom.Icon
import app.k9mail.core.ui.compose.designsystem.atom.text.TextSubtitle1
@ -28,7 +29,10 @@ fun SuccessView(
.then(modifier),
horizontalAlignment = Alignment.CenterHorizontally,
) {
TextSubtitle1(text = message)
TextSubtitle1(
text = message,
textAlign = TextAlign.Center,
)
Row(
modifier = Modifier.height(MainTheme.sizes.larger),
verticalAlignment = Alignment.CenterVertically,
@ -47,7 +51,7 @@ fun SuccessView(
internal fun SuccessViewPreview() {
PreviewWithThemes {
SuccessView(
message = "Success",
message = "The app tried really hard and managed to successfully complete the operation.",
)
}
}