mirror of
https://github.com/Suwayomi/TachideskJUI.git
synced 2025-12-18 18:52:05 +01:00
Dialog fixes
This commit is contained in:
@@ -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<Key, (KeyEvent) -> 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<XmlResourceBundle>() }
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 <T> 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(
|
||||
|
||||
Reference in New Issue
Block a user