1
Fork 0
mirror of https://github.com/Steffo99/twom.git synced 2024-11-28 19:14:24 +00:00

ErrorText: default to R.string.error if no text is specified

This commit is contained in:
Steffo 2024-01-17 12:12:33 +01:00
parent 427a5b8f44
commit 8ca7b58a92
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0

View file

@ -4,16 +4,20 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import eu.steffo.twom.R
@Composable @Composable
@Preview
fun ErrorText( fun ErrorText(
text: String,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
text: String? = null,
) { ) {
Text( Text(
modifier = modifier, modifier = modifier,
text = text, text = text ?: stringResource(R.string.error),
color = MaterialTheme.colorScheme.error, color = MaterialTheme.colorScheme.error,
) )
} }