|
|
|
|
|
|
|
|
|
|
public static bool debugCheckHasMediaQuery(BuildContext context) { |
|
|
|
D.assert(() => { |
|
|
|
if (!(context.widget is MediaQuery) && context.ancestorWidgetOfExactType(typeof(MediaQuery)) == null) { |
|
|
|
Element element = (Element) context; |
|
|
|
if (!(context.widget is MediaQuery) && context.findAncestorWidgetOfExactType<MediaQuery>() == null) { |
|
|
|
throw new UIWidgetsError( |
|
|
|
"No MediaQuery widget found.\n" + |
|
|
|
context.widget.GetType() + " widgets require a MediaQuery widget ancestor.\n" + |
|
|
|
|
|
|
" " + element.debugGetCreatorChain(10) + "\n" + |
|
|
|
" " + ((Element)context).debugGetCreatorChain(10) + "\n" + |
|
|
|
"Typically, the MediaQuery widget is introduced by the MaterialApp or " + |
|
|
|
"WidgetsApp widget at the top of your application widget tree." |
|
|
|
); |
|
|
|
|
|
|
public static bool debugCheckHasDirectionality(BuildContext context) { |
|
|
|
D.assert(() => { |
|
|
|
if (!(context.widget is Directionality) && |
|
|
|
context.ancestorWidgetOfExactType(typeof(Directionality)) == null) { |
|
|
|
Element element = (Element) context; |
|
|
|
context.findAncestorWidgetOfExactType<Directionality>() == null) { |
|
|
|
throw new UIWidgetsError( |
|
|
|
"No Directionality widget found.\n" + |
|
|
|
context.widget.GetType() + " widgets require a Directionality widget ancestor.\n" + |
|
|
|
|
|
|
" " + element.debugGetCreatorChain(10) + "\n" + |
|
|
|
" " + ((Element) context).debugGetCreatorChain(10) + "\n" + |
|
|
|
"Typically, the Directionality widget is introduced by the MaterialApp " + |
|
|
|
"or WidgetsApp widget at the top of your application widget tree. It " + |
|
|
|
"determines the ambient reading direction and is used, for example, to " + |
|
|
|