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
ea28f287
Unverified
Commit
ea28f287
authored
Jun 16, 2022
by
xubaolin
Committed by
GitHub
Jun 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix a Scaffold extendBodyBehindAppBar update bug (#104958)
parent
512e090d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
45 deletions
+70
-45
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+0
-4
scaffold_test.dart
packages/flutter/test/material/scaffold_test.dart
+35
-0
interactive_viewer_test.dart
packages/flutter/test/widgets/interactive_viewer_test.dart
+8
-12
nested_scroll_view_test.dart
packages/flutter/test/widgets/nested_scroll_view_test.dart
+27
-29
No files found.
packages/flutter/lib/src/material/scaffold.dart
View file @
ea28f287
...
...
@@ -875,10 +875,6 @@ class _BodyBuilder extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
if
(!
extendBody
&&
!
extendBodyBehindAppBar
)
{
return
body
;
}
return
LayoutBuilder
(
builder:
(
BuildContext
context
,
BoxConstraints
constraints
)
{
final
_BodyBoxConstraints
bodyConstraints
=
constraints
as
_BodyBoxConstraints
;
...
...
packages/flutter/test/material/scaffold_test.dart
View file @
ea28f287
...
...
@@ -11,6 +11,39 @@ import 'package:flutter_test/flutter_test.dart';
import
'../widgets/semantics_tester.dart'
;
void
main
(
)
{
// Regression test for https://github.com/flutter/flutter/issues/103741
testWidgets
(
'extendBodyBehindAppBar change should not cause the body widget lose state'
,
(
WidgetTester
tester
)
async
{
final
ScrollController
controller
=
ScrollController
();
Widget
buildFrame
({
required
bool
extendBodyBehindAppBar
})
{
return
MediaQuery
(
data:
const
MediaQueryData
(),
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Scaffold
(
extendBodyBehindAppBar:
extendBodyBehindAppBar
,
resizeToAvoidBottomInset:
false
,
body:
SingleChildScrollView
(
controller:
controller
,
child:
const
FlutterLogo
(
size:
1107
,
),
),
),
),
);
}
await
tester
.
pumpWidget
(
buildFrame
(
extendBodyBehindAppBar:
true
));
expect
(
controller
.
position
.
pixels
,
0.0
);
controller
.
jumpTo
(
100.0
);
await
tester
.
pump
();
expect
(
controller
.
position
.
pixels
,
100.0
);
await
tester
.
pumpWidget
(
buildFrame
(
extendBodyBehindAppBar:
false
));
expect
(
controller
.
position
.
pixels
,
100.0
);
});
testWidgets
(
'Scaffold drawer callback test'
,
(
WidgetTester
tester
)
async
{
bool
isDrawerOpen
=
false
;
bool
isEndDrawerOpen
=
false
;
...
...
@@ -2401,6 +2434,8 @@ void main() {
' ancestor was:
\n
'
' Builder
\n
'
' The ancestors of this widget were:
\n
'
' MediaQuery
\n
'
' LayoutBuilder
\n
'
' _BodyBuilder
\n
'
' MediaQuery
\n
'
' LayoutId-[<_ScaffoldSlot.body>]
\n
'
...
...
packages/flutter/test/widgets/interactive_viewer_test.dart
View file @
ea28f287
...
...
@@ -1269,11 +1269,9 @@ void main() {
testWidgets
(
'LayoutBuilder is only used for InteractiveViewer.builder'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Center
(
child:
InteractiveViewer
(
child:
const
SizedBox
(
width:
200.0
,
height:
200.0
),
),
home:
Center
(
child:
InteractiveViewer
(
child:
const
SizedBox
(
width:
200.0
,
height:
200.0
),
),
),
),
...
...
@@ -1283,13 +1281,11 @@ void main() {
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Center
(
child:
InteractiveViewer
.
builder
(
builder:
(
BuildContext
context
,
Quad
viewport
)
{
return
const
SizedBox
(
width:
200.0
,
height:
200.0
);
},
),
home:
Center
(
child:
InteractiveViewer
.
builder
(
builder:
(
BuildContext
context
,
Quad
viewport
)
{
return
const
SizedBox
(
width:
200.0
,
height:
200.0
);
},
),
),
),
...
...
packages/flutter/test/widgets/nested_scroll_view_test.dart
View file @
ea28f287
...
...
@@ -2360,37 +2360,35 @@ void main() {
testWidgets
(
'NestedScrollView works well when rebuilding during scheduleWarmUpFrame'
,
(
WidgetTester
tester
)
async
{
bool
?
isScrolled
;
final
Widget
myApp
=
MaterialApp
(
home:
Scaffold
(
body:
StatefulBuilder
(
builder:
(
BuildContext
context
,
StateSetter
setState
)
{
return
Focus
(
onFocusChange:
(
_
)
=>
setState
(
(){}
),
child:
NestedScrollView
(
headerSliverBuilder:
(
BuildContext
context
,
bool
boxIsScrolled
)
{
isScrolled
=
boxIsScrolled
;
return
<
Widget
>[
const
SliverAppBar
(
expandedHeight:
200
,
title:
Text
(
'Test'
),
),
];
},
body:
CustomScrollView
(
slivers:
<
Widget
>[
SliverList
(
delegate:
SliverChildBuilderDelegate
(
(
BuildContext
context
,
int
index
)
{
return
const
Text
(
''
);
},
childCount:
10
,
),
home:
StatefulBuilder
(
builder:
(
BuildContext
context
,
StateSetter
setState
)
{
return
Focus
(
onFocusChange:
(
_
)
=>
setState
(
(){}
),
child:
NestedScrollView
(
headerSliverBuilder:
(
BuildContext
context
,
bool
boxIsScrolled
)
{
isScrolled
=
boxIsScrolled
;
return
<
Widget
>[
const
SliverAppBar
(
expandedHeight:
200
,
title:
Text
(
'Test'
),
),
];
},
body:
CustomScrollView
(
slivers:
<
Widget
>[
SliverList
(
delegate:
SliverChildBuilderDelegate
(
(
BuildContext
context
,
int
index
)
{
return
const
Text
(
''
);
},
childCount:
10
,
),
]
,
)
,
)
,
]
,
),
)
;
},
)
,
)
,
);
}
,
),
);
...
...
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