LayoutCoordinator

@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class LayoutCoordinator(val classes: Array<ResponsiveClass> = [])

The LayoutCoordinator annotation is useful to indicate the components which are just coordinator of the specific components designed for the specific size classes

Usage example

@Composable
@NonRestartableComposable
@LayoutCoordinator(
     classes = [EXPANDED_CONTENT, MEDIUM_CONTENT, MEDIUM_EXPANDED_CONTENT, COMPACT_CONTENT] // not mandatory
)
fun Passwords() {
    ResponsiveContent(
        onExpandedSizeClass = {
            PasswordsGrid()
        },
        onMediumSizeClass = {
            PasswordsGrid()
        },
        onMediumWidthExpandedHeight = {
            PasswordsList()
        },
        onCompactSizeClass = {
            PasswordsList()
        }
    )
}

@Composable
@NonRestartableComposable
@ResponsiveClassComponent(
    classes = [EXPANDED_CONTENT, MEDIUM_CONTENT]
)
private fun PasswordsGrid() {
    // the specific code of the component
}

@Composable
@NonRestartableComposable
@ResponsiveClassComponent(
    classes = [MEDIUM_EXPANDED_CONTENT, COMPACT_CONTENT]
)
private fun PasswordsList() {
    // the specific code of the component
}

Author

N7ghtm4r3 - Tecknobit

Since

1.1.0

Properties

Link copied to clipboard

The specific size classes which the coordinator has to manage