Skip to content

Commit

Permalink
Merge pull request #7 from arkivanov/settings-fixes
Browse files Browse the repository at this point in the history
Fixed some UX issues in the settings dialog
  • Loading branch information
arkivanov authored Feb 5, 2024
2 parents 21901c4 + 72d3c98 commit 2585667
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Settings
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.key
import androidx.compose.ui.Modifier
import com.arkivanov.decompose.extensions.compose.subscribeAsState
import com.arkivanov.minesweeper.game.GameContent
Expand All @@ -35,7 +36,9 @@ internal fun RootContent(component: RootComponent) {
},
)

GameContent(component = gameComponent, modifier = Modifier.fillMaxSize())
key(gameComponent) {
GameContent(component = gameComponent, modifier = Modifier.fillMaxSize())
}
}

editSettingsComponentSlot.child?.instance?.also { editSettingsComponent ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,33 @@ internal fun EditSettingsContent(component: EditSettingsComponent) {
value = model.width,
onValueChange = component::onWidthChanged,
label = { Text(text = "Width") },
singleLine = true,
)

TextField(
value = model.height,
onValueChange = component::onHeightChanged,
label = { Text(text = "Height") },
singleLine = true,
)

TextField(
value = model.maxMines,
onValueChange = component::onMaxMinesChanged,
label = { Text(text = "Mine count") },
singleLine = true,
)

Row(
modifier = Modifier.align(Alignment.CenterHorizontally),
horizontalArrangement = Arrangement.spacedBy(16.dp),
) {
Button(onClick = component::onConfirmClicked) {
Text(text = "Apply")
Button(onClick = component::onDismissRequested) {
Text(text = "Cancel")
}

Button(onClick = component::onConfirmClicked) {
Text(text = "Cancel")
Text(text = "Apply")
}
}
}
Expand Down

0 comments on commit 2585667

Please sign in to comment.