Adam Barth b4ff5ca6ae Prototype of fn3
This patch contains a prototype of a new widget framework. In this framework,
Components can be reused in the tree as many times as the author desires. Also,
StatefulComponent is split into two pieces, a ComponentConfiguration and a
ComponentState. The ComponentConfiguration is created by the author and can be
reused as many times as desired. When mounted into the tree, the
ComponentConfiguration creates a ComponentState to hold the state for the
component. The state remains in the tree and cannot be reused.
2015-09-18 23:17:52 -07:00

58 lines
1.3 KiB
Dart

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:sky/rendering.dart';
import 'package:sky/src/fn3/framework.dart';
export 'package:sky/rendering.dart' show
BackgroundImage,
BlockDirection,
Border,
BorderSide,
BoxConstraints,
BoxDecoration,
BoxDecorationPosition,
BoxShadow,
Color,
EdgeDims,
EventDisposition,
FlexAlignItems,
FlexDirection,
FlexJustifyContent,
Offset,
Paint,
Path,
Point,
Rect,
ScrollDirection,
Shape,
ShrinkWrap,
Size,
ValueChanged;
class DecoratedBox extends OneChildRenderObjectWidget {
DecoratedBox({
Key key,
this.decoration,
this.position: BoxDecorationPosition.background,
Widget child
}) : super(key: key, child: child) {
assert(decoration != null);
assert(position != null);
}
final BoxDecoration decoration;
final BoxDecorationPosition position;
RenderObject createRenderObject() => new RenderDecoratedBox(
decoration: decoration,
position: position
);
void updateRenderObject(RenderDecoratedBox renderObject) {
renderObject.decoration = decoration;
renderObject.position = position;
}
}