Rename AppView to SkyBinding.
Move app/view.dart to rendering/sky_binding.dart since it's part of the RenderObject API, really (it knows about RenderView intimately). The tests pass. I didn't check every last example. R=abarth@chromium.org Review URL: https://codereview.chromium.org/1183913006.
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
import 'dart:sky';
|
||||
|
||||
import 'package:sky/widgets/basic.dart';
|
||||
import 'package:sky/widgets/raised_button.dart';
|
||||
import 'package:sky/widgets/widget.dart';
|
||||
|
||||
import 'lib/game_demo.dart';
|
||||
import 'lib/sprites.dart';
|
||||
import 'package:sky/widgets/basic.dart';
|
||||
import 'package:sky/app/view.dart';
|
||||
import 'package:sky/widgets/ui_node.dart';
|
||||
import 'package:sky/widgets/raised_button.dart';
|
||||
|
||||
AppView app;
|
||||
|
||||
void main() {
|
||||
// Load images
|
||||
@@ -28,7 +27,7 @@ void allLoaded(ImageMap loader) {
|
||||
|
||||
class GameDemoApp extends App {
|
||||
|
||||
UINode build() {
|
||||
Widget build() {
|
||||
return new Stack([
|
||||
new GameDemo(),
|
||||
// new StackPositionedChild(
|
||||
@@ -53,9 +52,9 @@ ImageMap _loader;
|
||||
|
||||
class GameDemo extends OneChildRenderObjectWrapper {
|
||||
|
||||
GameDemo({ UINode child, Object key })
|
||||
GameDemo({ Widget child, Object key })
|
||||
: super(child: child, key: key);
|
||||
|
||||
GameDemoBox get root { return super.root; }
|
||||
GameDemoBox createNode() => new GameDemoBox(new GameDemoWorld(_loader));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,15 +4,12 @@
|
||||
|
||||
import 'dart:math' as math;
|
||||
import 'dart:sky' as sky;
|
||||
import 'package:sky/app/view.dart';
|
||||
import 'package:sky/rendering/box.dart';
|
||||
import 'package:sky/rendering/block.dart';
|
||||
|
||||
AppView app;
|
||||
import 'package:sky/rendering/block.dart';
|
||||
import 'package:sky/rendering/box.dart';
|
||||
import 'package:sky/rendering/sky_binding.dart';
|
||||
|
||||
void main() {
|
||||
|
||||
|
||||
var root = new RenderBlock(children: [
|
||||
new RenderPadding(
|
||||
padding: new EdgeDims.all(10.0),
|
||||
@@ -76,5 +73,5 @@ void main() {
|
||||
)
|
||||
),
|
||||
]);
|
||||
app = new AppView(root: root);
|
||||
new SkyBinding(root: root);
|
||||
}
|
||||
|
||||
@@ -4,14 +4,16 @@
|
||||
|
||||
import 'dart:sky';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:sky/framework/net/image_cache.dart' as image_cache;
|
||||
import 'package:sky/app/view.dart';
|
||||
import 'package:sky/painting/text_style.dart';
|
||||
import 'package:sky/rendering/box.dart';
|
||||
import 'package:sky/rendering/block.dart';
|
||||
import 'package:sky/rendering/box.dart';
|
||||
import 'package:sky/rendering/flex.dart';
|
||||
import 'package:sky/rendering/object.dart';
|
||||
import 'package:sky/rendering/paragraph.dart';
|
||||
import 'package:sky/rendering/sky_binding.dart';
|
||||
|
||||
import '../lib/solid_color_box.dart';
|
||||
|
||||
class Touch {
|
||||
@@ -35,7 +37,6 @@ class RenderImageGrow extends RenderImage {
|
||||
}
|
||||
}
|
||||
|
||||
AppView app;
|
||||
RenderImageGrow image;
|
||||
|
||||
Map<int, Touch> touches = new Map();
|
||||
@@ -95,6 +96,6 @@ Pancetta meatball tongue tenderloin rump tail jowl boudin.""";
|
||||
child: row
|
||||
);
|
||||
|
||||
app = new AppView(root: root);
|
||||
new SkyBinding(root: root);
|
||||
view.setEventCallback(handleEvent);
|
||||
}
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
|
||||
import 'dart:sky';
|
||||
import 'dart:math' as math;
|
||||
import 'package:sky/app/view.dart';
|
||||
import 'package:sky/rendering/box.dart';
|
||||
|
||||
import 'package:sky/rendering/block.dart';
|
||||
import 'package:sky/rendering/box.dart';
|
||||
import 'package:sky/rendering/flex.dart';
|
||||
import 'package:sky/rendering/object.dart';
|
||||
import 'package:sky/rendering/paragraph.dart';
|
||||
import '../lib/solid_color_box.dart';
|
||||
import 'package:sky/rendering/sky_binding.dart';
|
||||
|
||||
AppView app;
|
||||
import '../lib/solid_color_box.dart';
|
||||
|
||||
// Attempts to draw
|
||||
// http://www.w3.org/TR/2015/WD-css-flexbox-1-20150514/images/flex-pack.svg
|
||||
@@ -42,5 +42,5 @@ void main() {
|
||||
child: new RenderPadding(child: table, padding: new EdgeDims.symmetric(vertical: 50.0))
|
||||
);
|
||||
|
||||
app = new AppView(root: root);
|
||||
new SkyBinding(root: root);
|
||||
}
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:sky';
|
||||
import 'package:sky/app/view.dart';
|
||||
|
||||
import 'package:sky/painting/text_style.dart';
|
||||
import 'package:sky/rendering/box.dart';
|
||||
import 'package:sky/rendering/object.dart';
|
||||
import 'package:sky/rendering/flex.dart';
|
||||
import 'package:sky/rendering/object.dart';
|
||||
import 'package:sky/rendering/paragraph.dart';
|
||||
import '../lib/solid_color_box.dart';
|
||||
import 'package:sky/rendering/sky_binding.dart';
|
||||
|
||||
AppView app;
|
||||
import '../lib/solid_color_box.dart';
|
||||
|
||||
void main() {
|
||||
RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical);
|
||||
@@ -42,5 +42,5 @@ Pancetta meatball tongue tenderloin rump tail jowl boudin.""";
|
||||
flexRoot.add(child);
|
||||
child.parentData.flex = 1;
|
||||
|
||||
app = new AppView(root: root);
|
||||
new SkyBinding(root: root);
|
||||
}
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
|
||||
import 'dart:math' as math;
|
||||
import 'dart:sky' as sky;
|
||||
import 'package:sky/app/view.dart';
|
||||
|
||||
import 'package:sky/rendering/box.dart';
|
||||
import 'package:sky/rendering/object.dart';
|
||||
import 'package:sky/rendering/sky_binding.dart';
|
||||
|
||||
const double kTwoPi = 2 * math.PI;
|
||||
|
||||
@@ -522,5 +523,5 @@ RenderBox buildSectorExample() {
|
||||
}
|
||||
|
||||
void main() {
|
||||
new AppView(root: buildSectorExample());
|
||||
new SkyBinding(root: buildSectorExample());
|
||||
}
|
||||
|
||||
@@ -3,14 +3,13 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:sky';
|
||||
import 'package:sky/app/view.dart';
|
||||
|
||||
import 'package:sky/rendering/box.dart';
|
||||
import 'package:sky/rendering/flex.dart';
|
||||
import 'package:sky/rendering/sky_binding.dart';
|
||||
import 'package:sky/theme2/colors.dart';
|
||||
import 'package:sky/theme2/shadows.dart';
|
||||
|
||||
AppView app;
|
||||
|
||||
void main() {
|
||||
var coloredBox = new RenderDecoratedBox(
|
||||
decoration: new BoxDecoration(
|
||||
@@ -22,7 +21,7 @@ void main() {
|
||||
var paddedBox = new RenderPadding(
|
||||
padding: const EdgeDims.all(50.0),
|
||||
child: coloredBox);
|
||||
app = new AppView(root: new RenderDecoratedBox(
|
||||
new SkyBinding(root: new RenderDecoratedBox(
|
||||
decoration: const BoxDecoration(
|
||||
backgroundColor: const Color(0xFFFFFFFF)
|
||||
),
|
||||
|
||||
@@ -6,14 +6,13 @@ import 'dart:sky' as sky;
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:sky/app/scheduler.dart';
|
||||
import 'package:sky/app/view.dart';
|
||||
import 'package:sky/rendering/box.dart';
|
||||
import 'package:sky/rendering/flex.dart';
|
||||
import 'package:sky/rendering/sky_binding.dart';
|
||||
import 'package:vector_math/vector_math.dart';
|
||||
|
||||
import '../lib/solid_color_box.dart';
|
||||
|
||||
AppView app;
|
||||
double timeBase;
|
||||
RenderTransform transformBox;
|
||||
|
||||
@@ -34,7 +33,7 @@ void main() {
|
||||
|
||||
RenderPadding root = new RenderPadding(padding: new EdgeDims.all(20.0), child: transformBox);
|
||||
|
||||
app = new AppView(root: root);
|
||||
new SkyBinding(root: root);
|
||||
|
||||
addPersistentFrameCallback(rotate);
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
import 'dart:math';
|
||||
import 'dart:sky';
|
||||
|
||||
import 'package:sky/app/view.dart';
|
||||
import 'package:sky/rendering/box.dart';
|
||||
import 'package:sky/rendering/object.dart';
|
||||
import 'package:sky/rendering/paragraph.dart';
|
||||
import 'package:sky/rendering/sky_binding.dart';
|
||||
import 'package:sky/rendering/stack.dart';
|
||||
import 'package:sky/theme2/colors.dart';
|
||||
|
||||
@@ -77,8 +77,6 @@ class RenderTouchDemo extends RenderBox {
|
||||
}
|
||||
}
|
||||
|
||||
AppView app;
|
||||
|
||||
void main() {
|
||||
var paragraph = new RenderParagraph(new InlineText("Touch me!"));
|
||||
var stack = new RenderStack(children: [
|
||||
@@ -89,5 +87,5 @@ void main() {
|
||||
// that it doesn't eat events.
|
||||
paragraph.parentData..top = 40.0
|
||||
..left = 20.0;
|
||||
app = new AppView(root: stack);
|
||||
new SkyBinding(root: stack);
|
||||
}
|
||||
|
||||
@@ -3,12 +3,11 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:sky' as sky;
|
||||
import 'package:sky/app/view.dart';
|
||||
import 'package:sky/rendering/flex.dart';
|
||||
import 'package:sky/rendering/box.dart';
|
||||
import 'package:vector_math/vector_math.dart';
|
||||
|
||||
AppView app;
|
||||
import 'package:sky/rendering/box.dart';
|
||||
import 'package:sky/rendering/flex.dart';
|
||||
import 'package:sky/rendering/sky_binding.dart';
|
||||
import 'package:vector_math/vector_math.dart';
|
||||
|
||||
void main() {
|
||||
RenderDecoratedBox green = new RenderDecoratedBox(
|
||||
@@ -26,5 +25,5 @@ void main() {
|
||||
|
||||
RenderFlex flex = new RenderFlex();
|
||||
flex.add(spin);
|
||||
app = new AppView(root: flex);
|
||||
new SkyBinding(root: flex);
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ class StocksApp extends App {
|
||||
void main() {
|
||||
print("starting stocks app!");
|
||||
runApp(new StocksApp());
|
||||
WidgetAppView.appView.onFrame = () {
|
||||
WidgetSkyBinding.skyBinding.onFrame = () {
|
||||
// uncomment this for debugging:
|
||||
// WidgetAppView.appView.debugDumpRenderTree();
|
||||
// WidgetSkyBinding.skyBinding.debugDumpRenderTree();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:sky/widgets/basic.dart';
|
||||
|
||||
class HelloWorldApp extends App {
|
||||
Widget build() {
|
||||
return new Text('Hello, fn2!');
|
||||
return new Text('Hello, widgets!');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -136,8 +136,8 @@ class SectorApp extends App {
|
||||
|
||||
void main() {
|
||||
runApp(new SectorApp());
|
||||
WidgetAppView.appView.onFrame = () {
|
||||
WidgetSkyBinding.skyBinding.onFrame = () {
|
||||
// uncomment this for debugging:
|
||||
// WidgetAppView.appView.debugDumpRenderTree();
|
||||
// WidgetSkyBinding.skyBinding.debugDumpRenderTree();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -75,12 +75,12 @@ void rotate(double timeStamp) {
|
||||
|
||||
void main() {
|
||||
// Because we're going to use Widgets, we want to initialise its
|
||||
// AppView, not use the default one. We don't really need to do
|
||||
// SkyBinding, not use the default one. We don't really need to do
|
||||
// this, because RenderBoxToWidgetAdapter does it for us, but
|
||||
// it's good practice in case we happen to not have a
|
||||
// RenderBoxToWidgetAdapter in our tree at startup, or in case we
|
||||
// want a renderViewOverride.
|
||||
WidgetAppView.initWidgetAppView();
|
||||
WidgetSkyBinding.initWidgetSkyBinding();
|
||||
|
||||
RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical);
|
||||
|
||||
@@ -94,6 +94,6 @@ void main() {
|
||||
transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity());
|
||||
RenderPadding root = new RenderPadding(padding: new EdgeDims.all(20.0), child: transformBox);
|
||||
|
||||
WidgetAppView.appView.root = root;
|
||||
WidgetSkyBinding.skyBinding.root = root;
|
||||
addPersistentFrameCallback(rotate);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user