Commit a309cea1 authored by Hixie's avatar Hixie

Resurrect spinning_mixed.

It had bit-rotted. Also improve our error reporting for missing Material.
parent b5470df8
...@@ -40,10 +40,10 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) { ...@@ -40,10 +40,10 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) {
child: new Column( child: new Column(
children: <Widget>[ children: <Widget>[
new Rectangle(const Color(0xFF00FFFF)), new Rectangle(const Color(0xFF00FFFF)),
new Container( new Material(
child: new Container(
padding: new EdgeDims.all(10.0), padding: new EdgeDims.all(10.0),
margin: new EdgeDims.all(10.0), margin: new EdgeDims.all(10.0),
decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)),
child: new Row( child: new Row(
children: <Widget>[ children: <Widget>[
new RaisedButton( new RaisedButton(
...@@ -62,6 +62,7 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) { ...@@ -62,6 +62,7 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) {
], ],
justifyContent: FlexJustifyContent.spaceAround justifyContent: FlexJustifyContent.spaceAround
) )
)
), ),
new Rectangle(const Color(0xFFFFFF00)), new Rectangle(const Color(0xFFFFFF00)),
], ],
...@@ -86,6 +87,7 @@ void rotate(Duration timeStamp) { ...@@ -86,6 +87,7 @@ void rotate(Duration timeStamp) {
} }
void main() { void main() {
WidgetFlutterBinding.ensureInitialized();
RenderProxyBox proxy = new RenderProxyBox(); RenderProxyBox proxy = new RenderProxyBox();
attachWidgetTreeToRenderTree(proxy); attachWidgetTreeToRenderTree(proxy);
...@@ -97,7 +99,6 @@ void main() { ...@@ -97,7 +99,6 @@ void main() {
transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity()); transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity());
RenderPadding root = new RenderPadding(padding: new EdgeDims.all(80.0), child: transformBox); RenderPadding root = new RenderPadding(padding: new EdgeDims.all(80.0), child: transformBox);
WidgetFlutterBinding.ensureInitialized() WidgetFlutterBinding.instance.renderView.child = root;
..renderView.child = root WidgetFlutterBinding.instance.addPersistentFrameCallback(rotate);
..addPersistentFrameCallback(rotate);
} }
...@@ -8,11 +8,14 @@ import 'material.dart'; ...@@ -8,11 +8,14 @@ import 'material.dart';
bool debugCheckHasMaterial(BuildContext context) { bool debugCheckHasMaterial(BuildContext context) {
assert(() { assert(() {
if (context.widget is Material || context.ancestorWidgetOfExactType(Material) != null) if (context.widget is! Material && context.ancestorWidgetOfExactType(Material) == null) {
return true;
Element element = context; Element element = context;
debugPrint('${context.widget} needs to be placed inside a Material widget. Ownership chain:\n${element.debugGetOwnershipChain(10)}'); throw new WidgetError(
return false; 'Missing Material widget.',
'${context.widget} needs to be placed inside a Material widget. Ownership chain:\n${element.debugGetOwnershipChain(10)}'
);
}
return true;
}); });
return true; return true;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment