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
15de4aa4
Unverified
Commit
15de4aa4
authored
Oct 20, 2021
by
Kate Lovett
Committed by
GitHub
Oct 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix persistentFooter padding (#92039)
parent
e593a863
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
7 deletions
+56
-7
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+1
-1
scaffold_test.dart
packages/flutter/test/material/scaffold_test.dart
+55
-6
No files found.
packages/flutter/lib/src/material/scaffold.dart
View file @
15de4aa4
...
...
@@ -2978,7 +2978,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
removeLeftPadding:
false
,
removeTopPadding:
true
,
removeRightPadding:
false
,
removeBottomPadding:
false
,
removeBottomPadding:
widget
.
bottomNavigationBar
!=
null
,
maintainBottomViewPadding:
!
_resizeToAvoidBottomInset
,
);
}
...
...
packages/flutter/test/material/scaffold_test.dart
View file @
15de4aa4
...
...
@@ -497,6 +497,55 @@ void main() {
expect
(
tester
.
getBottomRight
(
buttonsBar
),
const
Offset
(
770.0
,
560.0
));
});
testWidgets
(
'persistentFooterButtons with bottomNavigationBar apply SafeArea properly'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/pull/92039
await
tester
.
pumpWidget
(
MaterialApp
(
home:
MediaQuery
(
data:
const
MediaQueryData
(
// Representing a navigational notch at the bottom of the screen
padding:
EdgeInsets
.
fromLTRB
(
0.0
,
0.0
,
0.0
,
40.0
),
),
child:
Scaffold
(
body:
SingleChildScrollView
(
child:
Container
(
color:
Colors
.
amber
[
500
],
height:
5000.0
,
child:
const
Text
(
'body'
),
),
),
bottomNavigationBar:
BottomNavigationBar
(
items:
const
<
BottomNavigationBarItem
>[
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
home
),
label:
'Home'
,
),
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
business
),
label:
'Business'
,
),
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
school
),
label:
'School'
,
),
],
),
persistentFooterButtons:
const
<
Widget
>[
Placeholder
()],
),
),
),
);
final
Finder
buttonsBar
=
find
.
ancestor
(
of:
find
.
byType
(
OverflowBar
),
matching:
find
.
byType
(
Padding
)).
first
;
// The SafeArea of the persistentFooterButtons should not pad below them
// since they are stacked on top of the bottomNavigationBar. The
// bottomNavigationBar will handle the padding instead.
// 488 represents the height of the persistentFooterButtons, with the bottom
// of the screen being 600. If the 40 pixels of bottom padding were being
// errantly applied, the buttons would be higher (448).
expect
(
tester
.
getTopLeft
(
buttonsBar
),
const
Offset
(
0.0
,
488.0
));
});
testWidgets
(
'Persistent bottom buttons bottom padding is not consumed by viewInsets'
,
(
WidgetTester
tester
)
async
{
final
Widget
child
=
Directionality
(
textDirection:
TextDirection
.
ltr
,
...
...
@@ -974,15 +1023,15 @@ void main() {
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
expect
(
tester
.
getRect
(
find
.
byKey
(
appBar
)),
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
800.0
,
43.0
));
expect
(
tester
.
getRect
(
find
.
byKey
(
body
)),
const
Rect
.
fromLTRB
(
0.0
,
43.0
,
800.0
,
348
.0
));
expect
(
tester
.
getRect
(
find
.
byKey
(
floatingActionButton
)),
rectMoreOrLessEquals
(
const
Rect
.
fromLTRB
(
36.0
,
255.0
,
113.0
,
332
.0
)));
expect
(
tester
.
getRect
(
find
.
byKey
(
persistentFooterButton
)),
const
Rect
.
fromLTRB
(
28.0
,
357.0
,
128.0
,
44
7.0
));
// Note: has 8px each top/bottom padding.
expect
(
tester
.
getRect
(
find
.
byKey
(
body
)),
const
Rect
.
fromLTRB
(
0.0
,
43.0
,
800.0
,
400
.0
));
expect
(
tester
.
getRect
(
find
.
byKey
(
floatingActionButton
)),
rectMoreOrLessEquals
(
const
Rect
.
fromLTRB
(
36.0
,
307.0
,
113.0
,
384
.0
)));
expect
(
tester
.
getRect
(
find
.
byKey
(
persistentFooterButton
)),
const
Rect
.
fromLTRB
(
28.0
,
417.0
,
128.0
,
50
7.0
));
// Note: has 8px each top/bottom padding.
expect
(
tester
.
getRect
(
find
.
byKey
(
drawer
)),
const
Rect
.
fromLTRB
(
596.0
,
0.0
,
800.0
,
600.0
));
expect
(
tester
.
getRect
(
find
.
byKey
(
bottomNavigationBar
)),
const
Rect
.
fromLTRB
(
0.0
,
515.0
,
800.0
,
600.0
));
expect
(
tester
.
getRect
(
find
.
byKey
(
insideAppBar
)),
const
Rect
.
fromLTRB
(
20.0
,
30.0
,
750.0
,
43.0
));
expect
(
tester
.
getRect
(
find
.
byKey
(
insideBody
)),
const
Rect
.
fromLTRB
(
20.0
,
43.0
,
750.0
,
348
.0
));
expect
(
tester
.
getRect
(
find
.
byKey
(
insideFloatingActionButton
)),
rectMoreOrLessEquals
(
const
Rect
.
fromLTRB
(
36.0
,
255.0
,
113.0
,
332
.0
)));
expect
(
tester
.
getRect
(
find
.
byKey
(
insidePersistentFooterButton
)),
const
Rect
.
fromLTRB
(
28.0
,
357.0
,
128.0
,
44
7.0
));
expect
(
tester
.
getRect
(
find
.
byKey
(
insideBody
)),
const
Rect
.
fromLTRB
(
20.0
,
43.0
,
750.0
,
400
.0
));
expect
(
tester
.
getRect
(
find
.
byKey
(
insideFloatingActionButton
)),
rectMoreOrLessEquals
(
const
Rect
.
fromLTRB
(
36.0
,
307.0
,
113.0
,
384
.0
)));
expect
(
tester
.
getRect
(
find
.
byKey
(
insidePersistentFooterButton
)),
const
Rect
.
fromLTRB
(
28.0
,
417.0
,
128.0
,
50
7.0
));
expect
(
tester
.
getRect
(
find
.
byKey
(
insideDrawer
)),
const
Rect
.
fromLTRB
(
596.0
,
30.0
,
750.0
,
540.0
));
expect
(
tester
.
getRect
(
find
.
byKey
(
insideBottomNavigationBar
)),
const
Rect
.
fromLTRB
(
20.0
,
515.0
,
750.0
,
540.0
));
});
...
...
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