Skip to content

Commit

Permalink
Fix appearance
Browse files Browse the repository at this point in the history
  • Loading branch information
ellenspertus committed Aug 14, 2022
1 parent e1be740 commit bca783d
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/main/kotlin/com/arkivanov/composnake/Main.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.arkivanov.composnake

import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.material.Checkbox
import androidx.compose.material.CheckboxDefaults
Expand All @@ -15,15 +14,12 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusModifier
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.focus.focusTarget
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.key.Key
import androidx.compose.ui.input.key.key
import androidx.compose.ui.input.key.onKeyEvent
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.IntSize
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Window
import androidx.compose.ui.window.WindowState
Expand All @@ -41,7 +37,7 @@ fun main() = application {
val delay = 2000L

Window(
state = WindowState(size = DpSize(500.dp, 500.dp)),
state = WindowState(size = DpSize.Unspecified),
onCloseRequest = ::exitApplication,
title = "CompoSnake"
) {
Expand Down Expand Up @@ -70,9 +66,7 @@ fun main() = application {
)

Box(modifier = Modifier
.focusRequester(focusRequester)
.focusTarget(),
// modifier = Modifier.fillMaxSize(),
.size(rowWidth, rowHeight),
contentAlignment = Alignment.Center
) {
Board(game.board.value)
Expand All @@ -94,7 +88,11 @@ private fun Board(board: Board) {

Column {
board.grid.forEachFast { row ->
Row(Modifier.width(rowWidth).padding(horizontal = 8.dp)) {
Row(
modifier = Modifier
.width(rowWidth)
.padding(horizontal = 8.dp)
) {
row.forEachFast { cell ->
when (cell) {
board.food -> FoodCell()
Expand All @@ -112,7 +110,7 @@ val cellModifier = Modifier.width(24.dp).height(24.dp).padding(10.dp)
@Composable
private fun FoodCell() {
RadioButton(
// modifier = cellModifier,
modifier = cellModifier,
selected = true,
onClick = {},
colors = RadioButtonDefaults.colors(selectedColor = MaterialTheme.colors.primary)
Expand All @@ -122,7 +120,7 @@ private fun FoodCell() {
@Composable
private fun EmptyCell() {
Checkbox(
// modifier = cellModifier,
modifier = cellModifier,
checked = false,
onCheckedChange = {}
)
Expand All @@ -132,7 +130,7 @@ private fun EmptyCell() {
private fun SnakeCell(isHead: Boolean) {
Checkbox(
checked = true,
// modifier = cellModifier,
modifier = cellModifier,
colors = CheckboxDefaults.colors(
checkedColor = if (isHead) MaterialTheme.colors.primary else MaterialTheme.colors.secondary
),
Expand Down

0 comments on commit bca783d

Please sign in to comment.