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
5ccb4d4b
Unverified
Commit
5ccb4d4b
authored
Feb 22, 2023
by
Michael Goderbauer
Committed by
GitHub
Feb 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename WindowPadding to ViewPadding (#121152)
* Rename WindowPadding to ViewPadding * dart fix * typos
parent
7d85a585
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
149 additions
and
89 deletions
+149
-89
fix_gestures.yaml
packages/flutter/lib/fix_data/fix_gestures.yaml
+1
-1
fix_theme_data.yaml
...ges/flutter/lib/fix_data/fix_material/fix_theme_data.yaml
+0
-1
fix_painting.yaml
packages/flutter/lib/fix_data/fix_painting.yaml
+32
-0
edge_insets.dart
packages/flutter/lib/src/painting/edge_insets.dart
+12
-3
media_query.dart
packages/flutter/lib/src/widgets/media_query.dart
+4
-4
page_test.dart
packages/flutter/test/material/page_test.dart
+5
-5
text_field_test.dart
packages/flutter/test/material/text_field_test.dart
+4
-4
view_chrome_style_test.dart
packages/flutter/test/rendering/view_chrome_style_test.dart
+3
-3
editable_text_test.dart
packages/flutter/test/widgets/editable_text_test.dart
+4
-4
heroes_test.dart
packages/flutter/test/widgets/heroes_test.dart
+4
-4
media_query_test.dart
packages/flutter/test/widgets/media_query_test.dart
+39
-39
painting.dart
packages/flutter/test_fixes/painting/painting.dart
+10
-0
painting.dart.expect
packages/flutter/test_fixes/painting/painting.dart.expect
+10
-0
window.dart
packages/flutter_test/lib/src/window.dart
+12
-12
window_test.dart
packages/flutter_test/test/window_test.dart
+9
-9
No files found.
packages/flutter/lib/fix_data/fix_gestures.yaml
View file @
5ccb4d4b
...
...
@@ -15,7 +15,7 @@
# For documentation about this file format, see
# https://dart.dev/go/data-driven-fixes.
# * Fixes in this file are
[for CLASS] from the <XXX>
library. *
# * Fixes in this file are
from the Gestures
library. *
version
:
1
transforms
:
# Changes made in https://github.com/flutter/flutter/pull/28602
...
...
packages/flutter/lib/fix_data/fix_material/fix_theme_data.yaml
View file @
5ccb4d4b
...
...
@@ -15,7 +15,6 @@
# For documentation about this file format, see
# https://dart.dev/go/data-driven-fixes.
# * Fixes in this file are for the ThemeData class from the Material library. *
# For fixes to
# * AppBar: fix_app_bar.yaml
...
...
packages/flutter/lib/fix_data/fix_painting.yaml
0 → 100644
View file @
5ccb4d4b
# Copyright 2014 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# For details regarding the *Flutter Fix* feature, see
# https://flutter.dev/docs/development/tools/flutter-fix
# Please add new fixes to the top of the file, separated by one blank line
# from other fixes. In a comment, include a link to the PR where the change
# requiring the fix was made.
# Every fix must be tested. See the flutter/packages/flutter/test_fixes/README.md
# file for instructions on testing these data driven fixes.
# For documentation about this file format, see
# https://dart.dev/go/data-driven-fixes.
# * Fixes in this file are from the Painting library. *
version
:
1
transforms
:
# Changes made in https://github.com/flutter/flutter/pull/121152
-
title
:
"
Rename
to
'fromViewPadding'"
date
:
2022-02-21
element
:
uris
:
[
'
painting.dart'
]
constructor
:
'
fromWindowPadding'
inClass
:
'
EdgeInsets'
changes
:
-
kind
:
'
rename'
newName
:
'
fromViewPadding'
# Before adding a new fix: read instructions at the top of this file.
packages/flutter/lib/src/painting/edge_insets.dart
View file @
5ccb4d4b
...
...
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:ui'
as
ui
show
Windo
wPadding
,
lerpDouble
;
import
'dart:ui'
as
ui
show
Vie
wPadding
,
lerpDouble
;
import
'package:flutter/foundation.dart'
;
...
...
@@ -397,18 +397,27 @@ class EdgeInsets extends EdgeInsetsGeometry {
right
=
horizontal
,
bottom
=
vertical
;
/// Creates insets that match the given
windo
w padding.
/// Creates insets that match the given
vie
w padding.
///
/// If you need the current system padding or view insets in the context of a
/// widget, consider using [MediaQuery.of] to obtain these values rather than
/// using the value from a [FlutterView] directly, so that you get notified of
/// changes.
EdgeInsets
.
from
WindowPadding
(
ui
.
Windo
wPadding
padding
,
double
devicePixelRatio
)
EdgeInsets
.
from
ViewPadding
(
ui
.
Vie
wPadding
padding
,
double
devicePixelRatio
)
:
left
=
padding
.
left
/
devicePixelRatio
,
top
=
padding
.
top
/
devicePixelRatio
,
right
=
padding
.
right
/
devicePixelRatio
,
bottom
=
padding
.
bottom
/
devicePixelRatio
;
/// Deprecated. Will be removed in a future version of Flutter.
///
/// Use [EdgeInsets.fromViewPadding] instead.
@Deprecated
(
'Use EdgeInsets.fromViewPadding instead. '
'This feature was deprecated after v3.8.0-14.0.pre.'
,
)
factory
EdgeInsets
.
fromWindowPadding
(
ui
.
ViewPadding
padding
,
double
devicePixelRatio
)
=
EdgeInsets
.
fromViewPadding
;
/// An [EdgeInsets] with zero offsets in each direction.
static
const
EdgeInsets
zero
=
EdgeInsets
.
only
();
...
...
packages/flutter/lib/src/widgets/media_query.dart
View file @
5ccb4d4b
...
...
@@ -211,10 +211,10 @@ class MediaQueryData {
devicePixelRatio
=
view
.
devicePixelRatio
,
textScaleFactor
=
platformData
?.
textScaleFactor
??
view
.
platformDispatcher
.
textScaleFactor
,
platformBrightness
=
platformData
?.
platformBrightness
??
view
.
platformDispatcher
.
platformBrightness
,
padding
=
EdgeInsets
.
from
Windo
wPadding
(
view
.
padding
,
view
.
devicePixelRatio
),
viewPadding
=
EdgeInsets
.
from
Windo
wPadding
(
view
.
viewPadding
,
view
.
devicePixelRatio
),
viewInsets
=
EdgeInsets
.
from
Windo
wPadding
(
view
.
viewInsets
,
view
.
devicePixelRatio
),
systemGestureInsets
=
EdgeInsets
.
from
Windo
wPadding
(
view
.
systemGestureInsets
,
view
.
devicePixelRatio
),
padding
=
EdgeInsets
.
from
Vie
wPadding
(
view
.
padding
,
view
.
devicePixelRatio
),
viewPadding
=
EdgeInsets
.
from
Vie
wPadding
(
view
.
viewPadding
,
view
.
devicePixelRatio
),
viewInsets
=
EdgeInsets
.
from
Vie
wPadding
(
view
.
viewInsets
,
view
.
devicePixelRatio
),
systemGestureInsets
=
EdgeInsets
.
from
Vie
wPadding
(
view
.
systemGestureInsets
,
view
.
devicePixelRatio
),
accessibleNavigation
=
platformData
?.
accessibleNavigation
??
view
.
platformDispatcher
.
accessibilityFeatures
.
accessibleNavigation
,
invertColors
=
platformData
?.
invertColors
??
view
.
platformDispatcher
.
accessibilityFeatures
.
invertColors
,
disableAnimations
=
platformData
?.
disableAnimations
??
view
.
platformDispatcher
.
accessibilityFeatures
.
disableAnimations
,
...
...
packages/flutter/test/material/page_test.dart
View file @
5ccb4d4b
...
...
@@ -241,12 +241,12 @@ void main() {
testWidgets
(
'test page transition (_ZoomPageTransition) with rasterization re-rasterizes when window insets'
,
(
WidgetTester
tester
)
async
{
late
Size
oldSize
;
late
ui
.
Windo
wPadding
oldInsets
;
late
ui
.
Vie
wPadding
oldInsets
;
try
{
oldSize
=
tester
.
binding
.
window
.
physicalSize
;
oldInsets
=
tester
.
binding
.
window
.
viewInsets
;
tester
.
binding
.
window
.
physicalSizeTestValue
=
const
Size
(
1000
,
1000
);
tester
.
binding
.
window
.
viewInsetsTestValue
=
ui
.
Windo
wPadding
.
zero
;
tester
.
binding
.
window
.
viewInsetsTestValue
=
ui
.
Vie
wPadding
.
zero
;
// Intentionally use nested scaffolds to simulate the view insets being
// consumed.
...
...
@@ -275,7 +275,7 @@ void main() {
await
expectLater
(
find
.
byKey
(
key
),
matchesGoldenFile
(
'zoom_page_transition.small.png'
));
// Change the view insets
tester
.
binding
.
window
.
viewInsetsTestValue
=
const
Test
Windo
wPadding
(
left:
0
,
top:
0
,
right:
0
,
bottom:
500
);
tester
.
binding
.
window
.
viewInsetsTestValue
=
const
Test
Vie
wPadding
(
left:
0
,
top:
0
,
right:
0
,
bottom:
500
);
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
50
));
...
...
@@ -1330,8 +1330,8 @@ class TestDependencies extends StatelessWidget {
}
}
class
Test
WindowPadding
implements
ui
.
Windo
wPadding
{
const
Test
Windo
wPadding
({
class
Test
ViewPadding
implements
ui
.
Vie
wPadding
{
const
Test
Vie
wPadding
({
required
this
.
left
,
required
this
.
top
,
required
this
.
right
,
...
...
packages/flutter/test/material/text_field_test.dart
View file @
5ccb4d4b
...
...
@@ -14,7 +14,7 @@
library
;
import
'dart:math'
as
math
;
import
'dart:ui'
as
ui
show
BoxHeightStyle
,
BoxWidthStyle
,
Windo
wPadding
;
import
'dart:ui'
as
ui
show
BoxHeightStyle
,
BoxWidthStyle
,
Vie
wPadding
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/foundation.dart'
;
...
...
@@ -142,8 +142,8 @@ class TestFormatter extends TextInputFormatter {
// Used to set window.viewInsets since the real ui.WindowPadding has only a
// private constructor.
class
_Test
WindowPadding
implements
ui
.
Windo
wPadding
{
const
_Test
Windo
wPadding
({
class
_Test
ViewPadding
implements
ui
.
Vie
wPadding
{
const
_Test
Vie
wPadding
({
required
this
.
bottom
,
});
...
...
@@ -3384,7 +3384,7 @@ void main() {
// Add a viewInset tall enough to push the field to the top, where there
// is no room to display the toolbar above. This is similar to when the
// keyboard is shown.
tester
.
binding
.
window
.
viewInsetsTestValue
=
const
_Test
Windo
wPadding
(
tester
.
binding
.
window
.
viewInsetsTestValue
=
const
_Test
Vie
wPadding
(
bottom:
500.0
,
);
addTearDown
(
tester
.
binding
.
window
.
clearViewInsetsTestValue
);
...
...
packages/flutter/test/rendering/view_chrome_style_test.dart
View file @
5ccb4d4b
...
...
@@ -18,7 +18,7 @@ void main() {
void
setupTestDevice
()
{
final
TestWidgetsFlutterBinding
binding
=
TestWidgetsFlutterBinding
.
ensureInitialized
();
const
Fake
WindowPadding
padding
=
FakeWindo
wPadding
(
const
Fake
ViewPadding
padding
=
FakeVie
wPadding
(
top:
statusBarHeight
*
devicePixelRatio
,
bottom:
navigationBarHeight
*
devicePixelRatio
,
);
...
...
@@ -297,8 +297,8 @@ void main() {
});
}
class
Fake
WindowPadding
implements
Windo
wPadding
{
const
Fake
Windo
wPadding
({
class
Fake
ViewPadding
implements
Vie
wPadding
{
const
Fake
Vie
wPadding
({
this
.
left
=
0.0
,
this
.
top
=
0.0
,
this
.
right
=
0.0
,
...
...
packages/flutter/test/widgets/editable_text_test.dart
View file @
5ccb4d4b
...
...
@@ -46,8 +46,8 @@ class _MatchesMethodCall extends Matcher {
// Used to set window.viewInsets since the real ui.WindowPadding has only a
// private constructor.
class
_Test
WindowPadding
implements
ui
.
Windo
wPadding
{
const
_Test
Windo
wPadding
({
class
_Test
ViewPadding
implements
ui
.
Vie
wPadding
{
const
_Test
Vie
wPadding
({
required
this
.
bottom
,
});
...
...
@@ -164,7 +164,7 @@ void main() {
await
tester
.
pumpWidget
(
widget
);
await
tester
.
showKeyboard
(
find
.
byType
(
EditableText
));
TestWidgetsFlutterBinding
.
instance
.
window
.
viewInsetsTestValue
=
const
_Test
Windo
wPadding
(
bottom:
500
);
TestWidgetsFlutterBinding
.
instance
.
window
.
viewInsetsTestValue
=
const
_Test
Vie
wPadding
(
bottom:
500
);
addTearDown
(
TestWidgetsFlutterBinding
.
instance
.
window
.
clearViewInsetsTestValue
);
textController
.
selection
=
TextSelection
(
baseOffset:
0
,
...
...
@@ -215,7 +215,7 @@ void main() {
);
await
tester
.
pumpWidget
(
widget
);
await
tester
.
showKeyboard
(
find
.
byType
(
EditableText
));
TestWidgetsFlutterBinding
.
instance
.
window
.
viewInsetsTestValue
=
const
_Test
Windo
wPadding
(
bottom:
500
);
TestWidgetsFlutterBinding
.
instance
.
window
.
viewInsetsTestValue
=
const
_Test
Vie
wPadding
(
bottom:
500
);
addTearDown
(
TestWidgetsFlutterBinding
.
instance
.
window
.
clearViewInsetsTestValue
);
await
tester
.
pump
();
...
...
packages/flutter/test/widgets/heroes_test.dart
View file @
5ccb4d4b
...
...
@@ -3,7 +3,7 @@
// found in the LICENSE file.
import
'dart:ui'
as
ui
;
import
'dart:ui'
show
Windo
wPadding
;
import
'dart:ui'
show
Vie
wPadding
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/foundation.dart'
;
...
...
@@ -184,8 +184,8 @@ class MyStatefulWidgetState extends State<MyStatefulWidget> {
Widget
build
(
BuildContext
context
)
=>
Text
(
widget
.
value
);
}
class
Fake
WindowPadding
implements
Windo
wPadding
{
const
Fake
Windo
wPadding
({
class
Fake
ViewPadding
implements
Vie
wPadding
{
const
Fake
Vie
wPadding
({
this
.
left
=
0.0
,
this
.
top
=
0.0
,
this
.
right
=
0.0
,
...
...
@@ -3097,7 +3097,7 @@ Future<void> main() async {
final
TestImageProvider
imageProvider
=
TestImageProvider
(
testImage
);
final
TestWidgetsFlutterBinding
testBinding
=
tester
.
binding
;
testBinding
.
window
.
paddingTestValue
=
const
Fake
Windo
wPadding
(
top:
50
);
testBinding
.
window
.
paddingTestValue
=
const
Fake
Vie
wPadding
(
top:
50
);
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
packages/flutter/test/widgets/media_query_test.dart
View file @
5ccb4d4b
...
...
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:ui'
show
Brightness
,
DisplayFeature
,
DisplayFeatureState
,
DisplayFeatureType
,
GestureSettings
,
PlatformDispatcher
,
ViewConfiguration
,
Windo
wPadding
;
import
'dart:ui'
show
Brightness
,
DisplayFeature
,
DisplayFeatureState
,
DisplayFeatureType
,
GestureSettings
,
PlatformDispatcher
,
ViewConfiguration
,
Vie
wPadding
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/material.dart'
;
...
...
@@ -176,10 +176,10 @@ void main() {
final
TestView
view
=
TestView
(
physicalSize:
const
Size
(
300
,
600
),
devicePixelRatio:
3.0
,
padding:
const
Test
Windo
wPadding
(
15
),
viewPadding:
const
Test
Windo
wPadding
(
75
),
viewInsets:
const
Test
Windo
wPadding
(
45
),
systemGestureInsets:
const
Test
Windo
wPadding
(
9
),
padding:
const
Test
Vie
wPadding
(
15
),
viewPadding:
const
Test
Vie
wPadding
(
75
),
viewInsets:
const
Test
Vie
wPadding
(
45
),
systemGestureInsets:
const
Test
Vie
wPadding
(
9
),
);
final
MediaQueryData
data
=
MediaQueryData
.
fromView
(
view
,
platformData:
platformData
);
...
...
@@ -189,10 +189,10 @@ void main() {
expect
(
data
.
devicePixelRatio
,
view
.
devicePixelRatio
);
expect
(
data
.
textScaleFactor
,
platformData
.
textScaleFactor
);
expect
(
data
.
platformBrightness
,
platformData
.
platformBrightness
);
expect
(
data
.
padding
,
EdgeInsets
.
from
Windo
wPadding
(
view
.
padding
,
view
.
devicePixelRatio
));
expect
(
data
.
viewPadding
,
EdgeInsets
.
from
Windo
wPadding
(
view
.
viewPadding
,
view
.
devicePixelRatio
));
expect
(
data
.
viewInsets
,
EdgeInsets
.
from
Windo
wPadding
(
view
.
viewInsets
,
view
.
devicePixelRatio
));
expect
(
data
.
systemGestureInsets
,
EdgeInsets
.
from
Windo
wPadding
(
view
.
systemGestureInsets
,
view
.
devicePixelRatio
));
expect
(
data
.
padding
,
EdgeInsets
.
from
Vie
wPadding
(
view
.
padding
,
view
.
devicePixelRatio
));
expect
(
data
.
viewPadding
,
EdgeInsets
.
from
Vie
wPadding
(
view
.
viewPadding
,
view
.
devicePixelRatio
));
expect
(
data
.
viewInsets
,
EdgeInsets
.
from
Vie
wPadding
(
view
.
viewInsets
,
view
.
devicePixelRatio
));
expect
(
data
.
systemGestureInsets
,
EdgeInsets
.
from
Vie
wPadding
(
view
.
systemGestureInsets
,
view
.
devicePixelRatio
));
expect
(
data
.
accessibleNavigation
,
platformData
.
accessibleNavigation
);
expect
(
data
.
invertColors
,
platformData
.
invertColors
);
expect
(
data
.
disableAnimations
,
platformData
.
disableAnimations
);
...
...
@@ -216,10 +216,10 @@ void main() {
platformDispatcher:
platformDispatcher
,
physicalSize:
const
Size
(
300
,
600
),
devicePixelRatio:
3.0
,
padding:
const
Test
Windo
wPadding
(
15
),
viewPadding:
const
Test
Windo
wPadding
(
75
),
viewInsets:
const
Test
Windo
wPadding
(
45
),
systemGestureInsets:
const
Test
Windo
wPadding
(
9
),
padding:
const
Test
Vie
wPadding
(
15
),
viewPadding:
const
Test
Vie
wPadding
(
75
),
viewInsets:
const
Test
Vie
wPadding
(
45
),
systemGestureInsets:
const
Test
Vie
wPadding
(
9
),
);
final
MediaQueryData
data
=
MediaQueryData
.
fromView
(
view
);
...
...
@@ -229,10 +229,10 @@ void main() {
expect
(
data
.
devicePixelRatio
,
view
.
devicePixelRatio
);
expect
(
data
.
textScaleFactor
,
platformDispatcher
.
textScaleFactor
);
expect
(
data
.
platformBrightness
,
platformDispatcher
.
platformBrightness
);
expect
(
data
.
padding
,
EdgeInsets
.
from
Windo
wPadding
(
view
.
padding
,
view
.
devicePixelRatio
));
expect
(
data
.
viewPadding
,
EdgeInsets
.
from
Windo
wPadding
(
view
.
viewPadding
,
view
.
devicePixelRatio
));
expect
(
data
.
viewInsets
,
EdgeInsets
.
from
Windo
wPadding
(
view
.
viewInsets
,
view
.
devicePixelRatio
));
expect
(
data
.
systemGestureInsets
,
EdgeInsets
.
from
Windo
wPadding
(
view
.
systemGestureInsets
,
view
.
devicePixelRatio
));
expect
(
data
.
padding
,
EdgeInsets
.
from
Vie
wPadding
(
view
.
padding
,
view
.
devicePixelRatio
));
expect
(
data
.
viewPadding
,
EdgeInsets
.
from
Vie
wPadding
(
view
.
viewPadding
,
view
.
devicePixelRatio
));
expect
(
data
.
viewInsets
,
EdgeInsets
.
from
Vie
wPadding
(
view
.
viewInsets
,
view
.
devicePixelRatio
));
expect
(
data
.
systemGestureInsets
,
EdgeInsets
.
from
Vie
wPadding
(
view
.
systemGestureInsets
,
view
.
devicePixelRatio
));
expect
(
data
.
accessibleNavigation
,
platformDispatcher
.
accessibilityFeatures
.
accessibleNavigation
);
expect
(
data
.
invertColors
,
platformDispatcher
.
accessibilityFeatures
.
invertColors
);
expect
(
data
.
disableAnimations
,
platformDispatcher
.
accessibilityFeatures
.
disableAnimations
);
...
...
@@ -260,10 +260,10 @@ void main() {
final
TestView
view
=
TestView
(
physicalSize:
const
Size
(
300
,
600
),
devicePixelRatio:
3.0
,
padding:
const
Test
Windo
wPadding
(
15
),
viewPadding:
const
Test
Windo
wPadding
(
75
),
viewInsets:
const
Test
Windo
wPadding
(
45
),
systemGestureInsets:
const
Test
Windo
wPadding
(
9
),
padding:
const
Test
Vie
wPadding
(
15
),
viewPadding:
const
Test
Vie
wPadding
(
75
),
viewInsets:
const
Test
Vie
wPadding
(
45
),
systemGestureInsets:
const
Test
Vie
wPadding
(
9
),
);
late
MediaQueryData
data
;
...
...
@@ -285,10 +285,10 @@ void main() {
expect
(
data
.
devicePixelRatio
,
view
.
devicePixelRatio
);
expect
(
data
.
textScaleFactor
,
platformData
.
textScaleFactor
);
expect
(
data
.
platformBrightness
,
platformData
.
platformBrightness
);
expect
(
data
.
padding
,
EdgeInsets
.
from
Windo
wPadding
(
view
.
padding
,
view
.
devicePixelRatio
));
expect
(
data
.
viewPadding
,
EdgeInsets
.
from
Windo
wPadding
(
view
.
viewPadding
,
view
.
devicePixelRatio
));
expect
(
data
.
viewInsets
,
EdgeInsets
.
from
Windo
wPadding
(
view
.
viewInsets
,
view
.
devicePixelRatio
));
expect
(
data
.
systemGestureInsets
,
EdgeInsets
.
from
Windo
wPadding
(
view
.
systemGestureInsets
,
view
.
devicePixelRatio
));
expect
(
data
.
padding
,
EdgeInsets
.
from
Vie
wPadding
(
view
.
padding
,
view
.
devicePixelRatio
));
expect
(
data
.
viewPadding
,
EdgeInsets
.
from
Vie
wPadding
(
view
.
viewPadding
,
view
.
devicePixelRatio
));
expect
(
data
.
viewInsets
,
EdgeInsets
.
from
Vie
wPadding
(
view
.
viewInsets
,
view
.
devicePixelRatio
));
expect
(
data
.
systemGestureInsets
,
EdgeInsets
.
from
Vie
wPadding
(
view
.
systemGestureInsets
,
view
.
devicePixelRatio
));
expect
(
data
.
accessibleNavigation
,
platformData
.
accessibleNavigation
);
expect
(
data
.
invertColors
,
platformData
.
invertColors
);
expect
(
data
.
disableAnimations
,
platformData
.
disableAnimations
);
...
...
@@ -312,10 +312,10 @@ void main() {
platformDispatcher:
platformDispatcher
,
physicalSize:
const
Size
(
300
,
600
),
devicePixelRatio:
3.0
,
padding:
const
Test
Windo
wPadding
(
15
),
viewPadding:
const
Test
Windo
wPadding
(
75
),
viewInsets:
const
Test
Windo
wPadding
(
45
),
systemGestureInsets:
const
Test
Windo
wPadding
(
9
),
padding:
const
Test
Vie
wPadding
(
15
),
viewPadding:
const
Test
Vie
wPadding
(
75
),
viewInsets:
const
Test
Vie
wPadding
(
45
),
systemGestureInsets:
const
Test
Vie
wPadding
(
9
),
);
late
MediaQueryData
data
;
...
...
@@ -343,10 +343,10 @@ void main() {
expect
(
data
.
devicePixelRatio
,
view
.
devicePixelRatio
);
expect
(
data
.
textScaleFactor
,
platformDispatcher
.
textScaleFactor
);
expect
(
data
.
platformBrightness
,
platformDispatcher
.
platformBrightness
);
expect
(
data
.
padding
,
EdgeInsets
.
from
Windo
wPadding
(
view
.
padding
,
view
.
devicePixelRatio
));
expect
(
data
.
viewPadding
,
EdgeInsets
.
from
Windo
wPadding
(
view
.
viewPadding
,
view
.
devicePixelRatio
));
expect
(
data
.
viewInsets
,
EdgeInsets
.
from
Windo
wPadding
(
view
.
viewInsets
,
view
.
devicePixelRatio
));
expect
(
data
.
systemGestureInsets
,
EdgeInsets
.
from
Windo
wPadding
(
view
.
systemGestureInsets
,
view
.
devicePixelRatio
));
expect
(
data
.
padding
,
EdgeInsets
.
from
Vie
wPadding
(
view
.
padding
,
view
.
devicePixelRatio
));
expect
(
data
.
viewPadding
,
EdgeInsets
.
from
Vie
wPadding
(
view
.
viewPadding
,
view
.
devicePixelRatio
));
expect
(
data
.
viewInsets
,
EdgeInsets
.
from
Vie
wPadding
(
view
.
viewInsets
,
view
.
devicePixelRatio
));
expect
(
data
.
systemGestureInsets
,
EdgeInsets
.
from
Vie
wPadding
(
view
.
systemGestureInsets
,
view
.
devicePixelRatio
));
expect
(
data
.
accessibleNavigation
,
platformDispatcher
.
accessibilityFeatures
.
accessibleNavigation
);
expect
(
data
.
invertColors
,
platformDispatcher
.
accessibilityFeatures
.
invertColors
);
expect
(
data
.
disableAnimations
,
platformDispatcher
.
accessibilityFeatures
.
disableAnimations
);
...
...
@@ -1533,13 +1533,13 @@ class TestView implements FlutterView {
@override
final
double
devicePixelRatio
;
@override
final
Windo
wPadding
padding
;
final
Vie
wPadding
padding
;
@override
final
Windo
wPadding
viewPadding
;
final
Vie
wPadding
viewPadding
;
@override
final
Windo
wPadding
viewInsets
;
final
Vie
wPadding
viewInsets
;
@override
final
Windo
wPadding
systemGestureInsets
;
final
Vie
wPadding
systemGestureInsets
;
@override
final
ViewConfiguration
viewConfiguration
=
const
ViewConfiguration
();
@override
...
...
@@ -1549,8 +1549,8 @@ class TestView implements FlutterView {
dynamic
noSuchMethod
(
Invocation
invocation
)
=>
super
.
noSuchMethod
(
invocation
);
}
class
Test
WindowPadding
implements
Windo
wPadding
{
const
Test
Windo
wPadding
(
this
.
value
);
class
Test
ViewPadding
implements
Vie
wPadding
{
const
Test
Vie
wPadding
(
this
.
value
);
final
double
value
;
@override
...
...
packages/flutter/test_fixes/painting/painting.dart
0 → 100644
View file @
5ccb4d4b
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/painting.dart'
;
void
main
(
)
{
// Change made in https://github.com/flutter/flutter/pull/121152
final
EdgeInsets
insets
=
EdgeInsets
.
fromWindowPadding
(
ViewPadding
.
zero
,
3.0
);
}
packages/flutter/test_fixes/painting/painting.dart.expect
0 → 100644
View file @
5ccb4d4b
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/painting.dart';
void main() {
// Change made in https://github.com/flutter/flutter/pull/121152
final EdgeInsets insets = EdgeInsets.fromViewPadding(ViewPadding.zero, 3.0);
}
packages/flutter_test/lib/src/window.dart
View file @
5ccb4d4b
...
...
@@ -98,11 +98,11 @@ class TestWindow implements ui.SingletonFlutterWindow {
}
@override
ui
.
Windo
wPadding
get
viewInsets
=>
_viewInsetsTestValue
??
_window
.
viewInsets
;
ui
.
Windo
wPadding
?
_viewInsetsTestValue
;
ui
.
Vie
wPadding
get
viewInsets
=>
_viewInsetsTestValue
??
_window
.
viewInsets
;
ui
.
Vie
wPadding
?
_viewInsetsTestValue
;
/// Hides the real view insets and reports the given [viewInsetsTestValue]
/// instead.
set
viewInsetsTestValue
(
ui
.
Windo
wPadding
viewInsetsTestValue
)
{
// ignore: avoid_setters_without_getters
set
viewInsetsTestValue
(
ui
.
Vie
wPadding
viewInsetsTestValue
)
{
// ignore: avoid_setters_without_getters
_viewInsetsTestValue
=
viewInsetsTestValue
;
onMetricsChanged
?.
call
();
}
...
...
@@ -114,11 +114,11 @@ class TestWindow implements ui.SingletonFlutterWindow {
}
@override
ui
.
Windo
wPadding
get
viewPadding
=>
_viewPaddingTestValue
??
_window
.
padding
;
ui
.
Windo
wPadding
?
_viewPaddingTestValue
;
ui
.
Vie
wPadding
get
viewPadding
=>
_viewPaddingTestValue
??
_window
.
padding
;
ui
.
Vie
wPadding
?
_viewPaddingTestValue
;
/// Hides the real view padding and reports the given [paddingTestValue]
/// instead.
set
viewPaddingTestValue
(
ui
.
Windo
wPadding
viewPaddingTestValue
)
{
// ignore: avoid_setters_without_getters
set
viewPaddingTestValue
(
ui
.
Vie
wPadding
viewPaddingTestValue
)
{
// ignore: avoid_setters_without_getters
_viewPaddingTestValue
=
viewPaddingTestValue
;
onMetricsChanged
?.
call
();
}
...
...
@@ -130,10 +130,10 @@ class TestWindow implements ui.SingletonFlutterWindow {
}
@override
ui
.
Windo
wPadding
get
padding
=>
_paddingTestValue
??
_window
.
padding
;
ui
.
Windo
wPadding
?
_paddingTestValue
;
ui
.
Vie
wPadding
get
padding
=>
_paddingTestValue
??
_window
.
padding
;
ui
.
Vie
wPadding
?
_paddingTestValue
;
/// Hides the real padding and reports the given [paddingTestValue] instead.
set
paddingTestValue
(
ui
.
Windo
wPadding
paddingTestValue
)
{
// ignore: avoid_setters_without_getters
set
paddingTestValue
(
ui
.
Vie
wPadding
paddingTestValue
)
{
// ignore: avoid_setters_without_getters
_paddingTestValue
=
paddingTestValue
;
onMetricsChanged
?.
call
();
}
...
...
@@ -158,10 +158,10 @@ class TestWindow implements ui.SingletonFlutterWindow {
}
@override
ui
.
Windo
wPadding
get
systemGestureInsets
=>
_systemGestureInsetsTestValue
??
_window
.
systemGestureInsets
;
ui
.
Windo
wPadding
?
_systemGestureInsetsTestValue
;
ui
.
Vie
wPadding
get
systemGestureInsets
=>
_systemGestureInsetsTestValue
??
_window
.
systemGestureInsets
;
ui
.
Vie
wPadding
?
_systemGestureInsetsTestValue
;
/// Hides the real system gesture insets and reports the given [systemGestureInsetsTestValue] instead.
set
systemGestureInsetsTestValue
(
ui
.
Windo
wPadding
systemGestureInsetsTestValue
)
{
// ignore: avoid_setters_without_getters
set
systemGestureInsetsTestValue
(
ui
.
Vie
wPadding
systemGestureInsetsTestValue
)
{
// ignore: avoid_setters_without_getters
_systemGestureInsetsTestValue
=
systemGestureInsetsTestValue
;
onMetricsChanged
?.
call
();
}
...
...
packages/flutter_test/test/window_test.dart
View file @
5ccb4d4b
...
...
@@ -3,7 +3,7 @@
// found in the LICENSE file.
import
'dart:ui'
as
ui
show
window
;
import
'dart:ui'
show
AccessibilityFeatures
,
Brightness
,
Locale
,
PlatformDispatcher
,
SemanticsUpdate
,
SingletonFlutterWindow
,
Size
,
Windo
wPadding
;
import
'dart:ui'
show
AccessibilityFeatures
,
Brightness
,
Locale
,
PlatformDispatcher
,
SemanticsUpdate
,
SingletonFlutterWindow
,
Size
,
Vie
wPadding
;
import
'package:flutter/semantics.dart'
show
SemanticsUpdateBuilder
;
import
'package:flutter/widgets.dart'
show
WidgetsBinding
,
WidgetsBindingObserver
;
...
...
@@ -45,28 +45,28 @@ void main() {
});
testWidgets
(
'TestWindow can fake view insets'
,
(
WidgetTester
tester
)
async
{
verifyThatTestWindowCanFakeProperty
<
Windo
wPadding
>(
verifyThatTestWindowCanFakeProperty
<
Vie
wPadding
>(
tester:
tester
,
realValue:
ui
.
window
.
viewInsets
,
fakeValue:
const
Fake
Windo
wPadding
(),
fakeValue:
const
Fake
Vie
wPadding
(),
propertyRetriever:
()
{
return
WidgetsBinding
.
instance
.
window
.
viewInsets
;
},
propertyFaker:
(
TestWidgetsFlutterBinding
binding
,
Windo
wPadding
fakeValue
)
{
propertyFaker:
(
TestWidgetsFlutterBinding
binding
,
Vie
wPadding
fakeValue
)
{
binding
.
window
.
viewInsetsTestValue
=
fakeValue
;
},
);
});
testWidgets
(
'TestWindow can fake padding'
,
(
WidgetTester
tester
)
async
{
verifyThatTestWindowCanFakeProperty
<
Windo
wPadding
>(
verifyThatTestWindowCanFakeProperty
<
Vie
wPadding
>(
tester:
tester
,
realValue:
ui
.
window
.
padding
,
fakeValue:
const
Fake
Windo
wPadding
(),
fakeValue:
const
Fake
Vie
wPadding
(),
propertyRetriever:
()
{
return
WidgetsBinding
.
instance
.
window
.
padding
;
},
propertyFaker:
(
TestWidgetsFlutterBinding
binding
,
Windo
wPadding
fakeValue
)
{
propertyFaker:
(
TestWidgetsFlutterBinding
binding
,
Vie
wPadding
fakeValue
)
{
binding
.
window
.
paddingTestValue
=
fakeValue
;
},
);
...
...
@@ -245,8 +245,8 @@ TestWidgetsFlutterBinding retrieveTestBinding(WidgetTester tester) {
return
testBinding
;
}
class
Fake
WindowPadding
implements
Windo
wPadding
{
const
Fake
Windo
wPadding
({
class
Fake
ViewPadding
implements
Vie
wPadding
{
const
Fake
Vie
wPadding
({
this
.
left
=
0.0
,
this
.
top
=
0.0
,
this
.
right
=
0.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