Skip to content

Commit eaec38c

Browse files
committed
library: Scaffold: Move the popupPlaceables to the top
1 parent 03d7c9a commit eaec38c

File tree

1 file changed

+10
-11
lines changed
  • miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic

1 file changed

+10
-11
lines changed

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Scaffold.kt

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -279,22 +279,12 @@ private fun ScaffoldLayout(
279279
.fastMap { it.measure(looseConstraints) }
280280

281281
layout(layoutWidth, layoutHeight) {
282-
// Place Popups first
283-
popupPlaceables.fastForEach { it.place(0, 0) }
284-
285282
// Place Content
286283
bodyContentPlaceables.fastForEach { it.place(0, 0) }
287284

288285
// Place TopBar
289286
topBarPlaceables.fastForEach { it.place(0, 0) }
290287

291-
// Place Snackbar
292-
snackbarPlaceables.fastForEach {
293-
val left = (layoutWidth - snackbarWidth) / 2 + contentWindowInsets.getLeft(this@SubcomposeLayout, layoutDirection)
294-
val top = layoutHeight - snackbarOffsetFromBottom
295-
it.place(left, top)
296-
}
297-
298288
// Place BottomBar
299289
bottomBarPlaceables.fastForEach { it.place(0, layoutHeight - (bottomBarHeight ?: 0)) }
300290

@@ -330,18 +320,27 @@ private fun ScaffoldLayout(
330320
}
331321

332322
// Specific adjustments based on horizontal alignment (already handled by align function + startInset)
333-
334323
floatingToolbarPlaceables.fastForEach { placeable ->
335324
placeable.place(x, y)
336325
}
337326
}
338327

328+
// Place Snackbar
329+
snackbarPlaceables.fastForEach {
330+
val left = (layoutWidth - snackbarWidth) / 2 + contentWindowInsets.getLeft(this@SubcomposeLayout, layoutDirection)
331+
val top = layoutHeight - snackbarOffsetFromBottom
332+
it.place(left, top)
333+
}
334+
339335
// Place FAB
340336
fabPlacement?.let { placement ->
341337
fabPlaceables.fastForEach {
342338
it.place(placement.left, layoutHeight - fabOffsetFromBottom!!)
343339
}
344340
}
341+
342+
// Place Popup
343+
popupPlaceables.fastForEach { it.place(0, 0) }
345344
}
346345
}
347346
}

0 commit comments

Comments
 (0)