1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! # Layout
//!
//! Layout containers accept a modifier, a spec and a content closure. `Text`
//! accepts its text value before the modifier and style.
//!
//! ```no_run
//! use cranpose::*;
//!
//! #[composable]
//! fn Card() {
//! Column(
//! Modifier::empty()
//! .fill_max_width()
//! .padding(16.0)
//! .background(Color(0.1, 0.12, 0.18, 1.0))
//! .rounded_corners(12.0),
//! ColumnSpec::default().vertical_arrangement(LinearArrangement::spaced_by(8.0)),
//! move || {
//! Text("Title", Modifier::empty(), TextStyle::default());
//! Text("Body", Modifier::empty(), TextStyle::default());
//! },
//! );
//! }
//!
//! fn main() {}
//! ```
//!
//! Modifier order controls the area each operation affects:
//! `.padding(8.0).background(c)` paints the background inside the padding,
//! `.background(c).padding(8.0)` extends the background across the inner space.
//!
//! ## Lists
//!
//! A `for` loop composes every item. `LazyColumn` composes the visible rows
//! and retains list state through `rememberLazyListState`:
//!
//! ```no_run
//! use cranpose::*;
//!
//! #[composable]
//! fn Rows(count: usize) {
//! let state = rememberLazyListState();
//!
//! LazyColumn(
//! Modifier::empty().fill_max_size(),
//! state,
//! LazyColumnSpec::new().vertical_arrangement(LinearArrangement::SpacedBy(4.0)),
//! move |scope| {
//! scope.items(LazyItems::new(count), move |index| {
//! Text(
//! format!("Row {index}"),
//! Modifier::empty(),
//! TextStyle::default(),
//! );
//! });
//! },
//! );
//! }
//!
//! fn main() {}
//! ```
//!
//! Set `LazyItems::content_type` for distinct row shapes. The runtime can reuse
//! a subtree for rows with the same content type. Use stable keys when row
//! identity must survive insertions, removals or a new order.