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
0a88d820
Unverified
Commit
0a88d820
authored
Jun 07, 2022
by
xubaolin
Committed by
GitHub
Jun 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix a _ScaffoldLayout delegate update bug (#104954)
parent
80bfc8f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
8 deletions
+45
-8
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+8
-7
scaffold_test.dart
packages/flutter/test/material/scaffold_test.dart
+37
-1
No files found.
packages/flutter/lib/src/material/scaffold.dart
View file @
0a88d820
...
...
@@ -1144,12 +1144,13 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
@override
bool
shouldRelayout
(
_ScaffoldLayout
oldDelegate
)
{
return
oldDelegate
.
minInsets
!=
minInsets
||
oldDelegate
.
textDirection
!=
textDirection
||
oldDelegate
.
floatingActionButtonMoveAnimationProgress
!=
floatingActionButtonMoveAnimationProgress
||
oldDelegate
.
previousFloatingActionButtonLocation
!=
previousFloatingActionButtonLocation
||
oldDelegate
.
currentFloatingActionButtonLocation
!=
currentFloatingActionButtonLocation
||
oldDelegate
.
extendBody
!=
extendBody
||
oldDelegate
.
extendBodyBehindAppBar
!=
extendBodyBehindAppBar
;
||
oldDelegate
.
minViewPadding
!=
minViewPadding
||
oldDelegate
.
textDirection
!=
textDirection
||
oldDelegate
.
floatingActionButtonMoveAnimationProgress
!=
floatingActionButtonMoveAnimationProgress
||
oldDelegate
.
previousFloatingActionButtonLocation
!=
previousFloatingActionButtonLocation
||
oldDelegate
.
currentFloatingActionButtonLocation
!=
currentFloatingActionButtonLocation
||
oldDelegate
.
extendBody
!=
extendBody
||
oldDelegate
.
extendBodyBehindAppBar
!=
extendBodyBehindAppBar
;
}
}
...
...
@@ -2861,7 +2862,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
// The minimum viewPadding for interactive elements positioned by the
// Scaffold to keep within safe interactive areas.
final
EdgeInsets
minViewPadding
=
mediaQuery
.
viewPadding
.
copyWith
(
bottom:
_resizeToAvoidBottomInset
&&
mediaQuery
.
viewInsets
.
bottom
!=
0.0
?
0.0
:
null
,
bottom:
_resizeToAvoidBottomInset
&&
mediaQuery
.
viewInsets
.
bottom
!=
0.0
?
0.0
:
null
,
);
// extendBody locked when keyboard is open
...
...
packages/flutter/test/material/scaffold_test.dart
View file @
0a88d820
...
...
@@ -276,12 +276,17 @@ void main() {
await
tester
.
pumpWidget
(
MediaQuery
(
data:
const
MediaQueryData
(
p
adding:
EdgeInsets
.
only
(
bottom:
20.0
),
viewP
adding:
EdgeInsets
.
only
(
bottom:
20.0
),
),
child:
child
,
),
);
final
Offset
initialPoint
=
tester
.
getCenter
(
find
.
byType
(
Placeholder
));
expect
(
tester
.
getBottomLeft
(
find
.
byType
(
Placeholder
)).
dy
,
moreOrLessEquals
(
600.0
-
20.0
-
kFloatingActionButtonMargin
)
);
// Consume bottom padding - as if by the keyboard opening
await
tester
.
pumpWidget
(
MediaQuery
(
...
...
@@ -296,6 +301,37 @@ void main() {
expect
(
initialPoint
,
finalPoint
);
});
testWidgets
(
'viewPadding change should trigger _ScaffoldLayout re-layout'
,
(
WidgetTester
tester
)
async
{
Widget
buildFrame
(
EdgeInsets
viewPadding
)
{
return
MediaQuery
(
data:
MediaQueryData
(
viewPadding:
viewPadding
,
),
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Scaffold
(
resizeToAvoidBottomInset:
false
,
body:
Container
(),
floatingActionButton:
const
Placeholder
(),
),
),
);
}
await
tester
.
pumpWidget
(
buildFrame
(
const
EdgeInsets
.
only
(
bottom:
300
)));
final
RenderBox
renderBox
=
tester
.
renderObject
<
RenderBox
>(
find
.
byType
(
CustomMultiChildLayout
));
expect
(
renderBox
.
debugNeedsLayout
,
false
);
await
tester
.
pumpWidget
(
buildFrame
(
const
EdgeInsets
.
only
(
bottom:
400
)),
null
,
EnginePhase
.
build
,
);
expect
(
renderBox
.
debugNeedsLayout
,
true
);
});
testWidgets
(
'Drawer scrolling'
,
(
WidgetTester
tester
)
async
{
final
Key
drawerKey
=
UniqueKey
();
const
double
appBarHeight
=
256.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