From ac0d5e31a6b7e0af9ca87ab1ac7cee1ea387ca9b Mon Sep 17 00:00:00 2001 From: Hixie Date: Wed, 27 May 2015 13:36:01 -0700 Subject: [PATCH] [Effen] port fn and stock to RenderNode, part 1 of many This gets things off the ground barely enough to show some pixels. These are not pixels that are actually part of the stock app, but it's a start. R=abarth@chromium.org Review URL: https://codereview.chromium.org/1157033006 --- examples/stocks2/lib/stock_app.dart | 79 +++++++++++++++------------- examples/stocks2/lib/stock_data.dart | 2 +- 2 files changed, 42 insertions(+), 39 deletions(-) diff --git a/examples/stocks2/lib/stock_app.dart b/examples/stocks2/lib/stock_app.dart index 3855af940f..00e4004598 100644 --- a/examples/stocks2/lib/stock_app.dart +++ b/examples/stocks2/lib/stock_app.dart @@ -14,7 +14,7 @@ // import 'package:sky/framework/components2/modal_overlay.dart'; // import 'package:sky/framework/components2/popup_menu.dart'; // import 'package:sky/framework/components2/radio.dart'; -// import 'package:sky/framework/components2/scaffold.dart'; +import 'package:sky/framework/components2/scaffold.dart'; import 'package:sky/framework/fn2.dart'; import 'package:sky/framework/theme/typography.dart' as typography; import 'package:sky/framework/theme/colors.dart'; @@ -161,39 +161,40 @@ class StocksApp extends App { // ); // } - // UINode buildToolBar() { - // return new StyleNode( - // new ToolBar( - // left: new IconButton( - // icon: 'navigation/menu_white', - // onGestureTap: _drawerController.toggle), - // center: new Container( - // style: _titleStyle, - // children: [new Text('Stocks')]), - // right: [ - // new IconButton( - // icon: 'action/search_white', - // onGestureTap: _handleSearchBegin), - // new IconButton( - // icon: 'navigation/more_vert_white', - // onGestureTap: _handleMenuShow) - // ]), - // _toolBarStyle); - // } + UINode buildToolBar() { + return new Rectangle(0xFF00FF00); + // return new StyleNode( + // new ToolBar( + // left: new IconButton( + // icon: 'navigation/menu_white', + // onGestureTap: _drawerController.toggle), + // center: new Container( + // style: _titleStyle, + // children: [new Text('Stocks')]), + // right: [ + // new IconButton( + // icon: 'action/search_white', + // onGestureTap: _handleSearchBegin), + // new IconButton( + // icon: 'navigation/more_vert_white', + // onGestureTap: _handleMenuShow) + // ]), + // _toolBarStyle); + } - // // TODO(abarth): Should we factor this into a SearchBar in the framework? - // UINode buildSearchBar() { - // return new StyleNode( - // new ToolBar( - // left: new IconButton( - // icon: 'navigation/arrow_back_grey600', - // onGestureTap: _handleSearchEnd), - // center: new Input( - // focused: true, - // placeholder: 'Search stocks', - // onChanged: _handleSearchQueryChanged)), - // _searchBarStyle); - // } + // TODO(abarth): Should we factor this into a SearchBar in the framework? + UINode buildSearchBar() { + // return new StyleNode( + // new ToolBar( + // left: new IconButton( + // icon: 'navigation/arrow_back_grey600', + // onGestureTap: _handleSearchEnd), + // center: new Input( + // focused: true, + // placeholder: 'Search stocks', + // onChanged: _handleSearchQueryChanged)), + // _searchBarStyle); + } // void addMenuToOverlays(List overlays) { // if (_menuController == null) @@ -211,17 +212,19 @@ class StocksApp extends App { // List overlays = []; // addMenuToOverlays(overlays); - // return new Scaffold( - // header: _isSearching ? buildSearchBar() : buildToolBar(), - // content: new Stocklist(stocks: _stocks, query: _searchQuery), - // fab: new FloatingActionButton( + return new Scaffold( + toolbar: _isSearching ? buildSearchBar() : buildToolBar() + // , + // body: new Stocklist(stocks: _stocks, query: _searchQuery), + // floatingActionButton: new FloatingActionButton( // content: new Icon(type: 'content/add_white', size: 24), level: 3), // drawer: _drawerShowing ? buildDrawer() : null, // overlays: overlays - // ); + ); } } void main() { + print("starting stocks app!"); new StocksApp(); } diff --git a/examples/stocks2/lib/stock_data.dart b/examples/stocks2/lib/stock_data.dart index 9bca149d20..316b8711b3 100644 --- a/examples/stocks2/lib/stock_data.dart +++ b/examples/stocks2/lib/stock_data.dart @@ -55,7 +55,7 @@ class StockDataFetcher { final StockDataCallback callback; StockDataFetcher(this.callback) { - _fetchNextChunk(); + // _fetchNextChunk(); // TODO(ianh): crashes } void _fetchNextChunk() {