Kotlin docs
Semántico sayk'uy
Mana ima sutichaypas t'ikrakurqanchu: qillqalla, yachachiylla utaq willaylla t'ikrakurqan.
3 qillqakuna · +563 −34
- docs/src/components/docs.js +36 −30
- docs/src/pages/docs/kotlin.mdx +526 −3
- docs/src/pages/docs/rust.mdx +1 −1
diff --git a/docs/src/components/docs.js b/docs/src/components/docs.js
index 201b91395..4f570a647 100644
--- a/docs/src/components/docs.js
+++ b/docs/src/components/docs.js
@@ -9,38 +9,44 @@ import './docs.css'
import SyntaxHighlighter from 'react-syntax-highlighter';
import { atomOneDark } from 'react-syntax-highlighter/dist/esm/styles/hljs';
-export default ({children, location}) => (
- <MDXProvider>
- <Layout>
- <SEO title="Stretch" keywords={[`rust`, `android`, `ios`, `web`, `flexbox`]} />
- <section className="docs-header">
- <div className="section-inner">
- <h1>Documentation</h1>
- <p>
- Stretch is available for Rust, Kotlin, Swift, and JavaScript. We will be adding more language bindings over time.
- For general help on using flexbox we suggest
- reading <a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/">css-tricks.com/snippets/css/a-guide-to-flexbox</a> and
- playing around with <a href="https://flexboxfroggy.com">flexboxfroggy.com</a>. Or you can always read the spec itself
- at <a href="https://www.w3.org/TR/css-flexbox-1/">www.w3.org/TR/css-flexbox-1</a>
- </p>
- <div className="doc-pills">
- <Link to="/docs/rust" className={`doc-pill ${location.pathname.endsWith("rust") ? "active" : ""}`}>Rust</Link>
- <Link to="/docs/kotlin" className={`doc-pill ${location.pathname.endsWith("kotlin") ? "active" : ""}`}>Kotlin</Link>
- <Link to="/docs/swift" className={`doc-pill ${location.pathname.endsWith("swift") ? "active" : ""}`}>Swift</Link>
- <Link to="/docs/javascript" className={`doc-pill ${location.pathname.endsWith("javascript") ? "active" : ""}`}>JavaScript</Link>
+export default ({children, location}) => {
+ const selected = (path) => {
+ return location.pathname.endsWith(path) || location.pathname.endsWith(path + "/");
+ }
+
+ return (
+ <MDXProvider>
+ <Layout>
+ <SEO title="Stretch" keywords={[`rust`, `android`, `ios`, `web`, `flexbox`]} />
+ <section className="docs-header">
+ <div className="section-inner">
+ <h1>Documentation</h1>
+ <p>
+ Stretch is available for Rust, Kotlin, Swift, and JavaScript. We will be adding more language bindings over time.
+ For general help on using flexbox we suggest
+ reading <a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/">css-tricks.com/snippets/css/a-guide-to-flexbox</a> and
+ playing around with <a href="https://flexboxfroggy.com">flexboxfroggy.com</a>. Or you can always read the spec itself
+ at <a href="https://www.w3.org/TR/css-flexbox-1/">www.w3.org/TR/css-flexbox-1</a>
+ </p>
+ <div className="doc-pills">
+ <Link to="/docs/rust" className={`doc-pill ${selected("rust") ? "active" : ""}`}>Rust</Link>
+ <Link to="/docs/kotlin" className={`doc-pill ${selected("kotlin") ? "active" : ""}`}>Kotlin</Link>
+ <Link to="/docs/swift" className={`doc-pill ${selected("swift") ? "active" : ""}`}>Swift</Link>
+ <Link to="/docs/javascript" className={`doc-pill ${selected("javascript") ? "active" : ""}`}>JavaScript</Link>
+ </div>
</div>
- </div>
- </section>
- <section className="mdx-content">
- <div className="section-inner">
- <div>
- {children}
+ </section>
+ <section className="mdx-content">
+ <div className="section-inner">
+ <div>
+ {children}
+ </div>
</div>
- </div>
- </section>
- </Layout>
- </MDXProvider>
-);
+ </section>
+ </Layout>
+ </MDXProvider>
+ );
+}
export function Code({file, lang, children}) {
return (
diff --git a/docs/src/pages/docs/kotlin.mdx b/docs/src/pages/docs/kotlin.mdx
index 5d1f3b21e..cd7095fdc 100644
--- a/docs/src/pages/docs/kotlin.mdx
+++ b/docs/src/pages/docs/kotlin.mdx
@@ -1,6 +1,529 @@
-import Layout from '../../components/docs.js';
+import Layout, { Code } from '../../components/docs.js';
export default Layout;
-# HEllo!
+# Installation
+Start by creating a new project in Android Studio and navigate to your project's `Build.gradle` file. Here we add the stretch dependency and make sure to split our apk on abi to ensure that we don't ship native code from stretch for platforms which won't be used.
-This is the kotlin docs yo.
\ No newline at end of file
+<Code lang="groovy" file="Build.gradle">{`
+android {
+ splits {
+ abi {
+ enable true
+ }
+ }
+}
+
+dependencies {
+ implementation 'app.visly.stretch:stretch:0.2.2'
+}
+`}</Code>
+
+We are ready to use Stretch! Open up `MainActivity.kt` and replace its contents with the following. Once finished you should be able to run the project to see the results of this basic layout calculation in the logs.
+
+<Code lang="kotlin" file="MainActivity.kt">{`
+class MainActivity: Activity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_main)
+
+ val node = Node(
+ Style(
+ size = Size(
+ Dimension.Points(100f),
+ Dimension.Points(100f)
+ )
+ ),
+ listOf()
+ )
+
+ val layout = node.computeLayout(Size(null, null))
+ Log.d("stretch", "width: \${layout.width}, height: \${layout.height}")
+ }
+}
+`}</Code>
+
+# Basics
+`Node`s are the core building blocks of a stretch layout tree. A node needs a `Style` which describes the `flexbox` properties for the node. By adding nodes as children to a parent node we create a tree which we can perform layout on. The result of a layout computation is a tree of `Layout` nodes. This tree matches the structure of the `Node` tree but contains the computed layout of each node.
+
+<Code lang="MainActivity" file="MainActivity.kt">{`
+class MainActivity: Activity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_main)
+
+ val node = Node(Style(),
+ listOf(
+ Node(
+ Style(
+ size = Size(
+ Dimension.Points(100f),
+ Dimension.Points(100f)
+ )
+ ),
+ listOf()
+ )
+ )
+ )
+
+ val layout = node.computeLayout(Size(null, null))
+ layout.width; // 100.0
+ layout.height; // 100.0
+ layout.children.size(); // 1
+ }
+}
+`}</Code>
+
+Nodes can be be mutated and stretch will automatically recompute only the subtrees which have changed. This is incredibly powerfull if you have a large node tree, perhaps representing the UI of an app, and only need to change the height of a single element.
+
+<Code lang="kotlin" file="MainActivity.kt">{`
+class MainActivity: Activity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_main)
+
+ val node = Node(Style(),
+ listOf(
+ Node(
+ Style(
+ size = Size(
+ Dimension.Points(100f),
+ Dimension.Points(100f)
+ )
+ ),
+ listOf()
+ )
+ )
+ )
+
+ node.computeLayout(Size(null, null))
+
+ // Mutate node
+ node.setStyle(Style(
+ size = Size(
+ Dimension.Points(100f),
+ Dimension.Points(100f)
+ )
+ ))
+
+ // This call will return partially cached results
+ node.computeLayout(Size(null, null))
+ }
+}
+`}</Code>
+
+# Node
+Create a new node with children (or an empty list). Children can be removed or added later on as well.
+
+<Code lang="kotlin">{`constructor(style: Style, children: List<Node>)`}</Code>
+
+----
+
+Create a new leaf node. This is a node without children which knows how to measure its own intrinsic size. Examples of common leaf nodes are images and text.
+
+<Code lang="kotlin">{`constructor(style: Style, measure: MeasureFunc)`}</Code>
+
+----
+
+Set the measure function on a node. This function will be called on leaf nodes to resolve the instrinsic size of the node given a set of constraints.
+
+<Code lang="kotlin">{`fun setMeasure(measure: MeasureFunc)`}</Code>
+
+----
+
+Adds a child to an existing node.
+
+<Code lang="kotlin">{`fun addChild(child: Node)`}</Code>
+
+----
+
+Replaces the children of an existing node.
+
+<Code lang="kotlin">{`fun setChildren(children: List<Node>)`}</Code>
+
+----
+
+Removes a previously added child from an existing node.
+
+<Code lang="kotlin">{`fun removeChild(child: Node): Node`}</Code>
+
+----
+
+Removes the child at the given index of an existing node.
+
+<Code lang="kotlin">{`fun removeChildAtIndex(index: Int): Node`}</Code>
+
+----
+
+Replaces the child at the given index of an existing node with the given new child.
+
+<Code lang="kotlin">{`fun replaceChildAtIndex(index: Int, child: Node): Node`}</Code>
+
+----
+
+Returns the list of children owned by this node.
+
+<Code lang="kotlin">{`fun getChildren(): List<Node>`}</Code>
+
+----
+
+Returns the number of children associated with this node.
+
+<Code lang="kotlin">{`fun getChildCount(): Int`}</Code>
+
+----
+
+Updates the style of an existing node.
+
+<Code lang="kotlin">{`fun setStyle(style: Style)`}</Code>
+
+----
+
+Returns the current style of a node.
+
+<Code lang="kotlin">{`fun getStyle(): Style`}</Code>
+
+----
+
+Marks the node as dirty and propagates this up the node tree. This function is called internally for any mutating function. The only time you have to ensure to call it manually is if some application state has changed which will effect the intrinsic size of a leaf node. For example if the text of a text node has changed.
+
+<Code lang="kotlin">{`fun markDirty()`}</Code>
+
+----
+
+Returns wether of not this node is marked as dirty and will need to be recalculated during the next layout pass.
+
+<Code lang="kotlin">{`fun isDirty(): Boolean`}</Code>
+
+----
+
+Computes the layout of a node tree given a size. The size passed in is used to compute percentage sizes on the root node. If you don't need to do this then it is fine to pass `Size(null, null)` however you will typically pass in the size of the viewport which will host this computed layout. The resulting tree of `Layout` nodes mimics the structure of the computed `Node` tree and includes position and size information..
+
+<Code lang="kotlin">{`fun computeLayout(size: Size<Float?>): Layout`}</Code>
+
+# Style
+The `Style` object contains all the properties associated with flexbox as well as some properties which we found useful outside of flexbox. For example `positionType` can be set to `PositionType.Absolute` which puts the node into a absolute layout context instead of a flexbox context. `aspectRatio` is another property not part of the flexbox specification which when set ensures the node matches a certain aspect ratio.
+
+<Code lang="kotlin">{`
+data class Style(
+ val display: Display = Display.Flex,
+ val positionType: PositionType = PositionType.Relative,
+ val direction: Direction = Direction.Inherit,
+ val flexDirection: FlexDirection = FlexDirection.Row,
+ val flexWrap: FlexWrap = FlexWrap.NoWrap,
+ val overflow: Overflow = Overflow.Hidden,
+ val alignItems: AlignItems = AlignItems.Stretch,
+ val alignSelf: AlignSelf = AlignSelf.Auto,
+ val alignContent: AlignContent = AlignContent.FlexStart,
+ val justifyContent: JustifyContent = JustifyContent.FlexStart,
+ val position: Rect<Dimension> = Rect(Dimension.Undefined, Dimension.Undefined, Dimension.Undefined, Dimension.Undefined),
+ val margin: Rect<Dimension> = Rect(Dimension.Undefined, Dimension.Undefined, Dimension.Undefined, Dimension.Undefined),
+ val padding: Rect<Dimension> = Rect(Dimension.Undefined, Dimension.Undefined, Dimension.Undefined, Dimension.Undefined),
+ val border: Rect<Dimension> = Rect(Dimension.Undefined, Dimension.Undefined, Dimension.Undefined, Dimension.Undefined),
+ val flexGrow: Float = 0f,
+ val flexShrink: Float = 1f,
+ val flexBasis: Dimension = Dimension.Auto,
+ val size: Size<Dimension> = Size(Dimension.Auto, Dimension.Auto),
+ val minSize: Size<Dimension> = Size(Dimension.Auto, Dimension.Auto),
+ val maxSize: Size<Dimension> = Size(Dimension.Auto, Dimension.Auto),
+ val aspectRatio: Float? = null
+)
+`}</Code>
+
+----
+
+`AlignItems` describes how to align children along the cross axis of their parent. `AlignItems` is very similar to `JustifyContent` but instead of applying to the main axis, `AlignItems` applies to the cross axis.
+
+- `FlexStart` aligns children of a container to the start of the container's cross axis.
+- `FlexEnd` aligns children of a container to the end of the container's cross axis.
+- `Center` aligns children of a container in the center of the container's cross axis.
+- `Baseline` aligns children of a container to the baseline of that container's cross axis.
+- `Stretch` stretches children of a container to match the height of the container's cross axis.
+
+Optional, if left undefined `Stretch` is the default value.
+
+<Code lang="kotlin">{`
+enum class AlignItems {
+ FlexStart,
+ FlexEnd,
+ Center,
+ Baseline,
+ Stretch,
+}
+`}</Code>
+
+----
+
+`AlignSelf` has the same options and effect as setting `AlignItems` on the containing node but instead of affecting the children within the node you can apply this property to a single child to change its alignment within its parent. `AlignSelf` overrides any option set on the parent with `AlignItems`.
+
+- `Auto` delegates to the parent's `AlignItems` property.
+- `FlexStart` aligns children of a container to the start of the container's cross axis.
+- `FlexEnd` aligns children of a container to the end of the container's cross axis.
+- `Center` aligns children of a container in the center of the container's cross axis.
+- `Baseline` aligns children of a container to the baseline of that container's cross axis.
+- `Stretch` stretches children of a container to match the height of the container's cross axis.
+
+Optional, if left undefined `Auto` is the default value.
+
+<Code lang="kotlin">{`
+enum class AlignSelf {
+ Auto,
+ FlexStart,
+ FlexEnd,
+ Center,
+ Baseline,
+ Stretch,
+}
+`}</Code>
+
+----
+
+`AlignContent` defines the distribution of lines along the cross-axis. This only has effect when items are wrapped to multiple lines using `FlexWrap`.
+
+- `FlexStart` aligns wrapped lines to the start of the container's cross axis.
+- `FlexEnd` aligns wrapped lines to the end of the container's cross axis.
+- `Center` aligns wrapped lines in the center of the container's cross axis.
+- `Stretch` stretches wrapped lines to match the height of the container's cross axis.
+- `SpaceBetween` evenly spaces wrapped lines across the container's main axis, distributing remaining space between the lines.
+- `SpaceAround` evenly spaces wrapped lines across the container's main axis, distributing remaining space around the lines. Compared to space between using space around will result in space being distributed to the begining of the first lines and end of the last line.
+
+Optional, if left undefined `Stretch` is the default value.
+
+<Code lang="kotlin">{`
+enum class AlignContent {
+ FlexStart,
+ FlexEnd,
+ Center,
+ Stretch,
+ SpaceBetween,
+ SpaceAround,
+}
+`}</Code>
+
+----
+
+The `Direction` property specifies wether the component should be laid out in `LTR` or `RTL` writing mode.
+
+Optional, `Inherit` by default (root node will implicitly default to `LTR`).
+
+<Code lang="kotlin">{`
+enum class Direction {
+ Inherit,
+ LTR,
+ RTL,
+}
+`}</Code>
+
+----
+
+The `Display` property specifies wether the component should be laid out as `Flex` or not at all. If `None` is specified then the node will have a resulting size of zero. In the future this enum class will be expanded to include more display options such as `Grid`.
+
+Optional, `Flex` by default.
+
+<Code lang="kotlin">{`
+enum class Display {
+ Flex,
+ None,
+}
+`}</Code>
+
+----
+
+`FlexDirection` controls the direction in which children of a node are laid out. This is also referred to as the main axis. The main axis is the direction in which children are laid out. The cross axis the the axis perpendicular to the main axis, or the axis which wrapping lines are laid out in.
+
+- `Row` aligns children from left to right. If wrapping is enabled then the next line will start under the first item on the left of the container.
+- `Column` aligns children from top to bottom. If wrapping is enabled then the next line will start to the left first item on the top of the container.
+- `RowReverse` aligns children from right to left. If wrapping is enabled then the next line will start under the first item on the right of the container.
+- `ColumnReverse` aligns children from bottom to top. If wrapping is enabled then the next line will start to the left first item on the bottom of the container.
+
+Optional, if left undefined `Row` is the default value.
+
+<Code lang="kotlin">{`
+enum class FlexDirection {
+ Row,
+ Column,
+ RowReverse,
+ ColumnReverse,
+}
+`}</Code>
+
+----
+
+`JustifyContent` describes how to align children within the main axis of their container. For example, you can use this property to center a child horizontally within a container with `FlexDirection` set to `FlexDirection.Row` or vertically within a container with `FlexDirection` set to `FlexDirection.Column`.
+
+- `FlexStart` aligns children of a container to the start of the container's main axis.
+- `FlexEnd` aligns children of a container to the end of the container's main axis.
+- `Center` aligns children of a container in the center of the container's main axis.
+- `SpaceBetween` evenly spaces of children across the container's main axis, distributing remaining space between the children.
+- `SpaceAround` evenly spaces of children across the container's main axis, distributing remaining space around the children. Compared to space between using `SpaceAround` will result in space being distributed to the beginning of the first child and end of the last child.
+- `SpaceEvenly` evenly spaces of children across the container's main axis, distributing remaining space around the children so that visually there is equal space around every child including at the edges.
+
+Optional, if left undefined `FlexStart` is the default value.
+
+<Code lang="kotlin">{`
+enum class JustifyContent {
+ FlexStart,
+ FlexEnd,
+ Center,
+ SpaceBetween,
+ SpaceAround,
+ SpaceEvenly,
+}
+`}</Code>
+
+----
+
+The `Overflow` property specifies how the node should handle children which overflow their parent's size. This property is currently not used but may be used in the future.
+
+Optional, `Visible` by default.
+
+<Code lang="kotlin">{`
+enum class Overflow {
+ Visible,
+ Hidden,
+ Scroll,
+}
+`}</Code>
+
+----
+
+The `PositionType` property specifies wether the component should be laid out relative to its sibling or absolutely positioned within its parent.
+
+Optional, `Relative` by default.
+
+<Code lang="kotlin">{`
+enum class PositionType {
+ Relative,
+ Absolute,
+}
+`}</Code>
+
+----
+
+The `FlexWrap` property controls what happens when children overflow the size of the container along the main axis. By default children are forced into a single line (which can shrink components).
+
+- `Wrap` enables wrapping of children if they overflow the main axis of the container.
+- 'NoWrap' disables wrapping of children, children will instead shrink to fit the main axis or overflow depending on their `flexShrink` setting.
+- `WrapReverse` enables wrapping of children if they overflow the main axis of the container. Unlike `Wrap`, lines are laid out in reverse order.
+
+Optional, if left undefined `NoWrap` is the default value.
+
+<Code lang="kotlin">{`
+enum class FlexWrap {
+ NoWrap,
+ Wrap,
+ WrapReverse,
+}
+`}</Code>
+
+----
+
+When `PositionType` is set to `PositionType.Relative` the `position` property specifies the offset the node should have from its default position. In the case position is set to `PositionType.Absolute` this property indicates the distance this node's edge should be from the container's corresponding edge.
+
+All position properties are optional and `Dimension.Undefined` by default.
+
+<Code lang="kotlin">{`position: Rect<Dimension>`}</Code>
+
+----
+
+Margin effects the spacing around the outside of the node it is applied to. A node with margin will offset itself from the bounds of its parent but also offset the location of any siblings. If margin is set to auto then the margin is equal to the remaining space in that axis divided between all other auto margin values in that axis.
+
+As apposed to layout engines Stretch does not support setting left/right margin but instead uses start/end to ensure equal support for right-to-left as well as left-to-right locales. In left-to-right locales start corrosponds to left and end to right, the opposite is true in right-to-left locales.
+
+All margin properties are optional and `Dimension.Undefined` by default, resulting in no margin.
+
+<Code lang="kotlin">{`margin: Rect<Dimension>`}</Code>
+
+----
+
+Padding affects the size of the node it is applied to. Padding will not add to the total size of a node if it has an explicit size set, instead it will inset the content. For auto-sized nodes padding will increase the size of the node as well as offset the location of any children.
+
+As apposed to layout engines Stretch does not support setting left/right padding but instead uses start/end to ensure equal support for right-to-left as well as left-to-right locales. In left-to-right locales start corrosponds to left and end to right, the opposite is true in right-to-left locales.
+
+All padding properties are optional and `Dimension.Undefined` by default, resulting in no padding.
+
+<Code lang="kotlin">{`padding: Rect<Dimension>`}</Code>
+
+----
+
+Border affects the size of the node it is applied to. Border will not add to the total size of a node if it has an explicit size set, instead it will inset the content. For auto-sized nodes border will increase the size of the node as well as offset the location of any children.
+
+As apposed to layout engines Stretch does not support setting left/right border but instead uses start/end to ensure equal support for right-to-left as well as left-to-right locales. In left-to-right locales start corrosponds to left and end to right, the opposite is true in right-to-left locales.
+
+All border properties are optional and `Dimension.Undefined` by default, resulting in no border.
+
+<Code lang="kotlin">{`border: Rect<Dimension>`}</Code>
+
+----
+
+Flex grow describes how any space within a container should be distributed among its children along the main axis. After laying out its children, a container will distribute any remaining space according to the flex grow values specified by its children. Flex grow accepts any floating point value >= 0. A container will distribute any remaining space among its children weighted by the child’s flex grow value. If `flexGrow` is set to 0 the node will not grow.
+
+Optional, if left undefined `0.0` is the default value.
+
+<Code lang="kotlin">{`flexGrow: f32`}</Code>
+
+----
+
+Flex shrink describes how to shrink children along the main axis in the case that the total size of the children overflow the size of the container on the main axis. flex shrink is very similar to flex grow and can be thought of in the same way if any overflowing size is considered to be negative remaining space. These two properties also work well together by allowing children to grow and shrink as needed. Flex shrink accepts any floating point value >= 0. A container will shrink its children weighted by the child’s flex shrink value. If `flexShrink` is set to 0 the node will not shrink.
+
+Optional, if left undefined `1.0` is the default value.
+
+<Code lang="kotlin">{`flexShrink: f32`}</Code>
+
+----
+
+Flex basis is an axis-independent way of providing the default size of an item along the main axis. Setting the flex basis of a child is similar to setting the width of that child if its parent is a container with `FlexDirection.Row` or setting the height of a child if its parent is a container with `FlexDirection.Column`. The flex basis of an item is the default size of that item, the size of the item before any flex grow and flex shrink calculations are performed.
+
+Optional, similar to width and height the default value is undefined which means that the flex basis is determined by the size of the node's content.
+
+<Code lang="kotlin">{`flexBasis: Dimension`}</Code>
+
+----
+
+The size property specifies the size of the node’s content area. Size can be specified in pixels, points, or a percentage of the parent size. If set to `Dimension.Undefined` or `Dimension.Auto` the size is calculated based on the node’s content. What is meant by content is based on the kind of node, for example the size of a text node is the size of the text being displayed while the size of a flexbox node is the total size of its children.
+
+Optional, `Size(Dimension.Auto, Dimension.Auto)` by default.
+
+<Code lang="kotlin">{`size: Size<Dimension>`}</Code>
+
+----
+
+The maximum size of a node, this property takes priority over all other properties. If left undefined the node has no maximum size.
+
+Optional, `Size(Dimension.Auto, Dimension.Auto)` by default.
+
+<Code lang="kotlin">{`minSize: Size<Dimension>`}</Code>
+
+----
+
+The minimum size of a node, this property takes priority over all other properties. If left undefined the node has no minimum size.
+
+Optional, `Size(Dimension.Auto, Dimension.Auto)` by default.
+
+<Code lang="kotlin">{`maxSize: Size<Dimension>`}</Code>
+
+----
+
+Configures the aspect ratio of a node, very useful for media content.
+
+- Accepts any floating point value > 0.
+- Defined as the ratio between the width and the height of a node e.g. if a node has an aspect ratio of 2 then its width is twice the size of its height.
+- Respects the min and max dimensions of an item.
+- Has higher priority than flex grow
+- If aspect ratio, width, and height are set then the cross axis dimension is overridden.
+
+Optional, if left undefined no aspect ratio is enforced.
+
+<Code lang="kotlin">{`aspectRatio: Float?`}</Code>
+
+# Layout
+`Layout` nodes are returned from a layout calculation and mimic the structure of the computed `Node` tree.
+
+<Code lang="kotlin">{`
+data class Layout(
+ val x: Float,
+ val y: Float,
+ val width: Float,
+ val height: Float,
+ val children: List<Layout>
+)
+`}</Code>
diff --git a/docs/src/pages/docs/rust.mdx b/docs/src/pages/docs/rust.mdx
index 9f6779597..9b34a2936 100644
--- a/docs/src/pages/docs/rust.mdx
+++ b/docs/src/pages/docs/rust.mdx
@@ -328,7 +328,7 @@ enum FlexDirection {
- `FlexEnd` aligns children of a container to the end of the container's main axis.
- `Center` aligns children of a container in the center of the container's main axis.
- `SpaceBetween` evenly spaces of children across the container's main axis, distributing remaining space between the children.
-- `SpaceAround` evenly spaces of children across the container's main axis, distributing remaining space around the children. Compared to space between using `spaceAround` will result in space being distributed to the beginning of the first child and end of the last child.
+- `SpaceAround` evenly spaces of children across the container's main axis, distributing remaining space around the children. Compared to space between using `SpaceAround` will result in space being distributed to the beginning of the first child and end of the last child.
- `SpaceEvenly` evenly spaces of children across the container's main axis, distributing remaining space around the children so that visually there is equal space around every child including at the edges.
Optional, if left undefined `FlexStart` is the default value.