KPStateComposeLayout
A composable function that renders different layouts based on the given State. It supports displaying content, warning/informational states, and loading indicators.
This function acts as a state-based UI manager, delegating the rendering of specific states to the provided composable lambdas.
Parameters
The current State which determines what layout is displayed.
A composable lambda for rendering the content state. Default is an empty composable.
A composable lambda for rendering a warning or informational state. By default, it uses KPWarningInfoStateComposable.
A composable lambda for rendering a loading state. By default, it displays a circular loading indicator using KPCircularLoadingIndicator.
Supported States
ContentWithLoading: Displays content with an optional loading indicator.
WarningInfo: Displays a warning or informational layout based on WarningInfoStateLayoutStyle.
Loading: Displays a loading indicator with an optional message.
Example Usage
val currentState: State = State.WarningInfo(WarningInfoStateLayoutStyle(/* ... */))
KPStateComposeLayout(
state = currentState,
contentStateLayout = {
Text("This is the content layout")
}
)