diff --git a/src/main/kotlin/ca/gosyer/ui/base/WindowDialog.kt b/src/main/kotlin/ca/gosyer/ui/base/WindowDialog.kt index 597ce0f2..94180a7d 100644 --- a/src/main/kotlin/ca/gosyer/ui/base/WindowDialog.kt +++ b/src/main/kotlin/ca/gosyer/ui/base/WindowDialog.kt @@ -9,6 +9,7 @@ package ca.gosyer.ui.base import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.BoxWithConstraints +import androidx.compose.foundation.layout.BoxWithConstraintsScope import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.RowScope @@ -131,8 +132,8 @@ fun WindowDialog( onCloseRequest: (() -> Unit)? = null, forceFocus: Boolean = true, keyboardShortcuts: Map Boolean> = emptyMap(), - buttons: @Composable (() -> Unit) -> Unit, - content: @Composable (() -> Unit) -> Unit + buttons: @Composable BoxWithConstraintsScope.(() -> Unit) -> Unit, + content: @Composable BoxWithConstraintsScope.(() -> Unit) -> Unit ) = launchApplication { DisposableEffect(Unit) { onDispose { @@ -141,7 +142,7 @@ fun WindowDialog( } val resources = remember { AppScope.getInstance() } - val windowState = rememberWindowState(size = size) + val windowState = rememberWindowState(size = size, position = WindowPosition.Aligned(Alignment.Center)) Window( title = title, @@ -155,17 +156,17 @@ fun WindowDialog( else -> false } }, - alwaysOnTop = forceFocus + alwaysOnTop = forceFocus, ) { CompositionLocalProvider( LocalResources provides resources ) { AppTheme { Surface { - Column( - modifier = Modifier.fillMaxSize() - ) { - BoxWithConstraints { + Column { + BoxWithConstraints( + modifier = Modifier.fillMaxSize() + ) { content(::exitApplication) buttons(::exitApplication) } diff --git a/src/main/kotlin/ca/gosyer/ui/base/components/ColorPickerDialog.kt b/src/main/kotlin/ca/gosyer/ui/base/components/ColorPickerDialog.kt index 2aac402d..7304d0e2 100644 --- a/src/main/kotlin/ca/gosyer/ui/base/components/ColorPickerDialog.kt +++ b/src/main/kotlin/ca/gosyer/ui/base/components/ColorPickerDialog.kt @@ -101,7 +101,7 @@ fun ColorPickerDialog( buttons = { val showPresetsState by showPresets.collectAsState() val currentColorState by currentColor.collectAsState() - Row(Modifier.fillMaxWidth().padding(8.dp)) { + Row(Modifier.fillMaxWidth().padding(8.dp).align(Alignment.BottomCenter)) { TextButton( onClick = { showPresets.value = !showPresetsState @@ -373,7 +373,8 @@ fun ColorPalette( } else { textFieldHex = it } - } + }, + singleLine = true ) } } diff --git a/src/main/kotlin/ca/gosyer/ui/base/prefs/PreferencesUiBuilder.kt b/src/main/kotlin/ca/gosyer/ui/base/prefs/PreferencesUiBuilder.kt index f6d403f5..4ec66b92 100644 --- a/src/main/kotlin/ca/gosyer/ui/base/prefs/PreferencesUiBuilder.kt +++ b/src/main/kotlin/ca/gosyer/ui/base/prefs/PreferencesUiBuilder.kt @@ -26,10 +26,12 @@ import androidx.compose.foundation.clickable import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.BoxScope +import androidx.compose.foundation.layout.BoxWithConstraintsScope import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.defaultMinSize +import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.requiredHeight @@ -228,14 +230,14 @@ fun ChoiceDialog( onCloseRequest: () -> Unit = {}, onSelected: (T) -> Unit, title: String, - buttons: @Composable (() -> Unit) -> Unit = { } + buttons: @Composable BoxWithConstraintsScope.(() -> Unit) -> Unit = { } ) { WindowDialog( onCloseRequest = onCloseRequest, buttons = buttons, title = title, content = { - LazyColumn { + LazyColumn(Modifier.fillMaxSize()) { items(items) { (value, text) -> Row( modifier = Modifier.requiredHeight(48.dp).fillMaxWidth().clickable(