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

View file

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

View file

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

View file

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

View file

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