Commit 09183a7f authored by Hixie's avatar Hixie

[Effen] Use the checkbox widget in the stocks app.

- add a checkbox to the stock app, so that we're testing the checkbox widget
  (it's not currently wired up to anything, that can come later)
- make InkSplash use FlexContainer so that we can use flex in the popup menu items
- make effen's Text be more similar to Image and Container, so that it can be styled
- make layout.dart's RenderCSSText correctly support being styled
- also fixes a bug with the stock list where we were rendering one too few a row when scrolling
- check in the code to dump the DOM so I don't have to keep remembering how to do this

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1134163003
parent f32b3234
...@@ -21,6 +21,11 @@ import 'stock_data.dart'; ...@@ -21,6 +21,11 @@ import 'stock_data.dart';
import 'stock_list.dart'; import 'stock_list.dart';
import 'stock_menu.dart'; import 'stock_menu.dart';
import 'dart:async';
import 'package:sky/framework/layout.dart';
const bool debug = false; // set to true to dump the DOM for debugging purposes
class StocksApp extends App { class StocksApp extends App {
DrawerController _drawerController = new DrawerController(); DrawerController _drawerController = new DrawerController();
PopupMenuController _menuController; PopupMenuController _menuController;
...@@ -39,6 +44,8 @@ class StocksApp extends App { ...@@ -39,6 +44,8 @@ class StocksApp extends App {
String _searchQuery; String _searchQuery;
StocksApp() : super() { StocksApp() : super() {
if (debug)
new Timer(new Duration(seconds: 1), dumpState);
new StockDataFetcher((StockData data) { new StockDataFetcher((StockData data) {
setState(() { setState(() {
data.appendTo(_stocks); data.appendTo(_stocks);
......
...@@ -2,8 +2,10 @@ ...@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/framework/components/popup_menu.dart';
import 'package:sky/framework/fn.dart'; import 'package:sky/framework/fn.dart';
import 'package:sky/framework/layout.dart';
import 'package:sky/framework/components/popup_menu.dart';
import 'package:sky/framework/components/checkbox.dart';
import 'package:sky/framework/theme/view_configuration.dart'; import 'package:sky/framework/theme/view_configuration.dart';
class StockMenu extends Component { class StockMenu extends Component {
...@@ -14,16 +16,26 @@ class StockMenu extends Component { ...@@ -14,16 +16,26 @@ class StockMenu extends Component {
PopupMenuController controller; PopupMenuController controller;
StockMenu({Object key, this.controller}) : super(key: key); StockMenu({Object key, this.controller, this.autorefresh: false, this.onAutorefreshChanged}) : super(key: key);
final bool autorefresh;
final ValueChanged onAutorefreshChanged;
static FlexBoxParentData _flex1 = new FlexBoxParentData()..flex = 1;
UINode build() { UINode build() {
var checkbox = new Checkbox(
checked: this.autorefresh,
onChanged: this.onAutorefreshChanged
);
return new StyleNode( return new StyleNode(
new PopupMenu( new PopupMenu(
controller: controller, controller: controller,
items: [ items: [
[new Text('Add stock')], [new Text('Add stock')],
[new Text('Remove stock')], [new Text('Remove stock')],
[new Text('Help & feedback')], [new ParentDataNode(new Text('Autorefresh'), _flex1), checkbox],
], ],
level: 4), level: 4),
_style _style
......
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