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
fd360c4a
Unverified
Commit
fd360c4a
authored
Apr 18, 2022
by
Eric egramond
Committed by
GitHub
Apr 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent Mediaquery from losing navigationMode value when removePadding() is called (#101938)
parent
7b7206e9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
43 deletions
+18
-43
media_query.dart
packages/flutter/lib/src/widgets/media_query.dart
+3
-42
media_query_test.dart
packages/flutter/test/widgets/media_query_test.dart
+15
-1
No files found.
packages/flutter/lib/src/widgets/media_query.dart
View file @
fd360c4a
...
...
@@ -438,11 +438,7 @@ class MediaQueryData {
})
{
if
(!(
removeLeft
||
removeTop
||
removeRight
||
removeBottom
))
return
this
;
return
MediaQueryData
(
size:
size
,
devicePixelRatio:
devicePixelRatio
,
textScaleFactor:
textScaleFactor
,
platformBrightness:
platformBrightness
,
return
copyWith
(
padding:
padding
.
copyWith
(
left:
removeLeft
?
0.0
:
null
,
top:
removeTop
?
0.0
:
null
,
...
...
@@ -455,15 +451,6 @@ class MediaQueryData {
right:
removeRight
?
math
.
max
(
0.0
,
viewPadding
.
right
-
padding
.
right
)
:
null
,
bottom:
removeBottom
?
math
.
max
(
0.0
,
viewPadding
.
bottom
-
padding
.
bottom
)
:
null
,
),
viewInsets:
viewInsets
,
alwaysUse24HourFormat:
alwaysUse24HourFormat
,
highContrast:
highContrast
,
disableAnimations:
disableAnimations
,
invertColors:
invertColors
,
accessibleNavigation:
accessibleNavigation
,
boldText:
boldText
,
gestureSettings:
gestureSettings
,
displayFeatures:
displayFeatures
,
);
}
...
...
@@ -488,12 +475,7 @@ class MediaQueryData {
})
{
if
(!(
removeLeft
||
removeTop
||
removeRight
||
removeBottom
))
return
this
;
return
MediaQueryData
(
size:
size
,
devicePixelRatio:
devicePixelRatio
,
textScaleFactor:
textScaleFactor
,
platformBrightness:
platformBrightness
,
padding:
padding
,
return
copyWith
(
viewPadding:
viewPadding
.
copyWith
(
left:
removeLeft
?
math
.
max
(
0.0
,
viewPadding
.
left
-
viewInsets
.
left
)
:
null
,
top:
removeTop
?
math
.
max
(
0.0
,
viewPadding
.
top
-
viewInsets
.
top
)
:
null
,
...
...
@@ -506,14 +488,6 @@ class MediaQueryData {
right:
removeRight
?
0.0
:
null
,
bottom:
removeBottom
?
0.0
:
null
,
),
alwaysUse24HourFormat:
alwaysUse24HourFormat
,
highContrast:
highContrast
,
disableAnimations:
disableAnimations
,
invertColors:
invertColors
,
accessibleNavigation:
accessibleNavigation
,
boldText:
boldText
,
gestureSettings:
gestureSettings
,
displayFeatures:
displayFeatures
,
);
}
...
...
@@ -538,32 +512,19 @@ class MediaQueryData {
})
{
if
(!(
removeLeft
||
removeTop
||
removeRight
||
removeBottom
))
return
this
;
return
MediaQueryData
(
size:
size
,
devicePixelRatio:
devicePixelRatio
,
textScaleFactor:
textScaleFactor
,
platformBrightness:
platformBrightness
,
return
copyWith
(
padding:
padding
.
copyWith
(
left:
removeLeft
?
0.0
:
null
,
top:
removeTop
?
0.0
:
null
,
right:
removeRight
?
0.0
:
null
,
bottom:
removeBottom
?
0.0
:
null
,
),
viewInsets:
viewInsets
,
viewPadding:
viewPadding
.
copyWith
(
left:
removeLeft
?
0.0
:
null
,
top:
removeTop
?
0.0
:
null
,
right:
removeRight
?
0.0
:
null
,
bottom:
removeBottom
?
0.0
:
null
,
),
alwaysUse24HourFormat:
alwaysUse24HourFormat
,
highContrast:
highContrast
,
disableAnimations:
disableAnimations
,
invertColors:
invertColors
,
accessibleNavigation:
accessibleNavigation
,
boldText:
boldText
,
gestureSettings:
gestureSettings
,
displayFeatures:
displayFeatures
,
);
}
...
...
packages/flutter/test/widgets/media_query_test.dart
View file @
fd360c4a
...
...
@@ -171,6 +171,7 @@ void main() {
boldText:
true
,
highContrast:
true
,
platformBrightness:
Brightness
.
dark
,
navigationMode:
NavigationMode
.
directional
,
gestureSettings:
gestureSettings
,
displayFeatures:
customDisplayFeatures
,
);
...
...
@@ -188,6 +189,7 @@ void main() {
expect
(
copied
.
boldText
,
true
);
expect
(
copied
.
highContrast
,
true
);
expect
(
copied
.
platformBrightness
,
Brightness
.
dark
);
expect
(
copied
.
navigationMode
,
NavigationMode
.
directional
);
expect
(
copied
.
gestureSettings
,
gestureSettings
);
expect
(
copied
.
displayFeatures
,
customDisplayFeatures
);
});
...
...
@@ -223,6 +225,7 @@ void main() {
disableAnimations:
true
,
boldText:
true
,
highContrast:
true
,
navigationMode:
NavigationMode
.
directional
,
displayFeatures:
displayFeatures
,
),
child:
Builder
(
...
...
@@ -257,6 +260,7 @@ void main() {
expect
(
unpadded
.
disableAnimations
,
true
);
expect
(
unpadded
.
boldText
,
true
);
expect
(
unpadded
.
highContrast
,
true
);
expect
(
unpadded
.
navigationMode
,
NavigationMode
.
directional
);
expect
(
unpadded
.
displayFeatures
,
displayFeatures
);
});
...
...
@@ -291,6 +295,7 @@ void main() {
disableAnimations:
true
,
boldText:
true
,
highContrast:
true
,
navigationMode:
NavigationMode
.
directional
,
displayFeatures:
displayFeatures
,
),
child:
Builder
(
...
...
@@ -322,6 +327,7 @@ void main() {
expect
(
unpadded
.
disableAnimations
,
true
);
expect
(
unpadded
.
boldText
,
true
);
expect
(
unpadded
.
highContrast
,
true
);
expect
(
unpadded
.
navigationMode
,
NavigationMode
.
directional
);
expect
(
unpadded
.
displayFeatures
,
displayFeatures
);
});
...
...
@@ -356,6 +362,7 @@ void main() {
disableAnimations:
true
,
boldText:
true
,
highContrast:
true
,
navigationMode:
NavigationMode
.
directional
,
displayFeatures:
displayFeatures
,
),
child:
Builder
(
...
...
@@ -390,6 +397,7 @@ void main() {
expect
(
unpadded
.
disableAnimations
,
true
);
expect
(
unpadded
.
boldText
,
true
);
expect
(
unpadded
.
highContrast
,
true
);
expect
(
unpadded
.
navigationMode
,
NavigationMode
.
directional
);
expect
(
unpadded
.
displayFeatures
,
displayFeatures
);
});
...
...
@@ -424,6 +432,7 @@ void main() {
disableAnimations:
true
,
boldText:
true
,
highContrast:
true
,
navigationMode:
NavigationMode
.
directional
,
displayFeatures:
displayFeatures
,
),
child:
Builder
(
...
...
@@ -455,6 +464,7 @@ void main() {
expect
(
unpadded
.
disableAnimations
,
true
);
expect
(
unpadded
.
boldText
,
true
);
expect
(
unpadded
.
highContrast
,
true
);
expect
(
unpadded
.
navigationMode
,
NavigationMode
.
directional
);
expect
(
unpadded
.
displayFeatures
,
displayFeatures
);
});
...
...
@@ -489,6 +499,7 @@ void main() {
disableAnimations:
true
,
boldText:
true
,
highContrast:
true
,
navigationMode:
NavigationMode
.
directional
,
displayFeatures:
displayFeatures
,
),
child:
Builder
(
...
...
@@ -523,6 +534,7 @@ void main() {
expect
(
unpadded
.
disableAnimations
,
true
);
expect
(
unpadded
.
boldText
,
true
);
expect
(
unpadded
.
highContrast
,
true
);
expect
(
unpadded
.
navigationMode
,
NavigationMode
.
directional
);
expect
(
unpadded
.
displayFeatures
,
displayFeatures
);
});
...
...
@@ -557,6 +569,7 @@ void main() {
disableAnimations:
true
,
boldText:
true
,
highContrast:
true
,
navigationMode:
NavigationMode
.
directional
,
displayFeatures:
displayFeatures
,
),
child:
Builder
(
...
...
@@ -588,6 +601,7 @@ void main() {
expect
(
unpadded
.
disableAnimations
,
true
);
expect
(
unpadded
.
boldText
,
true
);
expect
(
unpadded
.
highContrast
,
true
);
expect
(
unpadded
.
navigationMode
,
NavigationMode
.
directional
);
expect
(
unpadded
.
displayFeatures
,
displayFeatures
);
});
...
...
@@ -900,7 +914,7 @@ void main() {
);
expect
(
subScreenMediaQuery
.
viewPadding
,
const
EdgeInsets
.
only
(
top:
6.0
,
left:
4.0
,
right:
8.0
,
bottom:
12.0
),
const
EdgeInsets
.
only
(
top:
6.0
,
left:
4.0
,
right:
8.0
,
bottom:
12.0
),
);
expect
(
subScreenMediaQuery
.
viewInsets
,
...
...
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