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
932f7cef
Commit
932f7cef
authored
Feb 26, 2017
by
Adam Barth
Committed by
GitHub
Feb 26, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Scaffold shouldn't assert with large bottom padding (#8415)
Fixes #8413
parent
87f1487e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
4 deletions
+43
-4
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+3
-4
scaffold_test.dart
packages/flutter/test/material/scaffold_test.dart
+40
-0
No files found.
packages/flutter/lib/src/material/scaffold.dart
View file @
932f7cef
...
@@ -48,7 +48,7 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
...
@@ -48,7 +48,7 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
@override
@override
void
performLayout
(
Size
size
)
{
void
performLayout
(
Size
size
)
{
BoxConstraints
looseConstraints
=
new
BoxConstraints
.
loose
(
size
);
final
BoxConstraints
looseConstraints
=
new
BoxConstraints
.
loose
(
size
);
// This part of the layout has the same effect as putting the app bar and
// This part of the layout has the same effect as putting the app bar and
// body in a column and making the body flexible. What's different is that
// body in a column and making the body flexible. What's different is that
...
@@ -56,8 +56,8 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
...
@@ -56,8 +56,8 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
// so the app bar's shadow is drawn on top of the body.
// so the app bar's shadow is drawn on top of the body.
final
BoxConstraints
fullWidthConstraints
=
looseConstraints
.
tighten
(
width:
size
.
width
);
final
BoxConstraints
fullWidthConstraints
=
looseConstraints
.
tighten
(
width:
size
.
width
);
final
double
bottom
=
math
.
max
(
0.0
,
size
.
height
-
padding
.
bottom
);
double
contentTop
=
0.0
;
double
contentTop
=
0.0
;
double
bottom
=
size
.
height
-
padding
.
bottom
;
double
contentBottom
=
bottom
;
double
contentBottom
=
bottom
;
if
(
hasChild
(
_ScaffoldSlot
.
appBar
))
{
if
(
hasChild
(
_ScaffoldSlot
.
appBar
))
{
...
@@ -78,10 +78,9 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
...
@@ -78,10 +78,9 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
}
}
if
(
hasChild
(
_ScaffoldSlot
.
body
))
{
if
(
hasChild
(
_ScaffoldSlot
.
body
))
{
final
double
bodyHeight
=
contentBottom
-
contentTop
;
final
BoxConstraints
bodyConstraints
=
new
BoxConstraints
(
final
BoxConstraints
bodyConstraints
=
new
BoxConstraints
(
maxWidth:
fullWidthConstraints
.
maxWidth
,
maxWidth:
fullWidthConstraints
.
maxWidth
,
maxHeight:
bodyHeight
,
maxHeight:
math
.
max
(
0.0
,
contentBottom
-
contentTop
)
,
);
);
layoutChild
(
_ScaffoldSlot
.
body
,
bodyConstraints
);
layoutChild
(
_ScaffoldSlot
.
body
,
bodyConstraints
);
positionChild
(
_ScaffoldSlot
.
body
,
new
Offset
(
0.0
,
contentTop
));
positionChild
(
_ScaffoldSlot
.
body
,
new
Offset
(
0.0
,
contentTop
));
...
...
packages/flutter/test/material/scaffold_test.dart
View file @
932f7cef
...
@@ -41,6 +41,46 @@ void main() {
...
@@ -41,6 +41,46 @@ void main() {
expect
(
bodyBox
.
size
,
equals
(
const
Size
(
800.0
,
544.0
)));
expect
(
bodyBox
.
size
,
equals
(
const
Size
(
800.0
,
544.0
)));
});
});
testWidgets
(
'Scaffold large bottom padding test'
,
(
WidgetTester
tester
)
async
{
Key
bodyKey
=
new
UniqueKey
();
await
tester
.
pumpWidget
(
new
MediaQuery
(
data:
new
MediaQueryData
(
padding:
const
EdgeInsets
.
only
(
bottom:
700.0
),
),
child:
new
Scaffold
(
body:
new
Container
(
key:
bodyKey
),
),
));
RenderBox
bodyBox
=
tester
.
renderObject
(
find
.
byKey
(
bodyKey
));
expect
(
bodyBox
.
size
,
equals
(
const
Size
(
800.0
,
0.0
)));
await
tester
.
pumpWidget
(
new
MediaQuery
(
data:
new
MediaQueryData
(
padding:
const
EdgeInsets
.
only
(
bottom:
500.0
),
),
child:
new
Scaffold
(
body:
new
Container
(
key:
bodyKey
),
),
));
expect
(
bodyBox
.
size
,
equals
(
const
Size
(
800.0
,
100.0
)));
await
tester
.
pumpWidget
(
new
MediaQuery
(
data:
new
MediaQueryData
(
padding:
const
EdgeInsets
.
only
(
bottom:
580.0
),
),
child:
new
Scaffold
(
appBar:
new
AppBar
(
title:
new
Text
(
'Title'
),
),
body:
new
Container
(
key:
bodyKey
),
),
));
expect
(
bodyBox
.
size
,
equals
(
const
Size
(
800.0
,
0.0
)));
});
testWidgets
(
'Floating action animation'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Floating action animation'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
Scaffold
(
await
tester
.
pumpWidget
(
new
Scaffold
(
floatingActionButton:
new
FloatingActionButton
(
floatingActionButton:
new
FloatingActionButton
(
...
...
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