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
f3dbefd3
Unverified
Commit
f3dbefd3
authored
Aug 09, 2019
by
Kate Lovett
Committed by
GitHub
Aug 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Adding physicalDepth to MediaQueryData & TestWindow (#37718)" (#37938)
This reverts commit
3a2d3081
.
parent
8fe424f9
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
138 deletions
+58
-138
media_query.dart
packages/flutter/lib/src/widgets/media_query.dart
+22
-48
media_query_test.dart
packages/flutter/test/widgets/media_query_test.dart
+0
-4
window.dart
packages/flutter_test/lib/src/window.dart
+36
-72
window_test.dart
packages/flutter_test/test/window_test.dart
+0
-14
No files found.
packages/flutter/lib/src/widgets/media_query.dart
View file @
f3dbefd3
...
...
@@ -74,7 +74,6 @@ enum Orientation {
/// widgets that reduce those properties by the same amount.
/// The [removePadding], [removeViewPadding], and [removeInsets] methods are
/// useful for this.
///
/// See also:
///
/// * [Scaffold], [SafeArea], [CupertinoTabScaffold], and
...
...
@@ -94,7 +93,6 @@ class MediaQueryData {
this
.
padding
=
EdgeInsets
.
zero
,
this
.
viewInsets
=
EdgeInsets
.
zero
,
this
.
viewPadding
=
EdgeInsets
.
zero
,
this
.
physicalDepth
=
double
.
maxFinite
,
this
.
alwaysUse24HourFormat
=
false
,
this
.
accessibleNavigation
=
false
,
this
.
invertColors
=
false
,
...
...
@@ -116,7 +114,6 @@ class MediaQueryData {
padding
=
EdgeInsets
.
fromWindowPadding
(
window
.
padding
,
window
.
devicePixelRatio
),
viewPadding
=
EdgeInsets
.
fromWindowPadding
(
window
.
viewPadding
,
window
.
devicePixelRatio
),
viewInsets
=
EdgeInsets
.
fromWindowPadding
(
window
.
viewInsets
,
window
.
devicePixelRatio
),
physicalDepth
=
window
.
physicalDepth
,
accessibleNavigation
=
window
.
accessibilityFeatures
.
accessibleNavigation
,
invertColors
=
window
.
accessibilityFeatures
.
invertColors
,
disableAnimations
=
window
.
accessibilityFeatures
.
disableAnimations
,
...
...
@@ -213,19 +210,6 @@ class MediaQueryData {
/// property and how it relates to [padding] and [viewInsets].
final
EdgeInsets
viewPadding
;
/// The physical depth is the maximum elevation that the Window allows.
///
/// Physical layers drawn at or above this elevation will have their elevation
/// clamped to this value. This can happen if the physical layer itself has
/// an elevation larger than the available depth, or if some ancestor of the
/// layer causes it to have a cumulative elevation that is larger than the
/// available depth.
///
/// The default value is [double.maxFinite], which is used for platforms that
/// do not specify a maximum elevation. This property is currently only
/// expected to be set to a non-default value on Fuchsia.
final
double
physicalDepth
;
/// Whether to use 24-hour format when formatting time.
///
/// The behavior of this flag is different across platforms:
...
...
@@ -275,8 +259,7 @@ class MediaQueryData {
/// * [Window.AccessibilityFeatures], where the setting originates.
final
bool
boldText
;
/// The orientation of the media (e.g., whether the device is in landscape or
/// portrait mode).
/// The orientation of the media (e.g., whether the device is in landscape or portrait mode).
Orientation
get
orientation
{
return
size
.
width
>
size
.
height
?
Orientation
.
landscape
:
Orientation
.
portrait
;
}
...
...
@@ -291,7 +274,6 @@ class MediaQueryData {
EdgeInsets
padding
,
EdgeInsets
viewPadding
,
EdgeInsets
viewInsets
,
double
physicalDepth
,
bool
alwaysUse24HourFormat
,
bool
disableAnimations
,
bool
invertColors
,
...
...
@@ -306,7 +288,6 @@ class MediaQueryData {
padding:
padding
??
this
.
padding
,
viewPadding:
viewPadding
??
this
.
viewPadding
,
viewInsets:
viewInsets
??
this
.
viewInsets
,
physicalDepth:
physicalDepth
??
this
.
physicalDepth
,
alwaysUse24HourFormat:
alwaysUse24HourFormat
??
this
.
alwaysUse24HourFormat
,
invertColors:
invertColors
??
this
.
invertColors
,
disableAnimations:
disableAnimations
??
this
.
disableAnimations
,
...
...
@@ -324,7 +305,7 @@ class MediaQueryData {
///
/// See also:
///
/// * [
MediaQuery.removePadding], which uses this method to remove [padding]
/// * [
new MediaQuery.removePadding], which uses this method to remove padding
/// from the ambient [MediaQuery].
/// * [SafeArea], which both removes the padding from the [MediaQuery] and
/// adds a [Padding] widget.
...
...
@@ -373,8 +354,8 @@ class MediaQueryData {
///
/// See also:
///
/// * [MediaQuery.removeViewInsets], which uses this method to remove
///
[viewInsets]
from the ambient [MediaQuery].
/// * [
new
MediaQuery.removeViewInsets], which uses this method to remove
///
padding
from the ambient [MediaQuery].
/// * [removePadding], the same thing but for [padding].
/// * [removeViewPadding], the same thing but for [viewPadding].
MediaQueryData
removeViewInsets
({
...
...
@@ -420,8 +401,8 @@ class MediaQueryData {
///
/// See also:
///
/// * [MediaQuery.removeViewPadding], which uses this method to remove
///
[viewPadding]
from the ambient [MediaQuery].
/// * [
new
MediaQuery.removeViewPadding], which uses this method to remove
///
padding
from the ambient [MediaQuery].
/// * [removePadding], the same thing but for [padding].
/// * [removeViewInsets], the same thing but for [viewInsets].
MediaQueryData
removeViewPadding
({
...
...
@@ -470,7 +451,6 @@ class MediaQueryData {
&&
typedOther
.
padding
==
padding
&&
typedOther
.
viewPadding
==
viewPadding
&&
typedOther
.
viewInsets
==
viewInsets
&&
typedOther
.
physicalDepth
==
physicalDepth
&&
typedOther
.
alwaysUse24HourFormat
==
alwaysUse24HourFormat
&&
typedOther
.
disableAnimations
==
disableAnimations
&&
typedOther
.
invertColors
==
invertColors
...
...
@@ -488,7 +468,6 @@ class MediaQueryData {
padding
,
viewPadding
,
viewInsets
,
physicalDepth
,
alwaysUse24HourFormat
,
disableAnimations
,
invertColors
,
...
...
@@ -507,7 +486,6 @@ class MediaQueryData {
'padding:
$padding
, '
'viewPadding:
$viewPadding
, '
'viewInsets:
$viewInsets
, '
'physicalDepth:
$physicalDepth
, '
'alwaysUse24HourFormat:
$alwaysUse24HourFormat
, '
'accessibleNavigation:
$accessibleNavigation
, '
'disableAnimations:
$disableAnimations
, '
...
...
@@ -551,8 +529,8 @@ class MediaQuery extends InheritedWidget {
assert
(
data
!=
null
),
super
(
key:
key
,
child:
child
);
/// Creates a new [MediaQuery] that inherits from the ambient [MediaQuery]
///
from the given context, but removes the specified padding
.
/// Creates a new [MediaQuery] that inherits from the ambient [MediaQuery]
from
///
the given context, but removes the specified paddings
.
///
/// This should be inserted into the widget tree when the [MediaQuery] padding
/// is consumed by a widget in such a way that the padding is no longer
...
...
@@ -572,11 +550,9 @@ class MediaQuery extends InheritedWidget {
///
/// * [SafeArea], which both removes the padding from the [MediaQuery] and
/// adds a [Padding] widget.
/// * [MediaQueryData.padding], the affected property of the
/// [MediaQueryData].
/// * [removeViewInsets], the same thing but for [MediaQueryData.viewInsets].
/// * [removeViewPadding], the same thing but for
/// [MediaQueryData.viewPadding].
/// * [MediaQueryData.padding], the affected property of the [MediaQueryData].
/// * [new removeViewInsets], the same thing but for removing view insets.
/// * [new removeViewPadding], the same thing but for removing view insets.
factory
MediaQuery
.
removePadding
({
Key
key
,
@required
BuildContext
context
,
...
...
@@ -598,8 +574,8 @@ class MediaQuery extends InheritedWidget {
);
}
/// Creates a new [MediaQuery] that inherits from the ambient [MediaQuery]
///
from
the given context, but removes the specified view insets.
/// Creates a new [MediaQuery] that inherits from the ambient [MediaQuery]
from
/// the given context, but removes the specified view insets.
///
/// This should be inserted into the widget tree when the [MediaQuery] view
/// insets are consumed by a widget in such a way that the view insets are no
...
...
@@ -617,11 +593,9 @@ class MediaQuery extends InheritedWidget {
///
/// See also:
///
/// * [MediaQueryData.viewInsets], the affected property of the
/// [MediaQueryData].
/// * [removePadding], the same thing but for [MediaQueryData.padding].
/// * [removeViewPadding], the same thing but for
/// [MediaQueryData.viewPadding].
/// * [MediaQueryData.viewInsets], the affected property of the [MediaQueryData].
/// * [new removePadding], the same thing but for removing paddings.
/// * [new removeViewPadding], the same thing but for removing view insets.
factory
MediaQuery
.
removeViewInsets
({
Key
key
,
@required
BuildContext
context
,
...
...
@@ -643,8 +617,8 @@ class MediaQuery extends InheritedWidget {
);
}
/// Creates a new [MediaQuery] that inherits from the ambient [MediaQuery]
///
from
the given context, but removes the specified view padding.
/// Creates a new [MediaQuery] that inherits from the ambient [MediaQuery]
from
/// the given context, but removes the specified view padding.
///
/// This should be inserted into the widget tree when the [MediaQuery] view
/// padding is consumed by a widget in such a way that the view padding is no
...
...
@@ -664,8 +638,8 @@ class MediaQuery extends InheritedWidget {
///
/// * [MediaQueryData.viewPadding], the affected property of the
/// [MediaQueryData].
/// * [
removePadding], the same thing but for [MediaQueryData.padding]
.
/// * [
removeViewInsets], the same thing but for [MediaQueryData.viewInsets]
.
/// * [
new removePadding], the same thing but for removing paddings
.
/// * [
new removeViewInsets], the same thing but for removing view insets
.
factory
MediaQuery
.
removeViewPadding
({
Key
key
,
@required
BuildContext
context
,
...
...
@@ -697,8 +671,8 @@ class MediaQuery extends InheritedWidget {
/// context.
///
/// You can use this function to query the size an orientation of the screen.
/// When that information changes, your widget will be scheduled to be
///
rebuilt,
keeping your widget up-to-date.
/// When that information changes, your widget will be scheduled to be
rebuilt,
/// keeping your widget up-to-date.
///
/// Typical usage is as follows:
///
...
...
packages/flutter/test/widgets/media_query_test.dart
View file @
f3dbefd3
...
...
@@ -47,7 +47,6 @@ void main() {
expect
(
data
.
disableAnimations
,
false
);
expect
(
data
.
boldText
,
false
);
expect
(
data
.
platformBrightness
,
Brightness
.
light
);
expect
(
data
.
physicalDepth
,
equals
(
WidgetsBinding
.
instance
.
window
.
physicalDepth
));
});
testWidgets
(
'MediaQueryData.copyWith defaults to source'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -59,7 +58,6 @@ void main() {
expect
(
copied
.
padding
,
data
.
padding
);
expect
(
copied
.
viewPadding
,
data
.
viewPadding
);
expect
(
copied
.
viewInsets
,
data
.
viewInsets
);
expect
(
copied
.
physicalDepth
,
data
.
physicalDepth
);
expect
(
copied
.
alwaysUse24HourFormat
,
data
.
alwaysUse24HourFormat
);
expect
(
copied
.
accessibleNavigation
,
data
.
accessibleNavigation
);
expect
(
copied
.
invertColors
,
data
.
invertColors
);
...
...
@@ -77,7 +75,6 @@ void main() {
padding:
const
EdgeInsets
.
all
(
9.10938
),
viewPadding:
const
EdgeInsets
.
all
(
11.24031
),
viewInsets:
const
EdgeInsets
.
all
(
1.67262
),
physicalDepth:
120.0
,
alwaysUse24HourFormat:
true
,
accessibleNavigation:
true
,
invertColors:
true
,
...
...
@@ -91,7 +88,6 @@ void main() {
expect
(
copied
.
padding
,
const
EdgeInsets
.
all
(
9.10938
));
expect
(
copied
.
viewPadding
,
const
EdgeInsets
.
all
(
11.24031
));
expect
(
copied
.
viewInsets
,
const
EdgeInsets
.
all
(
1.67262
));
expect
(
copied
.
physicalDepth
,
120.0
);
expect
(
copied
.
alwaysUse24HourFormat
,
true
);
expect
(
copied
.
accessibleNavigation
,
true
);
expect
(
copied
.
invertColors
,
true
);
...
...
packages/flutter_test/lib/src/window.dart
View file @
f3dbefd3
This diff is collapsed.
Click to expand it.
packages/flutter_test/test/window_test.dart
View file @
f3dbefd3
...
...
@@ -43,20 +43,6 @@ void main() {
);
});
testWidgets
(
'TestWindow can fake physical depth'
,
(
WidgetTester
tester
)
async
{
verifyThatTestWindowCanFakeProperty
<
double
>(
tester:
tester
,
realValue:
ui
.
window
.
physicalDepth
,
fakeValue:
120.0
,
propertyRetriever:
()
{
return
WidgetsBinding
.
instance
.
window
.
physicalDepth
;
},
propertyFaker:
(
TestWidgetsFlutterBinding
binding
,
double
fakeValue
)
{
binding
.
window
.
physicalDepthTestValue
=
fakeValue
;
},
);
});
testWidgets
(
'TestWindow can fake view insets'
,
(
WidgetTester
tester
)
async
{
verifyThatTestWindowCanFakeProperty
<
WindowPadding
>(
tester:
tester
,
...
...
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