mirror of
https://github.com/Steffo99/twom.git
synced 2024-11-25 01:24:24 +00:00
ErrorText
: default to R.string.error
if no text
is specified
This commit is contained in:
parent
427a5b8f44
commit
8ca7b58a92
1 changed files with 6 additions and 2 deletions
|
@ -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,
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue