mirror of
https://github.com/Steffo99/twom.git
synced 2024-11-21 23:54:26 +00:00
Allow customization of style
in ErrorText
and LoadingText
This commit is contained in:
parent
b7bfcb74a7
commit
6c6eaaf58e
2 changed files with 8 additions and 0 deletions
|
@ -1,10 +1,12 @@
|
|||
package eu.steffo.twom.composables.errorhandling
|
||||
|
||||
import androidx.compose.material3.LocalTextStyle
|
||||
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.text.TextStyle
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import eu.steffo.twom.R
|
||||
|
||||
|
@ -14,10 +16,12 @@ import eu.steffo.twom.R
|
|||
fun ErrorText(
|
||||
modifier: Modifier = Modifier,
|
||||
text: String? = null,
|
||||
style: TextStyle = LocalTextStyle.current
|
||||
) {
|
||||
Text(
|
||||
modifier = modifier,
|
||||
text = text ?: stringResource(R.string.error),
|
||||
color = MaterialTheme.colorScheme.error,
|
||||
style = style,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package eu.steffo.twom.composables.errorhandling
|
||||
|
||||
import androidx.compose.material3.LocalContentColor
|
||||
import androidx.compose.material3.LocalTextStyle
|
||||
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.text.TextStyle
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import eu.steffo.twom.R
|
||||
|
||||
|
@ -14,10 +16,12 @@ import eu.steffo.twom.R
|
|||
fun LoadingText(
|
||||
modifier: Modifier = Modifier,
|
||||
text: String? = null,
|
||||
style: TextStyle = LocalTextStyle.current,
|
||||
) {
|
||||
Text(
|
||||
modifier = modifier,
|
||||
text = text ?: stringResource(R.string.loading),
|
||||
color = LocalContentColor.current.copy(0.4f),
|
||||
style = style,
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue