mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-23 19:32:16 +00:00
Add: HorizontalExpandingVisibility
This commit is contained in:
parent
2ca4e7971d
commit
f540fb98e2
@ -0,0 +1,30 @@
|
||||
package com.looker.droidify.ui.compose.utils
|
||||
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.AnimatedVisibilityScope
|
||||
import androidx.compose.animation.expandHorizontally
|
||||
import androidx.compose.animation.shrinkHorizontally
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
|
||||
@Composable
|
||||
fun HorizontalExpandingVisibility(
|
||||
expanded: Boolean = false,
|
||||
from: Alignment.Horizontal = Alignment.Start,
|
||||
towards: Alignment.Horizontal = Alignment.End,
|
||||
expandedView: @Composable (AnimatedVisibilityScope.() -> Unit),
|
||||
collapsedView: @Composable (AnimatedVisibilityScope.() -> Unit)
|
||||
) {
|
||||
AnimatedVisibility(
|
||||
visible = expanded,
|
||||
enter = expandHorizontally(expandFrom = from),
|
||||
exit = shrinkHorizontally(shrinkTowards = from),
|
||||
content = expandedView
|
||||
)
|
||||
AnimatedVisibility(
|
||||
visible = !expanded,
|
||||
enter = expandHorizontally(expandFrom = towards),
|
||||
exit = shrinkHorizontally(shrinkTowards = towards),
|
||||
content = collapsedView
|
||||
)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user