Optimize ui - Dialog width responsive

This commit is contained in:
Hasinjato 2026-08-19 10:36:25 +03:00
parent 57cbb3e441
commit fffb24ad30
5 changed files with 22 additions and 9 deletions

View file

@ -32,7 +32,6 @@ import org.jetbrains.compose.resources.painterResource
@Composable
fun AboutDialog(onDismiss: () -> Unit) {
val platform = getPlatform()
val isAndroid = platform.name.startsWith("Android")
val appVersion = rememberAppVersion()
Dialog(
onDismissRequest = onDismiss,
@ -42,7 +41,11 @@ fun AboutDialog(onDismiss: () -> Unit) {
) {
ElevatedCard(
modifier = Modifier
.fillMaxWidth(if(isAndroid) 0.9f else 0.3f)
.widthIn(
min = 220.dp,
max = 450.dp
)
.fillMaxWidth(0.9f)
.padding(16.dp),
shape = RoundedCornerShape(24.dp),
colors = CardDefaults.elevatedCardColors(

View file

@ -268,8 +268,7 @@ fun MainScreenWithDrawer(
onConfirm = { settings ->
showPrintSettings = false
pdfExportAction(settings)
},
isAndroid
}
)
}

View file

@ -83,7 +83,11 @@ fun NewPartition(
Card(
colors = CardDefaults.cardColors(containerColor = CardBg),
modifier = Modifier
.fillMaxWidth(if(isAndroid) 0.9f else 0.55f)
.widthIn(
min = 500.dp,
max = 800.dp
)
.fillMaxWidth(0.9f)
.pointerInput(Unit) {
detectTapGestures { }
},

View file

@ -34,8 +34,7 @@ import kotlin.math.roundToInt
fun PrintSettingsDialog(
initialSettings: PrintSettings = defaultPrintSettings(),
onDismiss: () -> Unit,
onConfirm: (PrintSettings) -> Unit,
isAndroid: Boolean
onConfirm: (PrintSettings) -> Unit
) {
// ── État local (copie mutable des paramètres) ─────────────────────────────
var pageSize by remember { mutableStateOf(initialSettings.pageSize) }
@ -61,7 +60,11 @@ fun PrintSettingsDialog(
) {
Surface(
modifier = Modifier
.fillMaxWidth(if(isAndroid) 0.9f else 0.55f),
.widthIn(
min = 450.dp,
max = 725.dp
)
.fillMaxWidth(0.9f),
shape = RoundedCornerShape(16.dp),
tonalElevation = 8.dp,
color = MaterialTheme.colorScheme.surface

View file

@ -109,7 +109,11 @@ fun Settings(
usePlatformDefaultWidth = false
),
modifier = Modifier
.fillMaxWidth(if(isAndroid) 0.9f else 0.55f),
.widthIn(
min = 300.dp,
max = 600.dp
)
.fillMaxWidth(0.9f),
onDismissRequest = onDismissRequest,
title = {
Text(