@@ -49,7 +49,8 @@ import com.skyd.compone.component.ComponeTopBarStyle
4949import com.skyd.compone.component.navigation.LocalNavBackStack
5050import com.skyd.compone.component.navigation.LocalResultStore
5151import com.skyd.compone.ext.onlyHorizontal
52- import com.skyd.compone.ext.plus
52+ import com.skyd.compone.ext.withoutBottom
53+ import com.skyd.compone.ext.withoutTop
5354import com.skyd.fundation.config.Const
5455import com.skyd.fundation.config.DEFAULT_FILE_PICKER_PATH
5556import com.skyd.fundation.ext.isDirectory
@@ -198,16 +199,17 @@ fun FilePickerScreen(
198199 PathLevelIndication (
199200 path = uiState.path,
200201 onRouteTo = { dispatch(FilePickerIntent .NewLocation (it)) },
202+ contentPadding = innerPadding.onlyHorizontal()
201203 )
202204 val resultStore = LocalResultStore .current
203205 LazyColumn (
204206 modifier = Modifier
205207 .fillMaxWidth()
206208 .weight(1f )
207209 .nestedScroll(scrollBehavior.nestedScrollConnection),
208- contentPadding = innerPadding.onlyHorizontal() + PaddingValues (
209- bottom = if (pickFolder) 0 .dp else innerPadding.calculateBottomPadding(),
210- ),
210+ contentPadding = innerPadding.withoutTop(). run {
211+ if (pickFolder) withoutBottom() else this
212+ }
211213 ) {
212214 (uiState.fileListState as ? FileListState .Success )?.list?.forEach { filePath ->
213215 item {
@@ -227,7 +229,7 @@ fun FilePickerScreen(
227229 result = filePath.toString(),
228230 )
229231 )
230- navBackStack.removeFirstOrNull ()
232+ navBackStack.removeLastOrNull ()
231233 }
232234 }
233235 },
@@ -248,11 +250,8 @@ fun FilePickerScreen(
248250 if (pickFolder) {
249251 Button (
250252 modifier = Modifier
251- .padding(
252- top = 12 .dp,
253- bottom = 12 .dp + innerPadding.calculateBottomPadding(),
254- )
255- .padding(horizontal = 16 .dp)
253+ .padding(vertical = 12 .dp, horizontal = 16 .dp)
254+ .padding(innerPadding.withoutTop())
256255 .fillMaxWidth(),
257256 onClick = {
258257 resultStore.setResult(
@@ -265,7 +264,7 @@ fun FilePickerScreen(
265264 result = uiState.path,
266265 )
267266 )
268- navBackStack.removeFirstOrNull ()
267+ navBackStack.removeLastOrNull ()
269268 },
270269 ) {
271270 Text (text = stringResource(Res .string.file_picker_screen_pick))
@@ -283,7 +282,11 @@ fun FilePickerScreen(
283282}
284283
285284@Composable
286- private fun PathLevelIndication (path : String , onRouteTo : (String ) -> Unit ) {
285+ private fun PathLevelIndication (
286+ path : String ,
287+ onRouteTo : (String ) -> Unit ,
288+ contentPadding : PaddingValues = PaddingValues ()
289+ ) {
287290 val scrollState = rememberScrollState()
288291 LaunchedEffect (scrollState.maxValue) {
289292 if (scrollState.canScrollForward) {
@@ -294,6 +297,7 @@ private fun PathLevelIndication(path: String, onRouteTo: (String) -> Unit) {
294297 modifier = Modifier
295298 .horizontalScroll(scrollState)
296299 .padding(horizontal = 12 .dp)
300+ .padding(contentPadding)
297301 .animateContentSize(),
298302 verticalAlignment = Alignment .CenterVertically ,
299303 ) {
0 commit comments