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
// Set the size of the layout as big as it can | |
layout(constraints.maxWidth, constraints.maxHeight) { | |
// Track the y co-ord we have placed children up to | |
var yPosition = 0 | |
// Place children in the parent layout | |
placeables.forEach { placeable -> | |
// Position item on the screen | |
placeable.place(x = 0, y = yPosition) |
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 | |
) { | |
... | |
} |
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) |
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 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 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 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> | |
) { | |
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) } |