Hixie 003083a12d Remove one more use of mirrors: Components now have to explicitly sync their fields.
This also removes one bit of magic to make it more obvious what on is
going on during a sync, which should hopefully help.

Components have to decide if they support being stateful or not. If
they do, then they must implement syncFields() and have mutable
fields; if they don't, then they must have final fields. This isn't
particularly enforced, though.

This also renames _willSync() to _retainStatefulNodeIfPossible(), for
clarity, and fixes some minor style issues and one typo that was
breaking the drawer.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1174023003
2015-06-10 10:33:04 -07:00

34 lines
731 B
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 '../fn2.dart';
import 'ink_well.dart';
import 'material.dart';
class Button extends Component {
Button({ Object key, this.content, this.level }) : super(key: key);
static final Style _style = new Style('''
-webkit-user-select: none;
height: 36px;
min-width: 64px;
padding: 0 8px;
margin: 4px;
border-radius: 2px;'''
);
final UINode content;
final int level;
UINode build() {
return new StyleNode(
new Material(
content: new InkWell(children: [content]),
level: level),
_style);
}
}