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
62fc9d85
Commit
62fc9d85
authored
Jul 17, 2015
by
Collin Jackson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Track overflow during flex layout
parent
65d47af7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
flex.dart
packages/flutter/lib/rendering/flex.dart
+15
-2
No files found.
packages/flutter/lib/rendering/flex.dart
View file @
62fc9d85
...
...
@@ -81,6 +81,8 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
}
}
bool
_overflowOccurredDuringLayout
=
false
;
void
setupParentData
(
RenderBox
child
)
{
if
(
child
.
parentData
is
!
FlexBoxParentData
)
child
.
parentData
=
new
FlexBoxParentData
();
...
...
@@ -376,16 +378,20 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
break
;
}
Size
desiredSize
;
switch
(
_direction
)
{
case
FlexDirection
.
horizontal
:
size
=
constraints
.
constrain
(
new
Size
(
mainSize
,
crossSize
));
desiredSize
=
new
Size
(
mainSize
,
crossSize
);
size
=
constraints
.
constrain
(
desiredSize
);
crossSize
=
size
.
height
;
break
;
case
FlexDirection
.
vertical
:
desiredSize
=
new
Size
(
crossSize
,
mainSize
);
size
=
constraints
.
constrain
(
new
Size
(
crossSize
,
mainSize
));
crossSize
=
size
.
width
;
break
;
}
_overflowOccurredDuringLayout
=
desiredSize
!=
size
;
// Position elements
double
childMainPosition
=
leadingSpace
;
...
...
@@ -433,6 +439,13 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
}
void
paint
(
PaintingCanvas
canvas
,
Offset
offset
)
{
defaultPaint
(
canvas
,
offset
);
if
(
_overflowOccurredDuringLayout
)
{
canvas
.
save
();
canvas
.
clipRect
(
offset
&
size
);
defaultPaint
(
canvas
,
offset
);
canvas
.
restore
();
}
else
{
defaultPaint
(
canvas
,
offset
);
}
}
}
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