This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
private fun FoldedCells( | |
isOpened: Boolean, | |
foldingDuration: Int, | |
foldCells: List<@Composable () -> Unit> | |
) { | |
Column { | |
foldCells.forEachIndexed { index, cell -> | |
FoldedCell( | |
isOpened = isOpened, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
private fun MainCell( | |
isOpened: Boolean, | |
cellsQuantity: Int, | |
foldingDuration: Int, | |
content: @Composable () -> Unit | |
) { | |
val mainCellTransition = updateTransition(targetState = isOpened) | |
val mainCellAlpha by mainCellTransition.animateFloat( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun Curtain( | |
isOpenedFromOutside: Boolean? = null, | |
foldingDuration: Int = 250, | |
mainCell: @Composable () -> Unit, | |
foldCells: List<@Composable () -> Unit> | |
) { | |
var isOpened by remember { mutableStateOf(false) } | |
var isTransitionRunning by remember { mutableStateOf(false) } | |
val foldScope = rememberCoroutineScope() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun Curtain( | |
isOpenedFromOutside: Boolean? = null, | |
foldingDuration: Int = 250, | |
mainCell: @Composable () -> Unit, | |
foldCells: List<@Composable () -> Unit> | |
) { | |
var isOpened by remember { mutableStateOf(false) } | |
var isTransitionRunning by remember { mutableStateOf(false) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun Curtain( | |
isOpenedFromOutside: Boolean? = null, | |
foldingDuration: Int = 250, | |
mainCell: @Composable () -> Unit, | |
foldCells: List<@Composable () -> Unit> | |
) { | |
var isOpened by remember { mutableStateOf(false) } | |
var isTransitionRunning by remember { mutableStateOf(false) } | |
val foldScope = rememberCoroutineScope() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun Curtain( | |
isOpenedFromOutside: Boolean? = null, | |
foldingDuration: Int = 250, | |
mainCell: @Composable () -> Unit, | |
foldCells: List<@Composable () -> Unit> | |
) { | |
var isOpened by remember { mutableStateOf(false) } | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun Curtain( | |
isOpenedFromOutside: Boolean? = null, | |
foldingDuration: Int = 250, | |
mainCell: @Composable () -> Unit, | |
foldCells: List<@Composable () -> Unit> | |
) { | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun App() { | |
var isDrawerOpened by remember { mutableStateOf(false) } | |
DrawerContainer( | |
isDrawerOpened = isDrawerOpened, | |
onSwipe = { toOpen -> isDrawerOpened = toOpen } | |
) { | |
Drawer() | |
Body() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun DrawerContainer( | |
modifier: Modifier = Modifier, | |
isDrawerOpened: Boolean = false, | |
drawerWidth: Dp = 200.dp, | |
onSwipe: (Boolean) -> Unit = {}, | |
content: @Composable () -> Unit | |
) { | |
val transition = updateTransition(targetState = isDrawerOpened) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun DrawerContainer( | |
modifier: Modifier = Modifier, | |
isDrawerOpened: Boolean = false, | |
drawerWidth: Dp = 200.dp, | |
onSwipe: (Boolean) -> Unit = {}, | |
content: @Composable () -> Unit | |
) { | |
val transition = updateTransition(targetState = isDrawerOpened) |