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
Scaffold(...) { | |
Column( | |
modifier = Modifier | |
.fillMaxSize() | |
.verticalScroll(scrollState) | |
) { | |
... | |
BloomImageList(homeGardens = homeGardens) | |
} | |
} |
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 BloomImageListItem(homeGarden: HomeGarden, isSelected: Boolean = false) { | |
Row( | |
modifier = Modifier | |
.fillMaxWidth() | |
.height(64.dp), | |
horizontalArrangement = Arrangement.spacedBy(16.dp) | |
) { | |
GlideImage( | |
data = homeGarden.imageRes, |
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 Pendulum( | |
modifier: Modifier = Modifier, | |
... | |
) { | |
val infiniteTransition = rememberInfiniteTransition() | |
BoxWithConstraints( | |
modifier = modifier | |
) { |
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 Pendulum( | |
modifier: Modifier = Modifier, | |
startX: Float = .2f, | |
endX: Float = .8f, | |
topY: Float = .2f, | |
bottomY: Float = .4f, | |
... | |
) { | |
val infiniteTransition = rememberInfiniteTransition() |
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
val x by infiniteTransition.animateFloat( | |
initialValue = start.value, | |
targetValue = end.value, | |
animationSpec = infiniteRepeatable( | |
animation = tween(swingDuration, easing = LinearEasing), | |
repeatMode = RepeatMode.Reverse | |
) | |
) |
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
val y by infiniteTransition.animateFloat( | |
initialValue = top.value, | |
targetValue = bottom.value, | |
animationSpec = infiniteRepeatable( | |
animation = tween(swingDuration / 2, easing = LinearOutSlowInEasing), | |
repeatMode = RepeatMode.Reverse | |
) | |
) |
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 Pendulum( | |
modifier: Modifier = Modifier, | |
swingDuration: Int = 1500, | |
startX: Float = .2f, | |
endX: Float = .8f, | |
topY: Float = .2f, | |
bottomY: Float = .4f, | |
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
Pendulum { | |
Surface( | |
modifier = Modifier.size(24.dp), | |
shape = CircleShape, | |
color = Color.Blue, | |
content = {}) | |
} |
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 MyBasicColumn( | |
modifier: Modifier = Modifier, | |
content: @Composable() () -> Unit | |
) { | |
Layout( | |
modifier = modifier, | |
content = content | |
) { measurables, constraints -> | |
// List of measured children |
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
// List of measured children | |
val placeables = measurables.map { measurable -> | |
// Measure each children | |
measurable.measure(constraints.copy(minHeight = 0)) | |
} |