Skip to content

Commit 0ed64e1

Browse files
blueneogeogitbook-bot
authored andcommitted
GitBook: [master] 2 pages modified
1 parent 2d46c8e commit 0ed64e1

File tree

2 files changed

+39
-4
lines changed

2 files changed

+39
-4
lines changed

guide/adding-content.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Creating widget layouts
22

3+
## Overview
4+
35
In Flutter, widget trees are built by passing a child or children. Widget trees have a lot of indentation, especially since in Flutter nearly everything is a widget, and composition is preferred to inheritance. This can lead to complex nesting and child parameters.
46

57
Flutter-views are optimised for building widget trees. Pug in particular is well suited for creating tree structures and moving parts around.
@@ -161,6 +163,40 @@ return Container(
161163

162164
This has the same generated result but is cleaner.
163165

166+
### Passing children instead of child
167+
168+
There may be cases where flutter-view does not recognise your tag needs a children parameter instead of a child parameter. In that case use and array and assign it as children:
169+
170+
{% tabs %}
171+
{% tab title="Pug" %}
172+
```css
173+
column
174+
array(as='children')
175+
row first!
176+
row second!
177+
```
178+
{% endtab %}
179+
180+
{% tab title="generated Dart" %}
181+
```dart
182+
Column(
183+
children: [
184+
Row(
185+
children: [
186+
Text('first!'),
187+
]
188+
),
189+
Row(
190+
children: [
191+
Text('second!'),
192+
]
193+
),
194+
]
195+
)
196+
```
197+
{% endtab %}
198+
{% endtabs %}
199+
164200
## Passing parameters
165201

166202
To pass parameters besides child or children, you pass them as pug/html parameters.

guide/styling-with-css.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,15 @@ card
119119

120120
We have a layout, and now we can style it.
121121

122-
The "buy tickets" and "listen" FlatButtons we want to have uppercase text:
122+
The "buy tickets" and "listen" FlatButtons we want to have uppercase text. We can use the **text-transform** shortcut:
123123

124124
```css
125125
flat-button
126126
.label
127127
text-transform: uppercase
128128
```
129129

130-
We want the card to be blue and the column of the card to have `mainAxisSize: MainAxisSize.min`:
130+
We want the card to be blue and the column of the card to have `mainAxisSize: MainAxisSize.min`:. Here we can use the [**color**](../reference/css-properties.md#color-color) shortcut, so we can use CSS colors, and the [**main-axis-size**](../reference/css-properties.md#box-shadow-7) shortcut, which lets us simply use 'min':
131131

132132
```css
133133
card
@@ -136,11 +136,10 @@ card
136136
main-axis-size: min
137137
```
138138

139-
We want to give some padding to the title and subtitle, and give each slightly different colors:
139+
We want to give some padding to the title and subtitle, and give each slightly different colors. [**Padding**](../reference/css-properties.md#padding) and [**margin**](../reference/css-properties.md#margin) are shortcuts that adhere to CSS standards:
140140

141141
```css
142142
card
143-
$title-color: grey[300]
144143
list-tile
145144
.title
146145
color: white

0 commit comments

Comments
 (0)