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
e2192a90
Unverified
Commit
e2192a90
authored
Dec 12, 2017
by
xster
Committed by
GitHub
Dec 12, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove top mediaquery padding from modal bottom sheets (#13497)
parent
715916fe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
13 deletions
+66
-13
bottom_sheet.dart
packages/flutter/lib/src/material/bottom_sheet.dart
+7
-1
dialog_test.dart
packages/flutter/test/material/dialog_test.dart
+16
-12
modal_bottom_sheet_test.dart
packages/flutter/test/material/modal_bottom_sheet_test.dart
+43
-0
No files found.
packages/flutter/lib/src/material/bottom_sheet.dart
View file @
e2192a90
...
...
@@ -234,7 +234,13 @@ class _ModalBottomSheetRoute<T> extends PopupRoute<T> {
@override
Widget
buildPage
(
BuildContext
context
,
Animation
<
double
>
animation
,
Animation
<
double
>
secondaryAnimation
)
{
Widget
bottomSheet
=
new
_ModalBottomSheet
<
T
>(
route:
this
);
// 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
=
new
MediaQuery
.
removePadding
(
context:
context
,
removeTop:
true
,
child:
new
_ModalBottomSheet
<
T
>(
route:
this
),
);
if
(
theme
!=
null
)
bottomSheet
=
new
Theme
(
data:
theme
,
child:
bottomSheet
);
return
bottomSheet
;
...
...
packages/flutter/test/material/dialog_test.dart
View file @
e2192a90
...
...
@@ -231,27 +231,30 @@ void main() {
});
testWidgets
(
'Dialogs removes MediaQuery padding'
,
(
WidgetTester
tester
)
async
{
BuildContext
scaffold
Context
;
BuildContext
outer
Context
;
BuildContext
dialogContext
;
await
tester
.
pumpWidget
(
new
MaterialApp
(
home:
new
MediaQuery
(
await
tester
.
pumpWidget
(
new
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
new
MediaQuery
(
data:
const
MediaQueryData
(
padding:
const
EdgeInsets
.
all
(
50.0
),
),
child:
new
Builder
(
builder:
(
BuildContext
context
)
{
scaffoldContext
=
context
;
return
new
Container
();
}
child:
new
Navigator
(
onGenerateRoute:
(
_
)
{
return
new
PageRouteBuilder
<
Null
>(
pageBuilder:
(
BuildContext
context
,
Animation
<
double
>
animation
,
Animation
<
double
>
secondaryAnimation
)
{
outerContext
=
context
;
return
new
Container
();
},
);
},
),
)
)
,
));
await
tester
.
pump
();
showDialog
<
Null
>(
context:
scaffold
Context
,
context:
outer
Context
,
barrierDismissible:
false
,
child:
new
Builder
(
builder:
(
BuildContext
context
)
{
...
...
@@ -263,6 +266,7 @@ void main() {
await
tester
.
pump
();
expect
(
MediaQuery
.
of
(
outerContext
).
padding
,
const
EdgeInsets
.
all
(
50.0
));
expect
(
MediaQuery
.
of
(
dialogContext
).
padding
,
EdgeInsets
.
zero
);
});
}
packages/flutter/test/material/modal_bottom_sheet_test.dart
View file @
e2192a90
...
...
@@ -153,4 +153,47 @@ void main() {
expect
(
find
.
text
(
'BottomSheet'
),
findsNothing
);
});
testWidgets
(
'modal BottomSheet has no top MediaQuery'
,
(
WidgetTester
tester
)
async
{
BuildContext
outerContext
;
BuildContext
innerContext
;
await
tester
.
pumpWidget
(
new
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
new
MediaQuery
(
data:
const
MediaQueryData
(
padding:
const
EdgeInsets
.
all
(
50.0
),
),
child:
new
Navigator
(
onGenerateRoute:
(
_
)
{
return
new
PageRouteBuilder
<
Null
>(
pageBuilder:
(
BuildContext
context
,
Animation
<
double
>
animation
,
Animation
<
double
>
secondaryAnimation
)
{
outerContext
=
context
;
return
new
Container
();
},
);
},
),
),
));
showModalBottomSheet
<
Null
>(
context:
outerContext
,
builder:
(
BuildContext
context
)
{
innerContext
=
context
;
return
new
Container
();
},
);
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
),
);
});
}
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