This file contains hidden or 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 Pill(content: @Composable () -> Unit) { | |
Box( | |
modifier = Modifier | |
.background( | |
color = someColour, | |
shape = RoundedCornerShape(6.dp) | |
) | |
) { | |
content() |
This file contains hidden or 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 Moves( | |
gameState: GameState, | |
onClickMove: (Int) -> Unit, | |
) { | |
val listState = rememberLazyListState() | |
val coroutineScope = rememberCoroutineScope() | |
LazyRow( | |
state = listState, |
This file contains hidden or 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 CircleDecoratedSquare( | |
modifier: Modifier | |
) { | |
Canvas(modifier) { | |
drawCircle( | |
color = Color.DarkGray, | |
radius = size.minDimension / 3f, // 6f for a smaller one | |
alpha = 0.25f, | |
style = Stroke(width = size.minDimension / 12f) // or Fill |
This file contains hidden or 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 Highlight( | |
modifier: Modifier | |
) { | |
Canvas(modifier) { | |
drawRect( | |
color = Color.Yellow, | |
size = size, | |
alpha = 0.15f | |
) |
This file contains hidden or 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 Piece(pieceModel: Piece) { | |
Icon( | |
painter = painterResource(id = pieceModel.asset), | |
tint = Color.Unspecified | |
) | |
} |
This file contains hidden or 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 Piece(pieceModel: Piece) { | |
Text( | |
text = pieceModel.symbol, | |
fontSize = 28.sp | |
) | |
} |
This file contains hidden or 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 Board() { | |
Box(Modifier.fillMaxSize().aspectRatio(1f)) { | |
Column { | |
for (rank in 8 downTo 1) { | |
Row(modifier = Modifier.weight(1f)) { | |
for (file in 1..8) { | |
Square(Modifier.weight(1f).fillMaxSize(), /* other params */) | |
} | |
} |
This file contains hidden or 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 Square(isDarkSquare: Boolean) { | |
Canvas(modifier = Modifier.fillMaxSize(1f)) { | |
drawRect(color = if (isDarkSquare) darkSquareColor else lightSquareColor) | |
} | |
} |
This file contains hidden or 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 RotatingText() { | |
RotateIndefinitely(durationPerRotation = 4000) { | |
Text("Rotating text!") | |
} | |
} |
This file contains hidden or 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 RotatingPokeBall() { | |
RotateIndefinitely(durationPerRotation = 4000) { | |
Opacity(opacity = 0.75f) { | |
DrawImage( | |
image = +imageResource(R.drawable.pokeball), | |
tint = +colorResource(R.color.poke_red) | |
) | |
} | |
} |