Package-level declarations

Types

Link copied to clipboard
@Preview(name = "phone", device = "spec:width=360dp,height=640dp,dpi=480")
@Preview(name = "landscape", device = "spec:width=640dp,height=360dp,dpi=480")
@Preview(name = "foldable", device = "spec:width=673dp,height=841dp,dpi=480")
@Preview(name = "tablet", device = "spec:width=1280dp,height=800dp,dpi=480")
annotation class PreviewDevices

Multi-preview annotation for testing Composables across various device sizes.

Link copied to clipboard
@Preview(uiMode = 16, name = "Light theme")
@Preview(uiMode = 32, name = "Dark theme")
annotation class PreviewThemes

Multi-preview annotation for testing Composables in light and dark themes.

Link copied to clipboard

Represents different action types that can be attached to a Snackbar message.

Link copied to clipboard

Activity result contract for capturing photos with the camera.

Link copied to clipboard
data class TextFieldData(val value: String, val errorMessage: String? = null)

Represents the state of a text input field with optional validation error.

Link copied to clipboard
data class UiState<T : Any>(val data: T, val loading: Boolean = false, val error: OneTimeEvent<Throwable?> = OneTimeEvent(null))

Screen data with a loading flag and a consumable error event.

Link copied to clipboard
sealed class UiText

Represents text that can be either a string resource (localized) or a dynamic string (runtime).

Functions

Link copied to clipboard

Returns the user's currently preferred application locale.

Link copied to clipboard
fun setLanguagePreference(languageCode: String)

Sets the application locale based on a language code.

Link copied to clipboard
fun <T : Any> StatefulComposable(state: UiState<T>, onShowSnackbar: suspend (String, SnackbarAction, Throwable?) -> Boolean, content: @Composable (T) -> Unit)

Renders UiState.data, a loading indicator, and an error snackbar callback.

Link copied to clipboard
inline fun <T : Any> MutableStateFlow<UiState<T>>.updateState(update: T.() -> T)

Replaces UiState.data synchronously, preserving loading and the existing error event.

Link copied to clipboard
context(viewModel: ViewModel)
inline fun <T : Any> MutableStateFlow<UiState<T>>.updateStateWith(crossinline operation: suspend T.() -> Result<T>)

Launches an operation in the context ViewModel's scope and replaces data on returned success.

Link copied to clipboard
context(viewModel: ViewModel)
inline fun <T : Any> MutableStateFlow<UiState<T>>.updateWith(crossinline operation: suspend T.() -> Result<Unit>)

Launches a Result-returning action in the context ViewModel's scope without replacing data.