Skip to content

Commit 2852d29

Browse files
committed
refactor(details): Center details content on large screens
Wrapped the `LazyColumn` in the details screen within a `Box` and constrained its width. This ensures the content remains centered and maintains a readable line length on larger displays, such as tablets and desktops.
1 parent 71e963c commit 2852d29

1 file changed

Lines changed: 41 additions & 31 deletions

File tree

  • feature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation

feature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/DetailsRoot.kt

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ import androidx.compose.foundation.layout.Arrangement
55
import androidx.compose.foundation.layout.Box
66
import androidx.compose.foundation.layout.PaddingValues
77
import androidx.compose.foundation.layout.Row
8+
import androidx.compose.foundation.layout.fillMaxHeight
89
import androidx.compose.foundation.layout.fillMaxSize
10+
import androidx.compose.foundation.layout.fillMaxWidth
911
import androidx.compose.foundation.layout.padding
1012
import androidx.compose.foundation.layout.size
13+
import androidx.compose.foundation.layout.widthIn
1114
import androidx.compose.foundation.lazy.LazyColumn
1215
import androidx.compose.foundation.shape.CutCornerShape
1316
import androidx.compose.material.icons.Icons
@@ -163,43 +166,50 @@ fun DetailsScreen(
163166
return@Scaffold
164167
}
165168

166-
LazyColumn(
167-
modifier = Modifier
168-
.fillMaxSize()
169-
.liquefiable(liquidTopbarState)
170-
.padding(innerPadding),
171-
contentPadding = PaddingValues(16.dp),
172-
verticalArrangement = Arrangement.spacedBy(24.dp)
169+
Box(
170+
modifier = Modifier.fillMaxSize(),
171+
contentAlignment = Alignment.Center
173172
) {
174-
header(
175-
state = state,
176-
onAction = onAction,
177-
)
173+
LazyColumn(
174+
modifier = Modifier
175+
.fillMaxHeight()
176+
.widthIn(max = 680.dp)
177+
.fillMaxWidth()
178+
.liquefiable(liquidTopbarState)
179+
.padding(innerPadding),
180+
contentPadding = PaddingValues(16.dp),
181+
verticalArrangement = Arrangement.spacedBy(24.dp),
182+
) {
183+
header(
184+
state = state,
185+
onAction = onAction,
186+
)
178187

179-
state.stats?.let { stats ->
180-
stats(repoStats = stats)
181-
}
188+
state.stats?.let { stats ->
189+
stats(repoStats = stats)
190+
}
182191

183-
state.readmeMarkdown?.let {
184-
about(
185-
readmeMarkdown = state.readmeMarkdown,
186-
readmeLanguage = state.readmeLanguage
187-
)
188-
}
192+
state.readmeMarkdown?.let {
193+
about(
194+
readmeMarkdown = state.readmeMarkdown,
195+
readmeLanguage = state.readmeLanguage
196+
)
197+
}
189198

190-
state.latestRelease?.let { latestRelease ->
191-
whatsNew(latestRelease)
192-
}
199+
state.latestRelease?.let { latestRelease ->
200+
whatsNew(latestRelease)
201+
}
193202

194-
state.userProfile?.let { userProfile ->
195-
author(
196-
author = userProfile,
197-
onAction = onAction
198-
)
199-
}
203+
state.userProfile?.let { userProfile ->
204+
author(
205+
author = userProfile,
206+
onAction = onAction
207+
)
208+
}
200209

201-
if (state.installLogs.isNotEmpty()) {
202-
logs(state)
210+
if (state.installLogs.isNotEmpty()) {
211+
logs(state)
212+
}
203213
}
204214
}
205215
}

0 commit comments

Comments
 (0)