-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic layout system documentation.
- Loading branch information
1 parent
e242612
commit c59d4be
Showing
5 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Redwood Layout | ||
|
||
Redwood's layout system provides common layout primitives to support arranging and laying out widgets. It provides widgets for: | ||
|
||
- `Row`: Lays wigets out along the X axis (horizontally). | ||
- `Column`: Lays widgets out along the Y axis (vertically). | ||
- `Box`: Lays widgets out along the Z axis (on top of eachother). | ||
- `Spacer`: Adds space between widgets. | ||
|
||
Internally the layout system uses a common layout engine written in Kotlin Multiplatform to support consistent rendering across platforms. The system provides widget bindings for for Android Views (`redwood-layout-view`), iOS UiKit (`redwood-layout-uiview`), and Compose UI (`redwood-layout-composeui`). | ||
|
||
## Widgets | ||
|
||
### Row | ||
|
||
Lays widgets out along the X axis (horizontally). | ||
|
||
```kotlin | ||
Row { | ||
Text("One") | ||
Text("Two") | ||
Text("Three") | ||
} | ||
``` | ||
|
||
<p style="text-align: center;"> | ||
<img src="../docs_images/row1.png"> | ||
</p> | ||
|
||
### Column | ||
|
||
Lays widgets out along the Y axis (vertically). | ||
|
||
```kotlin | ||
Column { | ||
Text("One") | ||
Text("Two") | ||
Text("Three") | ||
} | ||
``` | ||
|
||
<p style="text-align: center;"> | ||
<img src="../docs_images/column1.png"> | ||
</p> | ||
|
||
### Box | ||
|
||
Lays widgets out along the Z axis (on top of eachother). | ||
|
||
```kotlin | ||
Box { | ||
Color( | ||
color = Red, | ||
modifier = Modifier.size(24.dp), | ||
) | ||
Color( | ||
color = Green, | ||
modifier = Modifier.size(16.dp), | ||
) | ||
Color( | ||
color = Blue, | ||
modifier = Modifier.size(8.dp), | ||
) | ||
} | ||
``` | ||
|
||
<p style="text-align: center;"> | ||
<img src="../docs_images/box1.png"> | ||
</p> | ||
|
||
### Spacer | ||
|
||
Adds space between widgets. | ||
|
||
```kotlin | ||
Column { | ||
Text("Top") | ||
Spacer(height = 24.dp) | ||
Text("Bottom") | ||
} | ||
``` | ||
|
||
<p style="text-align: center;"> | ||
<img src="../docs_images/spacer1.png"> | ||
</p> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.