feat: Dynamically adjust dialog height based on screen size in DiaryCourtDrawing
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 46s
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 46s
This commit is contained in:
@@ -23,6 +23,7 @@ import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.platform.LocalConfiguration
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.geometry.Size
|
||||
@@ -134,12 +135,15 @@ internal fun DiaryCourtDrawingDialog(
|
||||
var nextType by remember(initial?.id) { mutableStateOf("US") }
|
||||
var nextTarget by remember(initial?.id) { mutableStateOf("") }
|
||||
|
||||
val cfg = LocalConfiguration.current
|
||||
val maxHeight = (cfg.screenHeightDp.dp * 0.86f)
|
||||
|
||||
AlertDialog(
|
||||
onDismissRequest = onDismiss,
|
||||
title = { Text("Uebungszeichnung") },
|
||||
text = {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth().heightIn(max = 600.dp).verticalScroll(rememberScrollState()),
|
||||
modifier = Modifier.fillMaxWidth().heightIn(max = maxHeight).verticalScroll(rememberScrollState()),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
OutlinedTextField(value = name, onValueChange = { name = it }, label = { Text("Name") }, singleLine = true)
|
||||
@@ -221,11 +225,17 @@ internal fun DiaryCourtDrawingViewerDialog(
|
||||
data: DiaryCourtDrawingData,
|
||||
onDismiss: () -> Unit,
|
||||
) {
|
||||
val cfg = LocalConfiguration.current
|
||||
val maxHeight = (cfg.screenHeightDp.dp * 0.86f)
|
||||
|
||||
AlertDialog(
|
||||
onDismissRequest = onDismiss,
|
||||
title = { Text(title) },
|
||||
text = {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth().heightIn(max = maxHeight).verticalScroll(rememberScrollState()),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
DiaryCourtDrawingPreview(data)
|
||||
Text(data.fullCode(), style = MaterialTheme.typography.body2)
|
||||
}
|
||||
@@ -253,10 +263,13 @@ private fun DrawingChoiceRow(label: String, values: List<String>, selected: Stri
|
||||
|
||||
@Composable
|
||||
internal fun DiaryCourtDrawingPreview(data: DiaryCourtDrawingData, modifier: Modifier = Modifier) {
|
||||
val cfg = LocalConfiguration.current
|
||||
val previewHeight = (cfg.screenHeightDp.dp * 0.28f).coerceAtLeast(150.dp)
|
||||
|
||||
Canvas(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.height(155.dp)
|
||||
.height(previewHeight)
|
||||
.background(Color(0xFFF0F4F1))
|
||||
.padding(10.dp),
|
||||
) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[versions]
|
||||
# composeApp (Play Store / „Über die App“-Build)
|
||||
appVersionCode = "17"
|
||||
appVersionCode = "18"
|
||||
appVersionName = "1.6.2"
|
||||
agp = "9.2.1"
|
||||
android-compileSdk = "35"
|
||||
|
||||
Reference in New Issue
Block a user