Expand description
§Cranpose UI Layout
cranpose-ui-layout defines measurement, placement, alignment and arrangement
contracts for Cranpose widgets. Custom layout authors use Constraints,
Measurable, MeasureScope and Placeable. App developers usually use
Column, Row, Box and Layout from
cranpose.
§Adjust child constraints
Constraints use logical pixels. A custom measure policy can deflate parent bounds before a child measure call:
use cranpose_ui_layout::Constraints;
let parent = Constraints::loose(320.0, 480.0);
let child = parent.deflate(16.0, 12.0);
let (width, height) = child.constrain(400.0, 40.0);
assert_eq!((width, height), (304.0, 40.0));The feature set is empty. See the
Constraints API,
the layout guide
and the crate source.
Modules§
Structs§
- Alignment
- Alignment across both axes used for positioning content within a box.
- Alignment
Lines - Text baselines measured down from a layout’s top edge.
- Constraints
- Constraints used during layout measurement.
- Flex
Parent Data - Parent data for flex layouts (Row/Column weights and alignment).
- Layout
Modifier Measure Result - Result of a layout modifier measurement operation.
- Measure
Result - Result of a measurement operation.
- Measurement
- The size and explicit alignment lines produced by a measure policy.
- Parent
Data - Layout metadata supplied by a child for its direct parent.
- Placeable
- Result of running a measurement pass for a single child.
- Placement
- Placement information for a measured child.
Enums§
- Axis
- Represents the primary axis of flex layout (Row or Column).
- Horizontal
Alignment - Alignment along the horizontal axis.
- Intrinsic
Size - Specifies how to size a component based on its intrinsic measurements.
- Linear
Arrangement - Arrangement strategy matching Jetpack Compose’s linear arrangements.
- Vertical
Alignment - Alignment along the vertical axis.
Traits§
- Arrangement
- Trait implemented by arrangement strategies that distribute children on an axis.
- Axis
Alignment - An alignment along one axis, which places a block at a bias of the space left beside it.
- Measurable
- Object capable of measuring a layout child and exposing intrinsic sizes.
- Measure
Policy - Policy responsible for measuring and placing children.
- Measure
Scope - Scope for measurement operations.
- Place
Target - What a node-backed
Placeabletells when its parent places it.
Functions§
- bias_
offset - Compose’s
BiasAlignment: the offset that putschildatbiasofavailable(-1 the start, 0 the middle, 1 the end), on a whole device pixel ofdensityas Kotlin’sroundToIntrounds it, and before the start when the child is the larger. - ceil_
to_ px - A length moved up onto the next whole device pixel, as Compose sizes
text: a layout’s size is its paragraph’s,
ceiled, so it never clips. - round_
to_ px - A length moved onto the whole device pixel Compose would give it.