Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
851e8054
Commit
851e8054
authored
Aug 02, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add documentation about layout models
parent
64c9b3dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
7 deletions
+40
-7
widgets.md
packages/flutter/lib/widgets/widgets.md
+40
-7
No files found.
packages/flutter/lib/widgets/widgets.md
View file @
851e8054
...
...
@@ -26,13 +26,38 @@ order to make them easier to use.
Layout models
-------------
-
`Flex`
Layout a list of child widgets along either a horizontal or vertical
axis.
-
`Flexible`
Mark this child of a
`Flex`
layout as being flexible.
-
`Flex`
Layout a list of child widgets in either the horizontal or vertical
`direction`
. The direction along which the widgets are laid out is called the
*main*
direction and the other axis is called the
*cross*
direction. A
`Flex`
widget sizes itself to the maximum size permitted by its parent.
Each child of a
`Flex`
widget is either
*flexible*
or
*inflexible*
. The flex
first lays out its inflexible children and subtracts their total length along
the main direction to determine how much free space is available. The flex
then divides this free space among the flexible children in a ratio
determined by their
`flex`
properties.
The
`alignItems`
property determines how children are positioned in the cross
direction. The
`justifyContent`
property determines how the remaining free
space (if any) in the main direction is allocated.
-
`Flexible`
Mark this child as being flexible with the given
`flex`
ratio.
-
`Stack`
Layout a list of child widgets on top of each other from back to
front.
-
`Positioned`
front. Each child of a
`Stack`
widget is either
*positioned*
or
*non-positioned*
. The stack sizes itself to the contain all the
non-positioned children, which are located at the top-left corner of the
stack. The
*positioned*
children are then located relative to the stack
according to their
`top`
,
`right`
,
`bottom`
, and
`left`
properties.
- `Positioned` Mark this child as *positioned*. If the `top` property is
non-null, the top edge of this child will be positioned `top` layout units
from the top of the stack widget. The `right`, `bottom`, and `right`
properties work analogously. Note that if the both the `top` and `bottom`
properties are non-null, then the child will be forced to have exactly the
height required to satisfy both constraints. Similarly, setting the
`right` and `left` properties to non-null values will force the child to
have a particular width.
-
`Block`
Layout a list of child widgets in a vertical line. Each child's width
is set to the widget of the block, and each child is positioned directly
...
...
@@ -105,7 +130,15 @@ Painting effects
-
`DecoratedBox`
Draw the given
`BoxDecoration`
surrounding the child widget.
-
`CustomPaint`
TODO(abarth): Document this widget.
-
`ColorFilter`
Applies a color filter to the child widget, for example to
tint the child a given color.
-
`CustomPaint`
Calls
`callback`
during the paint phase with the current
`Canvas`
and
`Size`
. The widget occupies the region of the canvas starting at
the origin (i.e.,
`x = 0.0`
and
`y = 0.0`
) and of the given size (i.e.,
`x = size.width`
and
`y = size.height`
).
Use the
`token`
to invalidate the painting. As long as the any new
`token`
is
`operator==`
the current
`token`
, the
`CustomPaint`
widget is permitted
to retain a recording of the painting produced by the previous
`callback`
call.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment