forked from firka/flutter
Remove deprecated StatefulElement.inheritFromElement (#72901)
This commit is contained in:
@@ -11,6 +11,17 @@
|
||||
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: 'StatefulElement'
|
||||
changes:
|
||||
- kind: 'rename'
|
||||
newName: 'dependOnInheritedElement'
|
||||
|
||||
# Changes made in https://github.com/flutter/flutter/pull/15303
|
||||
- title: 'Replace child with builder'
|
||||
date: 2020-12-17
|
||||
@@ -31,6 +42,7 @@ transforms:
|
||||
value: 'arguments[child]'
|
||||
- kind: 'removeParameter'
|
||||
name: 'child'
|
||||
|
||||
# Changes made in https://github.com/flutter/flutter/pull/28602
|
||||
- title: 'Rename to fromMouseEvent'
|
||||
date: 2020-12-15
|
||||
|
||||
@@ -4919,16 +4919,6 @@ class StatefulElement extends ComponentElement {
|
||||
state._element = null;
|
||||
}
|
||||
|
||||
// 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.'
|
||||
)
|
||||
@override
|
||||
InheritedWidget inheritFromElement(Element ancestor, { Object? aspect }) {
|
||||
return dependOnInheritedElement(ancestor, aspect: aspect);
|
||||
}
|
||||
|
||||
@override
|
||||
InheritedWidget dependOnInheritedElement(Element ancestor, { Object? aspect }) {
|
||||
assert(ancestor != null);
|
||||
|
||||
@@ -8,4 +8,8 @@ void main() {
|
||||
// Change made in https://github.com/flutter/flutter/pull/41859
|
||||
const CupertinoTextThemeData themeData = CupertinoTextThemeData(brightness: Brightness.dark);
|
||||
themeData.copyWith(brightness: Brightness.light);
|
||||
|
||||
// Changes made in https://github.com/flutter/flutter/pull/44189
|
||||
const StatefulElement statefulElement = StatefulElement(myWidget);
|
||||
statefulElement.inheritFromElement(ancestor);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,8 @@ void main() {
|
||||
// Change made in https://github.com/flutter/flutter/pull/41859
|
||||
const CupertinoTextThemeData themeData = CupertinoTextThemeData();
|
||||
themeData.copyWith();
|
||||
|
||||
// Changes made in https://github.com/flutter/flutter/pull/44189
|
||||
const StatefulElement statefulElement = StatefulElement(myWidget);
|
||||
statefulElement.dependOnInheritedElement(ancestor);
|
||||
}
|
||||
|
||||
@@ -7,4 +7,8 @@ import 'package:flutter/material.dart';
|
||||
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 StatefulElement statefulElement = StatefulElement(myWidget);
|
||||
statefulElement.inheritFromElement(ancestor);
|
||||
}
|
||||
|
||||
@@ -7,4 +7,8 @@ import 'package:flutter/material.dart';
|
||||
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 StatefulElement statefulElement = StatefulElement(myWidget);
|
||||
statefulElement.dependOnInheritedElement(ancestor);
|
||||
}
|
||||
|
||||
11
packages/flutter/test_fixes/widgets.dart
Normal file
11
packages/flutter/test_fixes/widgets.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
// 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/widgets.dart';
|
||||
|
||||
void main() {
|
||||
// Changes made in https://github.com/flutter/flutter/pull/44189
|
||||
const StatefulElement statefulElement = StatefulElement(myWidget);
|
||||
statefulElement.inheritFromElement(ancestor);
|
||||
}
|
||||
11
packages/flutter/test_fixes/widgets.dart.expect
Normal file
11
packages/flutter/test_fixes/widgets.dart.expect
Normal file
@@ -0,0 +1,11 @@
|
||||
// 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/widgets.dart';
|
||||
|
||||
void main() {
|
||||
// Changes made in https://github.com/flutter/flutter/pull/44189
|
||||
const StatefulElement statefulElement = StatefulElement(myWidget);
|
||||
statefulElement.dependOnInheritedElement(ancestor);
|
||||
}
|
||||
Reference in New Issue
Block a user