From 27756f4ddefccf8fb581cde099008f5aafcc63d8 Mon Sep 17 00:00:00 2001 From: shahondin1624 Date: Fri, 13 Mar 2026 12:55:51 +0100 Subject: [PATCH] feat: add maximum content width constraint for wide displays (Closes #2) --- .../commonMain/kotlin/org/shahondin1624/App.kt | 18 +++++++++++++----- .../lib/components/UiConstants.kt | 3 +++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/sharedUI/src/commonMain/kotlin/org/shahondin1624/App.kt b/sharedUI/src/commonMain/kotlin/org/shahondin1624/App.kt index 9d5d815..56a66f1 100644 --- a/sharedUI/src/commonMain/kotlin/org/shahondin1624/App.kt +++ b/sharedUI/src/commonMain/kotlin/org/shahondin1624/App.kt @@ -20,6 +20,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import kotlinx.coroutines.launch import org.jetbrains.compose.ui.tooling.preview.Preview +import org.shahondin1624.lib.components.UiConstants import org.shahondin1624.lib.components.charactermodel.attributespage.AttributesPage import org.shahondin1624.model.EXAMPLE_CHARACTER import org.shahondin1624.theme.AppTheme @@ -121,15 +122,22 @@ private fun AppContent( ) } ) { paddingValues -> - Column( + Box( modifier = Modifier .fillMaxSize() .padding(paddingValues) - .windowInsetsPadding(WindowInsets.safeDrawing) - .padding(16.dp), - horizontalAlignment = Alignment.CenterHorizontally + .windowInsetsPadding(WindowInsets.safeDrawing), + contentAlignment = Alignment.TopCenter ) { - AttributesPage(character) + Column( + modifier = Modifier + .widthIn(max = UiConstants.MAX_CONTENT_WIDTH) + .fillMaxWidth() + .padding(16.dp), + horizontalAlignment = Alignment.CenterHorizontally + ) { + AttributesPage(character) + } } } } diff --git a/sharedUI/src/commonMain/kotlin/org/shahondin1624/lib/components/UiConstants.kt b/sharedUI/src/commonMain/kotlin/org/shahondin1624/lib/components/UiConstants.kt index cce6708..0ee8ef0 100644 --- a/sharedUI/src/commonMain/kotlin/org/shahondin1624/lib/components/UiConstants.kt +++ b/sharedUI/src/commonMain/kotlin/org/shahondin1624/lib/components/UiConstants.kt @@ -4,4 +4,7 @@ import androidx.compose.ui.unit.dp object UiConstants { val SMALL_PADDING = 6.dp + + /** Maximum width for the main content area to prevent uncomfortable stretching on ultra-wide displays. */ + val MAX_CONTENT_WIDTH = 1200.dp } \ No newline at end of file