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
954b35bf
Commit
954b35bf
authored
Apr 06, 2017
by
Adam Barth
Committed by
GitHub
Apr 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some more asserts to RenderFlex (#9209)
parent
2f483542
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
2 deletions
+23
-2
flex.dart
packages/flutter/lib/src/rendering/flex.dart
+23
-2
No files found.
packages/flutter/lib/src/rendering/flex.dart
View file @
954b35bf
...
...
@@ -163,6 +163,10 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
_mainAxisSize
=
mainAxisSize
,
_crossAxisAlignment
=
crossAxisAlignment
,
_textBaseline
=
textBaseline
{
assert
(
direction
!=
null
);
assert
(
mainAxisAlignment
!=
null
);
assert
(
mainAxisSize
!=
null
);
assert
(
crossAxisAlignment
!=
null
);
addAll
(
children
);
}
...
...
@@ -170,6 +174,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
Axis
get
direction
=>
_direction
;
Axis
_direction
;
set
direction
(
Axis
value
)
{
assert
(
value
!=
null
);
if
(
_direction
!=
value
)
{
_direction
=
value
;
markNeedsLayout
();
...
...
@@ -200,6 +205,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
MainAxisSize
get
mainAxisSize
=>
_mainAxisSize
;
MainAxisSize
_mainAxisSize
;
set
mainAxisSize
(
MainAxisSize
value
)
{
assert
(
value
!=
null
);
if
(
_mainAxisSize
!=
value
)
{
_mainAxisSize
=
value
;
markNeedsLayout
();
...
...
@@ -210,6 +216,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
CrossAxisAlignment
get
crossAxisAlignment
=>
_crossAxisAlignment
;
CrossAxisAlignment
_crossAxisAlignment
;
set
crossAxisAlignment
(
CrossAxisAlignment
value
)
{
assert
(
value
!=
null
);
if
(
_crossAxisAlignment
!=
value
)
{
_crossAxisAlignment
=
value
;
markNeedsLayout
();
...
...
@@ -217,6 +224,8 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
}
/// If aligning items according to their baseline, which baseline to use.
///
/// Must not be null if [crossAxisAlignment] is [CrossAxisAlignment.baseline].
TextBaseline
get
textBaseline
=>
_textBaseline
;
TextBaseline
_textBaseline
;
set
textBaseline
(
TextBaseline
value
)
{
...
...
@@ -370,11 +379,23 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
}
double
_getCrossSize
(
RenderBox
child
)
{
return
(
_direction
==
Axis
.
horizontal
)
?
child
.
size
.
height
:
child
.
size
.
width
;
switch
(
_direction
)
{
case
Axis
.
horizontal
:
return
child
.
size
.
height
;
case
Axis
.
vertical
:
return
child
.
size
.
width
;
}
return
null
;
}
double
_getMainSize
(
RenderBox
child
)
{
return
(
_direction
==
Axis
.
horizontal
)
?
child
.
size
.
width
:
child
.
size
.
height
;
switch
(
_direction
)
{
case
Axis
.
horizontal
:
return
child
.
size
.
width
;
case
Axis
.
vertical
:
return
child
.
size
.
height
;
}
return
null
;
}
@override
...
...
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