mirror of
https://github.com/Steffo99/twom.git
synced 2024-11-21 23:54:26 +00:00
Create LocalizableError?.DisplayErrorText
This commit is contained in:
parent
789e029467
commit
d660c52b91
1 changed files with 11 additions and 0 deletions
|
@ -4,6 +4,7 @@ import android.util.Log
|
|||
import androidx.annotation.StringRes
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import kotlinx.coroutines.CancellationException
|
||||
|
||||
|
@ -31,6 +32,16 @@ fun LocalizableError?.Display(contents: @Composable (rendered: String) -> Unit)
|
|||
contents(rendered)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun LocalizableError?.DisplayErrorText(modifier: Modifier = Modifier) {
|
||||
this.Display {
|
||||
ErrorText(
|
||||
modifier = modifier,
|
||||
text = it,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun MutableState<LocalizableError?>.capture(
|
||||
@StringRes error: Int,
|
||||
coroutine: suspend () -> Unit,
|
||||
|
|
Loading…
Reference in a new issue