Commit 547c324d authored by Hixie's avatar Hixie

fn3 review

- adds dartdocs
- replaces config setter with didUpdateConfig() so that you can't replace
the config outside of the system
- renames didUnmount() with destroy().
- rename Component to StatelessComponent, ComponentConfiguration to
StatefulComponent
- move debug dump to end of file
- renamed _holder to _element
parent d27f3d52
This diff is collapsed.
......@@ -4,7 +4,7 @@ import 'package:test/test.dart';
import 'widget_tester.dart';
class TestComponentConfig extends ComponentConfiguration {
class TestComponentConfig extends StatefulComponent {
TestComponentConfig({ this.left, this.right });
final Widget left;
......@@ -13,9 +13,7 @@ class TestComponentConfig extends ComponentConfiguration {
TestComponentState createState() => new TestComponentState();
}
class TestComponentState extends ComponentState {
TestComponentConfig get config => super.config;
class TestComponentState extends ComponentState<TestComponentConfig> {
bool _showLeft = true;
void flip() {
......@@ -32,7 +30,7 @@ class TestComponentState extends ComponentState {
final BoxDecoration kBoxDecorationA = new BoxDecoration();
final BoxDecoration kBoxDecorationB = new BoxDecoration();
class TestBuildCounter extends Component {
class TestBuildCounter extends StatelessComponent {
static int buildCount = 0;
Widget build() {
......@@ -42,8 +40,8 @@ class TestBuildCounter extends Component {
}
void flipStatefulComponent(WidgetTester tester) {
ComponentStateElement stateElement =
tester.findElement((element) => element is ComponentStateElement);
StatefulComponentElement stateElement =
tester.findElement((element) => element is StatefulComponentElement);
(stateElement.state as TestComponentState).flip();
}
......
import 'package:sky/src/fn3/framework.dart';
class TestComponent extends Component {
class TestComponent extends StatelessComponent {
TestComponent({ this.child });
final Widget child;
Widget build() => child;
......@@ -9,7 +9,7 @@ class TestComponent extends Component {
final Object _rootSlot = new Object();
class WidgetTester {
ComponentElement _rootElement;
StatelessComponentElement _rootElement;
void walkElements(ElementVisitor visitor) {
void walk(Element element) {
......@@ -36,7 +36,7 @@ class WidgetTester {
void pumpFrame(Widget widget) {
if (_rootElement == null) {
_rootElement = new ComponentElement(new TestComponent(child: widget));
_rootElement = new StatelessComponentElement(new TestComponent(child: widget));
_rootElement.mount(_rootSlot);
} else {
_rootElement.update(new TestComponent(child: widget));
......
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