1
Fork 0
mirror of https://github.com/Steffo99/twom.git synced 2024-11-21 23:54:26 +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.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import eu.steffo.twom.R
@Composable
@Preview
fun ErrorText(
text: String,
modifier: Modifier = Modifier,
text: String? = null,
) {
Text(
modifier = modifier,
text = text,
text = text ?: stringResource(R.string.error),
color = MaterialTheme.colorScheme.error,
)
}