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
f757211f
Commit
f757211f
authored
Jan 11, 2016
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1171 from Hixie/constraints
Merge Container's width, height, and constraints
parents
c262842e
0379744c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
23 deletions
+10
-23
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+10
-23
No files found.
packages/flutter/lib/src/widgets/basic.dart
View file @
f757211f
...
...
@@ -816,15 +816,20 @@ class Container extends StatelessComponent {
Container
({
Key
key
,
this
.
child
,
this
.
constraints
,
BoxConstraints
constraints
,
this
.
decoration
,
this
.
foregroundDecoration
,
this
.
margin
,
this
.
padding
,
this
.
transform
,
this
.
width
,
this
.
height
})
:
super
(
key:
key
)
{
double
width
,
double
height
})
:
constraints
=
(
width
!=
null
||
height
!=
null
)
?
constraints
?.
tighten
(
width:
width
,
height:
height
)
??
new
BoxConstraints
.
tightFor
(
width:
width
,
height:
height
)
:
constraints
,
super
(
key:
key
)
{
assert
(
margin
==
null
||
margin
.
isNonNegative
);
assert
(
padding
==
null
||
padding
.
isNonNegative
);
assert
(
decoration
==
null
||
decoration
.
debugAssertValid
());
...
...
@@ -853,12 +858,6 @@ class Container extends StatelessComponent {
/// The transformation matrix to apply before painting the container.
final
Matrix4
transform
;
/// If non-null, requires the decoration to have this width.
final
double
width
;
/// If non-null, requires the decoration to have this height.
final
double
height
;
EdgeDims
get
_paddingIncludingDecoration
{
if
(
decoration
==
null
||
decoration
.
padding
==
null
)
return
padding
;
...
...
@@ -871,7 +870,7 @@ class Container extends StatelessComponent {
Widget
build
(
BuildContext
context
)
{
Widget
current
=
child
;
if
(
child
==
null
&&
(
width
==
null
||
height
==
null
))
if
(
child
==
null
&&
(
constraints
==
null
||
!
constraints
.
isTight
))
current
=
new
ConstrainedBox
(
constraints:
const
BoxConstraints
.
expand
());
EdgeDims
effectivePadding
=
_paddingIncludingDecoration
;
...
...
@@ -889,14 +888,6 @@ class Container extends StatelessComponent {
);
}
if
(
width
!=
null
||
height
!=
null
)
{
current
=
new
SizedBox
(
width:
width
,
height:
height
,
child:
current
);
}
if
(
constraints
!=
null
)
current
=
new
ConstrainedBox
(
constraints:
constraints
,
child:
current
);
...
...
@@ -923,10 +914,6 @@ class Container extends StatelessComponent {
description
.
add
(
'padding:
$padding
'
);
if
(
transform
!=
null
)
description
.
add
(
'has transform'
);
if
(
width
!=
null
)
description
.
add
(
'width:
$width
'
);
if
(
height
!=
null
)
description
.
add
(
'height:
$height
'
);
}
}
...
...
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