Layout, Modifiers & Insets
Crow UI containers, order-dependent modifier chains, reactive window insets, Scaffold, and scroll choreography.
crow-ui is Crow's native Android rendering engine. Every container maps directly to a compact LNode backed by hardware RenderNode display-list chunks, incremental linear layout, and measure caching.
Core Containers
Crow provides the familiar declarative layout primitives:
Box— stacked layers withcontentAlignment(Alignment.Center,Alignment.BottomEnd, etc.) andModifier.align(...).Row&Column— linear layout withhorizontalArrangement/verticalArrangement,Arrangement.spacedBy(12.dp), cross-axis alignment, andModifier.weight(1f).FlowRow— wrapping horizontal chips and tags with spacing.VerticalScroll&HorizontalScroll— axis-locked scroll containers with Android 12+ RenderNode stretch overscroll,ScrollState, andNestedScrollConnection.
Order-Dependent Modifiers
Modifiers execute in declaration order, matching Jetpack Compose semantics while fusing zero-allocation fast paths at compile time:
Box(
Modifier
.fillMaxWidth()
.padding(16.dp) // outer margin (before background)
.clip(RoundedCornerShape(16.dp))
.background(SurfaceColor)
.border(1.dp, BorderColor, RoundedCornerShape(16.dp))
.clickable { openDetails() }
.padding(horizontal = 20.dp, vertical = 14.dp), // inner padding
) {
Text("Tap to open")
}Sizing & Callbacks
- Fixed & constrained sizing:
size,width,height,fillMaxSize,fillMaxWidth,fillMaxHeight,widthIn,heightIn,sizeIn,defaultMinSize,requiredSize,wrapContentSize,aspectRatio. - Live reactive sizing:
height { if (open) 240.dp else 72.dp }re-measures only in the layout phase with zero remounting. - Placement callbacks:
onSizeChanged,onPlaced,onGloballyPositioned, andBringIntoViewRequester— callbacks never fire mid-measure.
Reactive Window Insets
Window insets (status bars, navigation bars, IME keyboard, display cutouts, system gestures) are reactive signals in UiEnv:
Column(
Modifier
.fillMaxSize()
.safeDrawingPadding()
.imePadding(),
) {
// Reacts to keyboard open/close and rotation in the layout phase only
}Use statusBarsPadding(), navigationBarsPadding(), systemBarsPadding(), imePadding(), displayCutoutPadding(), or safeDrawingPadding(). They fuse just like static padding and update only the affected node on inset changes.
Scaffold & Scroll Choreography
ScaffoldBase (and Material's Scaffold) coordinates top bars, bottom bars, FABs, and scroll behaviors with automatic inset distribution and zero per-frame relayout:
- Overlay + coupled scroll: Bars follow content scroll position in the layer phase (
Pinned,ScrollAway,Collapsible,Floating,FloatingCollapsible) with velocity-aware settling. - FAB coordination:
expandedByScroll()smoothly collapses extended FABs as the user scrolls and keeps the FAB docked above hiding navigation bars.
How is this guide?
Saved State & @CrowApp
Zero-key process-death persistence with saved(), saved back stacks, and zero-boilerplate Android entry points with @CrowApp and ProcessHost.
Lazy Lists, Grids & Pagers
Virtualized LazyColumn, LazyRow, LazyVerticalGrid, stickyHeader, and signal-first HorizontalPager & VerticalPager.