Skip to content

Commit 0aa145b

Browse files
livtanongspydon
andauthored
docs: Layout components (#3752)
Update flame docs with latest in layout experiments --------- Co-authored-by: Lukas Klingsbo <[email protected]> Co-authored-by: Lukas Klingsbo <[email protected]>
1 parent 17aeb93 commit 0aa145b

File tree

7 files changed

+51
-3
lines changed

7 files changed

+51
-3
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# ExpandedComponent
2+
3+
```{dartdoc}
4+
:package: flame
5+
:symbol: ExpandedComponent
6+
:file: src/experimental/expanded_component.dart
7+
```

doc/flame/layout/layout.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
# Layout
22

33
- [Align Component](align_component.md)
4+
- [Row Component](row_component.md)
5+
- [Column Component](column_component.md)
6+
- [Expanded Component](expanded_component.md)
7+
- [Padding Component](padding_component.md)
48

59
```{toctree}
610
:hidden:
711
8-
AlignComponent <align_component.md>
12+
AlignComponent <align_component.md>
13+
RowComponent <row_component.md>
14+
ColumnComponent <column_component.md>
15+
Expanded Component <expanded_component.md>
16+
Padding Component <padding_component.md>
917
```
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# PaddingComponent
2+
3+
```{dartdoc}
4+
:package: flame
5+
:symbol: PaddingComponent
6+
:file: src/experimental/padding_component.dart
7+
```

packages/flame/lib/src/experimental/column_component.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import 'package:flame/src/experimental/linear_layout_component.dart';
22
import 'package:flutter/rendering.dart';
33

4+
/// Warning: Experimental. API and behavior may change.
5+
///
46
/// ColumnComponent is a layout component that arranges its children in a
57
/// vertical column.
68
///
@@ -13,7 +15,7 @@ import 'package:flutter/rendering.dart';
1315
/// If [size] is non-null, behaves as normal explicit sizing.
1416
/// If [size] is null, sets the size to the minimum size that containing all
1517
/// the children. This is similar to setting the [size] to [intrinsicSize], but
16-
/// the distinct in that sizing will respond to changes in children, other
18+
/// distinct in that sizing will respond to changes in children, other
1719
/// properties, etc...
1820
///
1921
/// Example usage:

packages/flame/lib/src/experimental/expanded_component.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import 'package:flame/components.dart';
22
import 'package:flame/experimental.dart';
33

4+
/// Warning: Experimental. API and behavior may change.
5+
///
46
/// Works similarly to flutter's Expanded widget.
57
/// This component must be a direct child of a [LinearLayoutComponent].
68
/// While this component does not do much on its own, it allows its parent
@@ -17,6 +19,18 @@ import 'package:flame/experimental.dart';
1719
/// However, it does need to report to its parent when its child changes size.
1820
/// This is less important along the main-axis, and more important along the
1921
/// cross-axis.
22+
///
23+
/// Example usage:
24+
/// ```dart
25+
/// ColumnComponent(
26+
/// children: [
27+
/// ExpandedComponent(
28+
/// child: TextComponent(text: 'foo'),
29+
/// );
30+
/// TextComponent(text: 'bar')
31+
/// ],
32+
/// );
33+
/// ```
2034
class ExpandedComponent extends SingleLayoutComponent
2135
with ParentIsA<LinearLayoutComponent> {
2236
ExpandedComponent({

packages/flame/lib/src/experimental/padding_component.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ import 'package:flutter/rendering.dart';
1515
///
1616
/// You may set [padding] as well as the [child] after the fact, and it will
1717
/// cause the layout to refresh.
18+
///
19+
/// Example usage:
20+
/// ```dart
21+
/// PaddingComponent(
22+
/// padding: EdgeInsets.all(10),
23+
/// child: TextComponent(text: 'bar')
24+
/// );
25+
/// ```
1826
class PaddingComponent extends SingleLayoutComponent {
1927
PaddingComponent({
2028
super.key,

packages/flame/lib/src/experimental/row_component.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import 'package:flame/src/experimental/linear_layout_component.dart';
22
import 'package:flutter/rendering.dart';
33

4+
/// Warning: Experimental. API and behavior may change.
5+
///
46
/// RowComponent is a layout component that arranges its children in a
57
/// horizontal row.
68
///
@@ -13,7 +15,7 @@ import 'package:flutter/rendering.dart';
1315
/// If [size] is non-null, behaves as normal explicit sizing.
1416
/// If [size] is null, sets the size to the minimum size that containing all
1517
/// the children. This is similar to setting the [size] to [intrinsicSize], but
16-
/// the distinct in that sizing will respond to changes in children, other
18+
/// distinct in that sizing will respond to changes in children, other
1719
/// properties, etc...
1820
///
1921
/// Example usage:

0 commit comments

Comments
 (0)