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
57dd51a3
Unverified
Commit
57dd51a3
authored
May 03, 2018
by
Ian Hickson
Committed by
GitHub
May 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix documentation for UnconstrainedBox and code cleanup (#17249)
parent
916ed6c4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
29 deletions
+29
-29
shifted_box.dart
packages/flutter/lib/src/rendering/shifted_box.dart
+15
-24
stack.dart
packages/flutter/lib/src/rendering/stack.dart
+6
-0
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+8
-5
No files found.
packages/flutter/lib/src/rendering/shifted_box.dart
View file @
57dd51a3
...
...
@@ -484,7 +484,6 @@ class RenderPositionedBox extends RenderAligningShiftedBox {
/// * [RenderSizedOverflowBox], a render object that is a specific size but
/// passes its original constraints through to its child, which it allows to
/// overflow.
class
RenderConstrainedOverflowBox
extends
RenderAligningShiftedBox
{
/// Creates a render object that lets its child overflow itself.
RenderConstrainedOverflowBox
({
...
...
@@ -584,10 +583,11 @@ class RenderConstrainedOverflowBox extends RenderAligningShiftedBox {
/// render at its "natural" size.
///
/// This allows a child to render at the size it would render if it were alone
/// on an infinite canvas with no constraints. This box will then expand
/// as much as it can within its own constraints and align the child based on
/// [alignment]. If the box cannot expand enough to accommodate the entire
/// child, the child will be clipped.
/// on an infinite canvas with no constraints. This box will then attempt to
/// adopt the same size, within the limits of its own constraints. If it ends
/// up with a different size, it will align the child based on [alignment].
/// If the box cannot expand enough to accommodate the entire child, the
/// child will be clipped.
///
/// In debug mode, if the child overflows the box, a warning will be printed on
/// the console, and black and yellow striped areas will appear where the
...
...
@@ -595,9 +595,9 @@ class RenderConstrainedOverflowBox extends RenderAligningShiftedBox {
///
/// See also:
///
/// * [RenderConstrainedBox]
renders a box which imposes constraints on i
ts
/// child.
/// * [RenderConstrainedOverflowBox], renders a box that imposes different
/// * [RenderConstrainedBox]
, which renders a box which imposes constrain
ts
///
on its
child.
/// * [RenderConstrainedOverflowBox],
which
renders a box that imposes different
/// constraints on its child than it gets from its parent, possibly allowing
/// the child to overflow the parent.
/// * [RenderSizedOverflowBox], a render object that is a specific size but
...
...
@@ -641,40 +641,31 @@ class RenderUnconstrainedBox extends RenderAligningShiftedBox with DebugOverflow
if
(
child
!=
null
)
{
// Let the child lay itself out at it's "natural" size, but if
// constrainedAxis is non-null, keep any constraints on that axis.
BoxConstraints
childConstraints
;
if
(
constrainedAxis
!=
null
)
{
switch
(
constrainedAxis
)
{
case
Axis
.
horizontal
:
child
.
layout
(
new
BoxConstraints
(
maxWidth:
constraints
.
maxWidth
,
minWidth:
constraints
.
minWidth
),
parentUsesSize:
true
,
);
childConstraints
=
new
BoxConstraints
(
maxWidth:
constraints
.
maxWidth
,
minWidth:
constraints
.
minWidth
);
break
;
case
Axis
.
vertical
:
child
.
layout
(
new
BoxConstraints
(
maxHeight:
constraints
.
maxHeight
,
minHeight:
constraints
.
minHeight
),
parentUsesSize:
true
,
);
childConstraints
=
new
BoxConstraints
(
maxHeight:
constraints
.
maxHeight
,
minHeight:
constraints
.
minHeight
);
break
;
}
}
else
{
child
.
layout
(
const
BoxConstraints
(),
parentUsesSize:
true
);
child
Constraints
=
const
BoxConstraints
(
);
}
child
.
layout
(
childConstraints
,
parentUsesSize:
true
);
size
=
constraints
.
constrain
(
child
.
size
);
alignChild
();
final
BoxParentData
childParentData
=
child
.
parentData
;
_overflowContainerRect
=
Offset
.
zero
&
size
;
_overflowChildRect
=
childParentData
.
offset
&
child
.
size
;
}
else
{
size
=
constraints
.
constrain
(
Size
.
zero
)
;
size
=
constraints
.
smallest
;
_overflowContainerRect
=
Rect
.
zero
;
_overflowChildRect
=
Rect
.
zero
;
}
final
RelativeRect
overflow
=
new
RelativeRect
.
fromRect
(
_overflowContainerRect
,
_overflowChildRect
);
_isOverflowing
=
overflow
.
left
>
0.0
||
overflow
.
right
>
0.0
||
overflow
.
top
>
0.0
||
overflow
.
bottom
>
0.0
;
_isOverflowing
=
new
RelativeRect
.
fromRect
(
_overflowContainerRect
,
_overflowChildRect
).
hasInsets
;
}
@override
...
...
packages/flutter/lib/src/rendering/stack.dart
View file @
57dd51a3
...
...
@@ -77,6 +77,12 @@ class RelativeRect {
/// May be negative if the bottom side of the rectangle is outside of the container.
final
double
bottom
;
/// Returns whether any of the values are greater than zero.
///
/// This corresponds to one of the sides ([left], [top], [right], or [bottom]) having
/// some positive inset towards the center.
bool
get
hasInsets
=>
left
>
0.0
||
top
>
0.0
||
right
>
0.0
||
bottom
>
0.0
;
/// Returns a new rectangle object translated by the given offset.
RelativeRect
shift
(
Offset
offset
)
{
return
new
RelativeRect
.
fromLTRB
(
left
+
offset
.
dx
,
top
+
offset
.
dy
,
right
-
offset
.
dx
,
bottom
-
offset
.
dy
);
...
...
packages/flutter/lib/src/widgets/basic.dart
View file @
57dd51a3
...
...
@@ -1775,10 +1775,11 @@ class ConstrainedBox extends SingleChildRenderObjectWidget {
/// at its "natural" size.
///
/// This allows a child to render at the size it would render if it were alone
/// on an infinite canvas with no constraints. This container will then expand
/// as much as it can within its own constraints and align the child based on
/// [alignment]. If the container cannot expand enough to accommodate the
/// entire child, the child will be clipped.
/// on an infinite canvas with no constraints. This container will then attempt
/// to adopt the same size, within the limits of its own constraints. If it ends
/// up with a different size, it will align the child based on [alignment].
/// If the box cannot expand enough to accommodate the entire child, the
/// child will be clipped.
///
/// In debug mode, if the child overflows the container, a warning will be
/// printed on the console, and black and yellow striped areas will appear where
...
...
@@ -1786,7 +1787,9 @@ class ConstrainedBox extends SingleChildRenderObjectWidget {
///
/// See also:
///
/// * [ConstrainedBox] for a box which imposes constraints on its child.
/// * [ConstrainedBox], for a box which imposes constraints on its child.
/// * [Align], which loosens the constraints given to the child rather than
/// removing them entirely.
/// * [Container], a convenience widget that combines common painting,
/// positioning, and sizing widgets.
/// * [OverflowBox], a widget that imposes different constraints on its child
...
...
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