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
1203b08b
Commit
1203b08b
authored
Sep 30, 2015
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1402 from Hixie/overflow
Change OverflowBox API to allow min and max values
parents
9cb9eaf5
eec9833f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
41 deletions
+74
-41
basic.dart
packages/flutter/lib/src/fn3/basic.dart
+13
-7
snack_bar.dart
packages/flutter/lib/src/fn3/snack_bar.dart
+2
-1
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+59
-33
No files found.
packages/flutter/lib/src/fn3/basic.dart
View file @
1203b08b
...
...
@@ -230,20 +230,26 @@ class SizedBox extends OneChildRenderObjectWidget {
}
class
OverflowBox
extends
OneChildRenderObjectWidget
{
OverflowBox
({
Key
key
,
this
.
width
,
this
.
h
eight
,
Widget
child
})
OverflowBox
({
Key
key
,
this
.
minWidth
,
this
.
maxWidth
,
this
.
minHeight
,
this
.
maxH
eight
,
Widget
child
})
:
super
(
key:
key
,
child:
child
);
final
double
width
;
final
double
height
;
final
double
minWidth
;
final
double
maxWidth
;
final
double
minHeight
;
final
double
maxHeight
;
RenderOverflowBox
createRenderObject
()
=>
new
RenderOverflowBox
(
innerWidth:
width
,
innerHeight:
height
minWidth:
minWidth
,
maxWidth:
maxWidth
,
minHeight:
minHeight
,
maxHeight:
maxHeight
);
void
updateRenderObject
(
RenderOverflowBox
renderObject
,
OverflowBox
oldWidget
)
{
renderObject
.
innerWidth
=
width
;
renderObject
.
innerHeight
=
height
;
renderObject
.
minWidth
=
minWidth
;
renderObject
.
maxWidth
=
maxWidth
;
renderObject
.
minHeight
=
minHeight
;
renderObject
.
maxHeight
=
maxHeight
;
}
}
...
...
packages/flutter/lib/src/fn3/snack_bar.dart
View file @
1203b08b
...
...
@@ -90,7 +90,8 @@ class SnackBarState extends AnimatedState<SnackBar> {
),
child:
new
ClipRect
(
child:
new
OverflowBox
(
height:
kSnackHeight
,
minHeight:
kSnackHeight
,
maxHeight:
kSnackHeight
,
child:
new
Material
(
level:
2
,
color:
kSnackBackground
,
...
...
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
1203b08b
...
...
@@ -150,57 +150,81 @@ class RenderConstrainedBox extends RenderProxyBox {
///
/// A render overflow box proxies most functions in the render box protocol to
/// its child, except that when laying out its child, it passes constraints
/// based on the innerWidth and innerHeight fields instead of just passing the
/// parent's constraints in. It then sizes itself based on the parent's
/// constraints' maxWidth and maxHeight, ignoring the child's dimensions.
/// based on the minWidth, maxWidth, minHeight, and maxHeight fields instead of
/// just passing the parent's constraints in. Specifically, it overrides any of
/// the equivalent fields on the constraints given by the parent with the
/// constraints given by these fields for each such field that is not null. It
/// then sizes itself based on the parent's constraints' maxWidth and maxHeight,
/// ignoring the child's dimensions.
///
/// For example, if you wanted a box to always render 50
x50, regardless of where
///
it was rendered, you would wrap it in a RenderOverflow with innerWidth and
///
innerHeight members
set to 50.0. Generally speaking, to avoid confusing
/// For example, if you wanted a box to always render 50
pixels high, regardless
///
of where it was rendered, you would wrap it in a RenderOverflow with
///
minHeight and maxHeight
set to 50.0. Generally speaking, to avoid confusing
/// behaviour around hit testing, a RenderOverflowBox should usually be wrapped
/// in a RenderClipRect.
///
/// The child is positioned at the top left of the box. To position a smaller
/// child inside a larger parent, use [RenderPositionedBox] and
/// [RenderConstrainedBox] rather than RenderOverflowBox.
///
/// If you pass null for innerWidth or innerHeight, the constraints from the
/// parent are passed instead.
class
RenderOverflowBox
extends
RenderProxyBox
{
RenderOverflowBox
({
RenderBox
child
,
double
innerWidth
,
double
innerHeight
})
:
_innerWidth
=
innerWidth
,
_innerHeight
=
innerHeight
,
super
(
child
);
/// The tight width constraint to give the child. Set this to null (the
/// default) to use the constraints from the parent instead.
double
get
innerWidth
=>
_innerWidth
;
double
_innerWidth
;
void
set
innerWidth
(
double
value
)
{
if
(
_innerWidth
==
value
)
double
minWidth
,
double
maxWidth
,
double
minHeight
,
double
maxHeight
})
:
_minWidth
=
minWidth
,
_maxWidth
=
maxWidth
,
_minHeight
=
minHeight
,
_maxHeight
=
maxHeight
,
super
(
child
);
/// The minimum width constraint to give the child. Set this to null (the
/// default) to use the constraint from the parent instead.
double
get
minWidth
=>
_minWidth
;
double
_minWidth
;
void
set
minWidth
(
double
value
)
{
if
(
_minWidth
==
value
)
return
;
_minWidth
=
value
;
markNeedsLayout
();
}
/// The maximum width constraint to give the child. Set this to null (the
/// default) to use the constraint from the parent instead.
double
get
maxWidth
=>
_maxWidth
;
double
_maxWidth
;
void
set
maxWidth
(
double
value
)
{
if
(
_maxWidth
==
value
)
return
;
_maxWidth
=
value
;
markNeedsLayout
();
}
/// The minimum height constraint to give the child. Set this to null (the
/// default) to use the constraint from the parent instead.
double
get
minHeight
=>
_minHeight
;
double
_minHeight
;
void
set
minHeight
(
double
value
)
{
if
(
_minHeight
==
value
)
return
;
_
innerWidth
=
value
;
_
minHeight
=
value
;
markNeedsLayout
();
}
/// The
tight
height constraint to give the child. Set this to null (the
/// default) to use the constraint
s
from the parent instead.
double
get
innerHeight
=>
_inner
Height
;
double
_
inner
Height
;
void
set
inner
Height
(
double
value
)
{
if
(
_
inner
Height
==
value
)
/// The
maximum
height constraint to give the child. Set this to null (the
/// default) to use the constraint from the parent instead.
double
get
maxHeight
=>
_max
Height
;
double
_
max
Height
;
void
set
max
Height
(
double
value
)
{
if
(
_
max
Height
==
value
)
return
;
_
inner
Height
=
value
;
_
max
Height
=
value
;
markNeedsLayout
();
}
BoxConstraints
childConstraints
(
BoxConstraints
constraints
)
{
return
new
BoxConstraints
(
minWidth:
_
inner
Width
??
constraints
.
minWidth
,
maxWidth:
_
inner
Width
??
constraints
.
maxWidth
,
minHeight:
_
inner
Height
??
constraints
.
minHeight
,
maxHeight:
_
inner
Height
??
constraints
.
maxHeight
minWidth:
_
min
Width
??
constraints
.
minWidth
,
maxWidth:
_
max
Width
??
constraints
.
maxWidth
,
minHeight:
_
min
Height
??
constraints
.
minHeight
,
maxHeight:
_
max
Height
??
constraints
.
maxHeight
);
}
...
...
@@ -233,8 +257,10 @@ class RenderOverflowBox extends RenderProxyBox {
String
debugDescribeSettings
(
String
prefix
)
{
return
'
${super.debugDescribeSettings(prefix)}
'
+
'
${prefix}
innerWidth:
${innerWidth ?? "use parent width constraints"}
\n
'
+
'
${prefix}
innerHeight:
${innerHeight ?? "use parent height constraints"}
\n
'
;
'
${prefix}
minWidth:
${minWidth ?? "use parent minWidth constraint"}
\n
'
+
'
${prefix}
maxWidth:
${maxWidth ?? "use parent maxWidth constraint"}
\n
'
+
'
${prefix}
minHeight:
${minHeight ?? "use parent minHeight constraint"}
\n
'
+
'
${prefix}
maxHeight:
${maxHeight ?? "use parent maxHeight constraint"}
\n
'
;
}
}
...
...
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