Merge pull request #1133 from Hixie/TabBarSelectionState.of

Reimplement TabBarSelectionState.of() using new methods
This commit is contained in:
Ian Hickson
2016-01-07 23:12:10 -08:00

View File

@@ -409,15 +409,7 @@ class TabBarSelection<T> extends StatefulComponent {
TabBarSelectionState createState() => new TabBarSelectionState<T>();
static TabBarSelectionState of(BuildContext context) {
TabBarSelectionState result = null;
context.visitAncestorElements((ancestor) {
if (ancestor is StatefulComponentElement && ancestor.state is TabBarSelectionState) {
result = ancestor.state;
return false;
}
return true;
});
return result;
return context.ancestorStateOfType(const TypeMatcher<TabBarSelectionState>());
}
}