diff --git a/packages/flutter/lib/fix_data.yaml b/packages/flutter/lib/fix_data.yaml index 0ed5d2f404..e05be77094 100644 --- a/packages/flutter/lib/fix_data.yaml +++ b/packages/flutter/lib/fix_data.yaml @@ -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 diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index 0d301f8f4c..4d06049a93 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -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({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() { 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() { 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>() { 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>() { 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() { assert(_debugCheckStateIsActiveForAncestorLookup()); diff --git a/packages/flutter/test_fixes/cupertino.dart b/packages/flutter/test_fixes/cupertino.dart index 6469c47441..c960b37bf6 100644 --- a/packages/flutter/test_fixes/cupertino.dart +++ b/packages/flutter/test_fixes/cupertino.dart @@ -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()); + element.rootAncestorStateOfType(TypeMatcher()); + element.ancestorRenderObjectOfType(TypeMatcher()); + // Changes made in https://github.com/flutter/flutter/pull/45941 final WidgetsBinding binding = WidgetsBinding.instance!; binding.deferFirstFrameReport(); diff --git a/packages/flutter/test_fixes/cupertino.dart.expect b/packages/flutter/test_fixes/cupertino.dart.expect index ac4e58dbe0..05d04c128b 100644 --- a/packages/flutter/test_fixes/cupertino.dart.expect +++ b/packages/flutter/test_fixes/cupertino.dart.expect @@ -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(); + element.getElementForInheritedWidgetOfExactType(); + element.findAncestorWidgetOfExactType(); + element.findAncestorStateOfType(); + element.findRootAncestorStateOfType(); + element.findAncestorRenderObjectOfType(); + // Changes made in https://github.com/flutter/flutter/pull/45941 final WidgetsBinding binding = WidgetsBinding.instance!; binding.deferFirstFrame(); diff --git a/packages/flutter/test_fixes/material.dart b/packages/flutter/test_fixes/material.dart index 467e426e08..9d161ad7fe 100644 --- a/packages/flutter/test_fixes/material.dart +++ b/packages/flutter/test_fixes/material.dart @@ -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()); + element.rootAncestorStateOfType(TypeMatcher()); + element.ancestorRenderObjectOfType(TypeMatcher()); + // Changes made in https://github.com/flutter/flutter/pull/45941 final WidgetsBinding binding = WidgetsBinding.instance!; binding.deferFirstFrameReport(); diff --git a/packages/flutter/test_fixes/material.dart.expect b/packages/flutter/test_fixes/material.dart.expect index 81a2b9e49f..03914b229c 100644 --- a/packages/flutter/test_fixes/material.dart.expect +++ b/packages/flutter/test_fixes/material.dart.expect @@ -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(); + element.getElementForInheritedWidgetOfExactType(); + element.findAncestorWidgetOfExactType(); + element.findAncestorStateOfType(); + element.findRootAncestorStateOfType(); + element.findAncestorRenderObjectOfType(); + // Changes made in https://github.com/flutter/flutter/pull/45941 final WidgetsBinding binding = WidgetsBinding.instance!; binding.deferFirstFrame(); diff --git a/packages/flutter/test_fixes/widgets.dart b/packages/flutter/test_fixes/widgets.dart index d86e860fdf..0de42a0b01 100644 --- a/packages/flutter/test_fixes/widgets.dart +++ b/packages/flutter/test_fixes/widgets.dart @@ -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()); + element.rootAncestorStateOfType(TypeMatcher()); + element.ancestorRenderObjectOfType(TypeMatcher()); + // Changes made in https://github.com/flutter/flutter/pull/45941 final WidgetsBinding binding = WidgetsBinding.instance!; binding.deferFirstFrameReport(); diff --git a/packages/flutter/test_fixes/widgets.dart.expect b/packages/flutter/test_fixes/widgets.dart.expect index 4287ebba18..92171a8429 100644 --- a/packages/flutter/test_fixes/widgets.dart.expect +++ b/packages/flutter/test_fixes/widgets.dart.expect @@ -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(); + element.getElementForInheritedWidgetOfExactType(); + element.findAncestorWidgetOfExactType(); + element.findAncestorStateOfType(); + element.findRootAncestorStateOfType(); + element.findAncestorRenderObjectOfType(); + // Changes made in https://github.com/flutter/flutter/pull/45941 final WidgetsBinding binding = WidgetsBinding.instance!; binding.deferFirstFrame();