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
550a85da
Unverified
Commit
550a85da
authored
Jan 22, 2021
by
Kate Lovett
Committed by
GitHub
Jan 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove deprecated Element methods (#72903)
parent
45cf2792
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
203 additions
and
130 deletions
+203
-130
fix_data.yaml
packages/flutter/lib/fix_data.yaml
+143
-0
framework.dart
packages/flutter/lib/src/widgets/framework.dart
+0
-130
cupertino.dart
packages/flutter/test_fixes/cupertino.dart
+10
-0
cupertino.dart.expect
packages/flutter/test_fixes/cupertino.dart.expect
+10
-0
material.dart
packages/flutter/test_fixes/material.dart
+10
-0
material.dart.expect
packages/flutter/test_fixes/material.dart.expect
+10
-0
widgets.dart
packages/flutter/test_fixes/widgets.dart
+10
-0
widgets.dart.expect
packages/flutter/test_fixes/widgets.dart.expect
+10
-0
No files found.
packages/flutter/lib/fix_data.yaml
View file @
550a85da
...
...
@@ -11,6 +11,149 @@
version
:
1
transforms
:
# Changes made in https://github.com/flutter/flutter/pull/44189.
-
title
:
'
Rename
to
dependOnInheritedElement'
date
:
2020-12-23
element
:
uris
:
[
'
material.dart'
,
'
cupertino.dart'
,
'
widgets.dart'
]
method
:
'
inheritFromElement'
inClass
:
'
Element'
changes
:
-
kind
:
'
rename'
newName
:
'
dependOnInheritedElement'
# Changes made in https://github.com/flutter/flutter/pull/44189.
-
title
:
'
Rename
to
dependOnInheritedWidgetOfExactType'
date
:
2020-09-14
element
:
uris
:
[
'
material.dart'
,
'
cupertino.dart'
,
'
widgets.dart'
]
method
:
'
inheritFromWidgetOfExactType'
inClass
:
'
Element'
changes
:
-
kind
:
'
rename'
newName
:
'
dependOnInheritedWidgetOfExactType'
-
kind
:
'
addTypeParameter'
index
:
0
name
:
'
T'
argumentValue
:
expression
:
'
{%
type
%}'
variables
:
type
:
kind
:
'
fragment'
value
:
'
arguments[0]'
-
kind
:
'
removeParameter'
index
:
0
# Changes made in https://github.com/flutter/flutter/pull/44189.
-
title
:
'
Rename
to
getElementForInheritedWidgetOfExactType'
date
:
2020-09-14
element
:
uris
:
[
'
material.dart'
,
'
cupertino.dart'
,
'
widgets.dart'
]
method
:
'
ancestorInheritedElementForWidgetOfExactType'
inClass
:
'
Element'
changes
:
-
kind
:
'
rename'
newName
:
'
getElementForInheritedWidgetOfExactType'
-
kind
:
'
addTypeParameter'
index
:
0
name
:
'
T'
argumentValue
:
expression
:
'
{%
type
%}'
variables
:
type
:
kind
:
'
fragment'
value
:
'
arguments[0]'
-
kind
:
'
removeParameter'
index
:
0
# Changes made in https://github.com/flutter/flutter/pull/44189.
-
title
:
'
Rename
to
getElementForInheritedWidgetOfExactType'
date
:
2020-12-23
element
:
uris
:
[
'
material.dart'
,
'
cupertino.dart'
,
'
widgets.dart'
]
method
:
'
ancestorWidgetOfExactType'
inClass
:
'
Element'
changes
:
-
kind
:
'
rename'
newName
:
'
findAncestorWidgetOfExactType'
-
kind
:
'
addTypeParameter'
index
:
0
name
:
'
T'
argumentValue
:
expression
:
'
{%
type
%}'
variables
:
type
:
kind
:
'
fragment'
value
:
'
arguments[0]'
-
kind
:
'
removeParameter'
index
:
0
# Changes made in https://github.com/flutter/flutter/pull/44189.
-
title
:
'
Rename
to
findAncestorStateOfType'
date
:
2020-12-23
element
:
uris
:
[
'
material.dart'
,
'
cupertino.dart'
,
'
widgets.dart'
]
method
:
'
ancestorStateOfType'
inClass
:
'
Element'
changes
:
-
kind
:
'
rename'
newName
:
'
findAncestorStateOfType'
-
kind
:
'
addTypeParameter'
index
:
0
name
:
'
T'
argumentValue
:
expression
:
'
{%
type
%}'
variables
:
type
:
kind
:
'
fragment'
value
:
'
arguments[0].typeArguments[0]'
-
kind
:
'
removeParameter'
index
:
0
# Changes made in https://github.com/flutter/flutter/pull/44189.
-
title
:
'
Rename
to
findAncestorRenderObjectOfType'
date
:
2020-12-23
element
:
uris
:
[
'
material.dart'
,
'
cupertino.dart'
,
'
widgets.dart'
]
method
:
'
ancestorRenderObjectOfType'
inClass
:
'
Element'
changes
:
-
kind
:
'
rename'
newName
:
'
findAncestorRenderObjectOfType'
-
kind
:
'
addTypeParameter'
index
:
0
name
:
'
T'
argumentValue
:
expression
:
'
{%
type
%}'
variables
:
type
:
kind
:
'
fragment'
value
:
'
arguments[0].typeArguments[0]'
-
kind
:
'
removeParameter'
index
:
0
# Changes made in https://github.com/flutter/flutter/pull/44189.
-
title
:
'
Rename
to
findAncestorRenderObjectOfType'
date
:
2020-12-23
element
:
uris
:
[
'
material.dart'
,
'
cupertino.dart'
,
'
widgets.dart'
]
method
:
'
rootAncestorStateOfType'
inClass
:
'
Element'
changes
:
-
kind
:
'
rename'
newName
:
'
findRootAncestorStateOfType'
-
kind
:
'
addTypeParameter'
index
:
0
name
:
'
T'
argumentValue
:
expression
:
'
{%
type
%}'
variables
:
type
:
kind
:
'
fragment'
value
:
'
arguments[0].typeArguments[0]'
-
kind
:
'
removeParameter'
index
:
0
# Changes made in https://github.com/flutter/flutter/pull/26259
-
title
:
'
Rename
to
resizeToAvoidBottomInset'
date
:
2020-12-23
...
...
packages/flutter/lib/src/widgets/framework.dart
View file @
550a85da
...
...
@@ -3879,19 +3879,6 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
return
true
;
}
/// Registers this build context with [ancestor] such that when
/// [ancestor]'s widget changes this build context is rebuilt.
///
/// This method is deprecated. Please use [dependOnInheritedElement] instead.
// TODO(a14n): Remove this when it goes to stable, https://github.com/flutter/flutter/pull/44189
@Deprecated
(
'Use dependOnInheritedElement instead. '
'This feature was deprecated after v1.12.1.'
)
InheritedWidget
inheritFromElement
(
InheritedElement
ancestor
,
{
Object
?
aspect
})
{
return
dependOnInheritedElement
(
ancestor
,
aspect:
aspect
);
}
@override
InheritedWidget
dependOnInheritedElement
(
InheritedElement
ancestor
,
{
Object
?
aspect
})
{
assert
(
ancestor
!=
null
);
...
...
@@ -3901,29 +3888,6 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
return
ancestor
.
widget
;
}
/// Obtains the nearest widget of the given type, which must be the type of a
/// concrete [InheritedWidget] subclass, and registers this build context with
/// that widget such that when that widget changes (or a new widget of that
/// type is introduced, or the widget goes away), this build context is
/// rebuilt so that it can obtain new values from that widget.
///
/// This method is deprecated. Please use [dependOnInheritedWidgetOfExactType] instead.
// TODO(a14n): Remove this when it goes to stable, https://github.com/flutter/flutter/pull/44189
@Deprecated
(
'Use dependOnInheritedWidgetOfExactType instead. '
'This feature was deprecated after v1.12.1.'
)
InheritedWidget
?
inheritFromWidgetOfExactType
(
Type
targetType
,
{
Object
?
aspect
})
{
assert
(
_debugCheckStateIsActiveForAncestorLookup
());
final
InheritedElement
?
ancestor
=
_inheritedWidgets
==
null
?
null
:
_inheritedWidgets
![
targetType
];
if
(
ancestor
!=
null
)
{
assert
(
ancestor
is
InheritedElement
);
return
inheritFromElement
(
ancestor
,
aspect:
aspect
);
}
_hadUnsatisfiedDependencies
=
true
;
return
null
;
}
@override
T
?
dependOnInheritedWidgetOfExactType
<
T
extends
InheritedWidget
>({
Object
?
aspect
})
{
assert
(
_debugCheckStateIsActiveForAncestorLookup
());
...
...
@@ -3936,21 +3900,6 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
return
null
;
}
/// Obtains the element corresponding to the nearest widget of the given type,
/// which must be the type of a concrete [InheritedWidget] subclass.
///
/// This method is deprecated. Please use [getElementForInheritedWidgetOfExactType] instead.
// TODO(a14n): Remove this when it goes to stable, https://github.com/flutter/flutter/pull/44189
@Deprecated
(
'Use getElementForInheritedWidgetOfExactType instead. '
'This feature was deprecated after v1.12.1.'
)
InheritedElement
?
ancestorInheritedElementForWidgetOfExactType
(
Type
targetType
)
{
assert
(
_debugCheckStateIsActiveForAncestorLookup
());
final
InheritedElement
?
ancestor
=
_inheritedWidgets
==
null
?
null
:
_inheritedWidgets
![
targetType
];
return
ancestor
;
}
@override
InheritedElement
?
getElementForInheritedWidgetOfExactType
<
T
extends
InheritedWidget
>()
{
assert
(
_debugCheckStateIsActiveForAncestorLookup
());
...
...
@@ -3963,23 +3912,6 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
_inheritedWidgets
=
_parent
?.
_inheritedWidgets
;
}
/// Returns the nearest ancestor widget of the given type, which must be the
/// type of a concrete [Widget] subclass.
///
/// This method is deprecated. Please use [findAncestorWidgetOfExactType] instead.
// TODO(a14n): Remove this when it goes to stable, https://github.com/flutter/flutter/pull/44189
@Deprecated
(
'Use findAncestorWidgetOfExactType instead. '
'This feature was deprecated after v1.12.1.'
)
Widget
?
ancestorWidgetOfExactType
(
Type
targetType
)
{
assert
(
_debugCheckStateIsActiveForAncestorLookup
());
Element
?
ancestor
=
_parent
;
while
(
ancestor
!=
null
&&
ancestor
.
widget
.
runtimeType
!=
targetType
)
ancestor
=
ancestor
.
_parent
;
return
ancestor
?.
widget
;
}
@override
T
?
findAncestorWidgetOfExactType
<
T
extends
Widget
>()
{
assert
(
_debugCheckStateIsActiveForAncestorLookup
());
...
...
@@ -3989,27 +3921,6 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
return
ancestor
?.
widget
as
T
?;
}
/// Returns the [State] object of the nearest ancestor [StatefulWidget] widget
/// that matches the given [TypeMatcher].
///
/// This method is deprecated. Please use [findAncestorStateOfType] instead.
// TODO(a14n): Remove this when it goes to stable, https://github.com/flutter/flutter/pull/44189
@Deprecated
(
'Use findAncestorStateOfType instead. '
'This feature was deprecated after v1.12.1.'
)
State
?
ancestorStateOfType
(
TypeMatcher
matcher
)
{
assert
(
_debugCheckStateIsActiveForAncestorLookup
());
Element
?
ancestor
=
_parent
;
while
(
ancestor
!=
null
)
{
if
(
ancestor
is
StatefulElement
&&
matcher
.
check
(
ancestor
.
state
))
break
;
ancestor
=
ancestor
.
_parent
;
}
final
StatefulElement
?
statefulAncestor
=
ancestor
as
StatefulElement
?;
return
statefulAncestor
?.
state
;
}
@override
T
?
findAncestorStateOfType
<
T
extends
State
<
StatefulWidget
>>()
{
assert
(
_debugCheckStateIsActiveForAncestorLookup
());
...
...
@@ -4023,27 +3934,6 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
return
statefulAncestor
?.
state
as
T
?;
}
/// Returns the [State] object of the furthest ancestor [StatefulWidget] widget
/// that matches the given [TypeMatcher].
///
/// This method is deprecated. Please use [findRootAncestorStateOfType] instead.
// TODO(a14n): Remove this when it goes to stable, https://github.com/flutter/flutter/pull/44189
@Deprecated
(
'Use findRootAncestorStateOfType instead. '
'This feature was deprecated after v1.12.1.'
)
State
?
rootAncestorStateOfType
(
TypeMatcher
matcher
)
{
assert
(
_debugCheckStateIsActiveForAncestorLookup
());
Element
?
ancestor
=
_parent
;
StatefulElement
?
statefulAncestor
;
while
(
ancestor
!=
null
)
{
if
(
ancestor
is
StatefulElement
&&
matcher
.
check
(
ancestor
.
state
))
statefulAncestor
=
ancestor
;
ancestor
=
ancestor
.
_parent
;
}
return
statefulAncestor
?.
state
;
}
@override
T
?
findRootAncestorStateOfType
<
T
extends
State
<
StatefulWidget
>>()
{
assert
(
_debugCheckStateIsActiveForAncestorLookup
());
...
...
@@ -4057,26 +3947,6 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
return
statefulAncestor
?.
state
as
T
?;
}
/// Returns the [RenderObject] object of the nearest ancestor [RenderObjectWidget] widget
/// that matches the given [TypeMatcher].
///
/// This method is deprecated. Please use [findAncestorRenderObjectOfType] instead.
// TODO(a14n): Remove this when it goes to stable, https://github.com/flutter/flutter/pull/44189
@Deprecated
(
'Use findAncestorRenderObjectOfType instead. '
'This feature was deprecated after v1.12.1.'
)
RenderObject
?
ancestorRenderObjectOfType
(
TypeMatcher
matcher
)
{
assert
(
_debugCheckStateIsActiveForAncestorLookup
());
Element
?
ancestor
=
_parent
;
while
(
ancestor
!=
null
)
{
if
(
ancestor
is
RenderObjectElement
&&
matcher
.
check
(
ancestor
.
renderObject
))
return
ancestor
.
renderObject
;
ancestor
=
ancestor
.
_parent
;
}
return
null
;
}
@override
T
?
findAncestorRenderObjectOfType
<
T
extends
RenderObject
>()
{
assert
(
_debugCheckStateIsActiveForAncestorLookup
());
...
...
packages/flutter/test_fixes/cupertino.dart
View file @
550a85da
...
...
@@ -9,6 +9,16 @@ void main() {
const
CupertinoTextThemeData
themeData
=
CupertinoTextThemeData
(
brightness:
Brightness
.
dark
);
themeData
.
copyWith
(
brightness:
Brightness
.
light
);
// Changes made in https://github.com/flutter/flutter/pull/44189
const
Element
element
=
Element
(
myWidget
);
element
.
inheritFromElement
(
ancestor
);
element
.
inheritFromWidgetOfExactType
(
targetType
);
element
.
ancestorInheritedElementForWidgetOfExactType
(
targetType
);
element
.
ancestorWidgetOfExactType
(
targetType
);
element
.
ancestorStateOfType
(
TypeMatcher
<
targetType
>());
element
.
rootAncestorStateOfType
(
TypeMatcher
<
targetType
>());
element
.
ancestorRenderObjectOfType
(
TypeMatcher
<
targetType
>());
// Changes made in https://github.com/flutter/flutter/pull/45941
final
WidgetsBinding
binding
=
WidgetsBinding
.
instance
!;
binding
.
deferFirstFrameReport
();
...
...
packages/flutter/test_fixes/cupertino.dart.expect
View file @
550a85da
...
...
@@ -9,6 +9,16 @@ void main() {
const CupertinoTextThemeData themeData = CupertinoTextThemeData();
themeData.copyWith();
// Changes made in https://github.com/flutter/flutter/pull/44189
const Element element = Element(myWidget);
element.dependOnInheritedElement(ancestor);
element.dependOnInheritedWidgetOfExactType<targetType>();
element.getElementForInheritedWidgetOfExactType<targetType>();
element.findAncestorWidgetOfExactType<targetType>();
element.findAncestorStateOfType<targetType>();
element.findRootAncestorStateOfType<targetType>();
element.findAncestorRenderObjectOfType<targetType>();
// Changes made in https://github.com/flutter/flutter/pull/45941
final WidgetsBinding binding = WidgetsBinding.instance!;
binding.deferFirstFrame();
...
...
packages/flutter/test_fixes/material.dart
View file @
550a85da
...
...
@@ -13,6 +13,16 @@ void main() {
// Change made in https://github.com/flutter/flutter/pull/15303
showDialog
(
child:
Text
(
'Fix me.'
));
// Changes made in https://github.com/flutter/flutter/pull/44189
const
Element
element
=
Element
(
myWidget
);
element
.
inheritFromElement
(
ancestor
);
element
.
inheritFromWidgetOfExactType
(
targetType
);
element
.
ancestorInheritedElementForWidgetOfExactType
(
targetType
);
element
.
ancestorWidgetOfExactType
(
targetType
);
element
.
ancestorStateOfType
(
TypeMatcher
<
targetType
>());
element
.
rootAncestorStateOfType
(
TypeMatcher
<
targetType
>());
element
.
ancestorRenderObjectOfType
(
TypeMatcher
<
targetType
>());
// Changes made in https://github.com/flutter/flutter/pull/45941
final
WidgetsBinding
binding
=
WidgetsBinding
.
instance
!;
binding
.
deferFirstFrameReport
();
...
...
packages/flutter/test_fixes/material.dart.expect
View file @
550a85da
...
...
@@ -13,6 +13,16 @@ void main() {
// Change made in https://github.com/flutter/flutter/pull/15303
showDialog(builder: (context) => Text('Fix me.'));
// Changes made in https://github.com/flutter/flutter/pull/44189
const Element element = Element(myWidget);
element.dependOnInheritedElement(ancestor);
element.dependOnInheritedWidgetOfExactType<targetType>();
element.getElementForInheritedWidgetOfExactType<targetType>();
element.findAncestorWidgetOfExactType<targetType>();
element.findAncestorStateOfType<targetType>();
element.findRootAncestorStateOfType<targetType>();
element.findAncestorRenderObjectOfType<targetType>();
// Changes made in https://github.com/flutter/flutter/pull/45941
final WidgetsBinding binding = WidgetsBinding.instance!;
binding.deferFirstFrame();
...
...
packages/flutter/test_fixes/widgets.dart
View file @
550a85da
...
...
@@ -5,6 +5,16 @@
import
'package:flutter/widgets.dart'
;
void
main
(
)
{
// Changes made in https://github.com/flutter/flutter/pull/44189
const
Element
element
=
Element
(
myWidget
);
element
.
inheritFromElement
(
ancestor
);
element
.
inheritFromWidgetOfExactType
(
targetType
);
element
.
ancestorInheritedElementForWidgetOfExactType
(
targetType
);
element
.
ancestorWidgetOfExactType
(
targetType
);
element
.
ancestorStateOfType
(
TypeMatcher
<
targetType
>());
element
.
rootAncestorStateOfType
(
TypeMatcher
<
targetType
>());
element
.
ancestorRenderObjectOfType
(
TypeMatcher
<
targetType
>());
// Changes made in https://github.com/flutter/flutter/pull/45941
final
WidgetsBinding
binding
=
WidgetsBinding
.
instance
!;
binding
.
deferFirstFrameReport
();
...
...
packages/flutter/test_fixes/widgets.dart.expect
View file @
550a85da
...
...
@@ -5,6 +5,16 @@
import 'package:flutter/widgets.dart';
void main() {
// Changes made in https://github.com/flutter/flutter/pull/44189
const Element element = Element(myWidget);
element.dependOnInheritedElement(ancestor);
element.dependOnInheritedWidgetOfExactType<targetType>();
element.getElementForInheritedWidgetOfExactType<targetType>();
element.findAncestorWidgetOfExactType<targetType>();
element.findAncestorStateOfType<targetType>();
element.findRootAncestorStateOfType<targetType>();
element.findAncestorRenderObjectOfType<targetType>();
// Changes made in https://github.com/flutter/flutter/pull/45941
final WidgetsBinding binding = WidgetsBinding.instance!;
binding.deferFirstFrame();
...
...
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