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
477a4241
Unverified
Commit
477a4241
authored
Nov 13, 2020
by
Kate Lovett
Committed by
GitHub
Nov 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Actually consume top padding in bottomsheet if scrollcontrolled (#66257)" (#70392)
parent
a86dab0c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
63 deletions
+3
-63
bottom_sheet.dart
packages/flutter/lib/src/material/bottom_sheet.dart
+2
-8
bottom_sheet_test.dart
packages/flutter/test/material/bottom_sheet_test.dart
+1
-55
No files found.
packages/flutter/lib/src/material/bottom_sheet.dart
View file @
477a4241
...
...
@@ -472,7 +472,7 @@ class _ModalBottomSheetRoute<T> extends PopupRoute<T> {
Widget
buildPage
(
BuildContext
context
,
Animation
<
double
>
animation
,
Animation
<
double
>
secondaryAnimation
)
{
// By definition, the bottom sheet is aligned to the bottom of the page
// and isn't exposed to the top padding of the MediaQuery.
Widget
bottomSheet
=
MediaQuery
.
removePadding
(
final
Widget
bottomSheet
=
MediaQuery
.
removePadding
(
context:
context
,
removeTop:
true
,
child:
Builder
(
...
...
@@ -490,11 +490,6 @@ class _ModalBottomSheetRoute<T> extends PopupRoute<T> {
},
),
);
if
(
isScrollControlled
)
bottomSheet
=
Padding
(
padding:
EdgeInsets
.
only
(
top:
MediaQuery
.
of
(
context
).
padding
.
top
),
child:
bottomSheet
);
return
capturedThemes
.
wrap
(
bottomSheet
);
}
}
...
...
@@ -577,8 +572,7 @@ class _BottomSheetSuspendedCurve extends ParametricCurve<double> {
/// a bottom sheet that will utilize [DraggableScrollableSheet]. If you wish
/// to have a bottom sheet that has a scrollable child such as a [ListView] or
/// a [GridView] and have the bottom sheet be draggable, you should set this
/// parameter to true. When this parameter is set to true the top of [BottomSheet] will be padded
/// such that it avoids any system top padding given by the [MediaQuery]
/// parameter to true.
///
/// The `useRootNavigator` parameter ensures that the root navigator is used to
/// display the [BottomSheet] when set to `true`. This is useful in the case
...
...
packages/flutter/test/material/bottom_sheet_test.dart
View file @
477a4241
...
...
@@ -425,7 +425,7 @@ void main() {
expect
(
find
.
text
(
'BottomSheet'
),
findsNothing
);
});
testWidgets
(
'modal BottomSheet has no top MediaQuery
when not scroll controlled
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'modal BottomSheet has no top MediaQuery'
,
(
WidgetTester
tester
)
async
{
late
BuildContext
outerContext
;
late
BuildContext
innerContext
;
...
...
@@ -476,60 +476,6 @@ void main() {
);
});
testWidgets
(
'modal BottomSheet consumes top MediaQuery when scroll controlled'
,
(
WidgetTester
tester
)
async
{
late
BuildContext
outerContext
;
late
BuildContext
innerContext
;
final
Key
containerKey
=
UniqueKey
();
await
tester
.
pumpWidget
(
Localizations
(
locale:
const
Locale
(
'en'
,
'US'
),
delegates:
const
<
LocalizationsDelegate
<
dynamic
>>[
DefaultWidgetsLocalizations
.
delegate
,
DefaultMaterialLocalizations
.
delegate
,
],
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
MediaQuery
(
data:
const
MediaQueryData
(
padding:
EdgeInsets
.
all
(
50.0
),
size:
Size
(
400.0
,
600.0
),
),
child:
Navigator
(
onGenerateRoute:
(
_
)
{
return
PageRouteBuilder
<
void
>(
pageBuilder:
(
BuildContext
context
,
Animation
<
double
>
animation
,
Animation
<
double
>
secondaryAnimation
)
{
outerContext
=
context
;
return
Container
();
},
);
},
),
),
),
));
showModalBottomSheet
<
void
>(
context:
outerContext
,
isScrollControlled:
true
,
builder:
(
BuildContext
context
)
{
innerContext
=
context
;
return
Container
(
key:
containerKey
);
},
);
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
expect
(
MediaQuery
.
of
(
outerContext
).
padding
,
const
EdgeInsets
.
all
(
50.0
),
);
expect
(
MediaQuery
.
of
(
innerContext
).
padding
,
const
EdgeInsets
.
only
(
left:
50.0
,
right:
50.0
,
bottom:
50.0
),
);
expect
(
tester
.
getTopLeft
(
find
.
byKey
(
containerKey
)),
const
Offset
(
0.0
,
50.0
));
});
testWidgets
(
'modal BottomSheet has semantics'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
final
GlobalKey
<
ScaffoldState
>
scaffoldKey
=
GlobalKey
<
ScaffoldState
>();
...
...
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