make some BuildContext methods generics (#44189)

* make BuildContext.{ancestorStateOfType,ancestorRenderObjectOfType,rootAncestorStateOfType} generic

* make BuildContext.inheritFromWidgetOfExactType generic

* make BuildContext.ancestorInheritedElementForWidgetOfExactType generic

* make BuildContext.ancestorWidgetOfExactType generic

* fix snippet

* bump scoped_model on temp version

* update names

* Revert "bump scoped_model on temp version"

This reverts commit d1fcbba028cdb07f44738d1652391692d1ea5ec0.

* address review comments

* fix ci

* address review comments

* repeat the deprecation notice

* fix uppercase

* use of recommanded deprecation syntax

* address review comment
This commit is contained in:
Alexandre Ardhuin
2019-11-22 17:35:20 +01:00
committed by GitHub
parent 7fcf030610
commit fcb40a05bb
65 changed files with 387 additions and 194 deletions

View File

@@ -17,7 +17,7 @@ class ComplexLayoutApp extends StatefulWidget {
@override
ComplexLayoutAppState createState() => ComplexLayoutAppState();
static ComplexLayoutAppState of(BuildContext context) => context.ancestorStateOfType(const TypeMatcher<ComplexLayoutAppState>());
static ComplexLayoutAppState of(BuildContext context) => context.findAncestorStateOfType<ComplexLayoutAppState>();
}
class ComplexLayoutAppState extends State<ComplexLayoutApp> {
@@ -84,7 +84,7 @@ class ComplexLayout extends StatefulWidget {
@override
ComplexLayoutState createState() => ComplexLayoutState();
static ComplexLayoutState of(BuildContext context) => context.ancestorStateOfType(const TypeMatcher<ComplexLayoutState>());
static ComplexLayoutState of(BuildContext context) => context.findAncestorStateOfType<ComplexLayoutState>();
}
class ComplexLayoutState extends State<ComplexLayout> {