Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(636)

Unified Diff: sky/examples/stocks-fn/stocksapp.dart

Issue 998803002: Make the search box in the stocks app show a search field (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/examples/stocks-fn/stocks.sky ('k') | sky/framework/components/input.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/stocks-fn/stocksapp.dart
diff --git a/sky/examples/stocks-fn/stocksapp.dart b/sky/examples/stocks-fn/stocksapp.dart
index c52556774927d0f4270ef5b1f315c155a0e8ab7e..72f4be7900c25fd77b68424d77bee6405f92e248 100644
--- a/sky/examples/stocks-fn/stocksapp.dart
+++ b/sky/examples/stocks-fn/stocksapp.dart
@@ -6,6 +6,7 @@ import '../../framework/components/drawer_header.dart';
import '../../framework/components/fixed_height_scrollable.dart';
import '../../framework/components/floating_action_button.dart';
import '../../framework/components/icon.dart';
+import '../../framework/components/input.dart';
import '../../framework/components/material.dart';
import '../../framework/components/menu_divider.dart';
import '../../framework/components/menu_item.dart';
@@ -40,12 +41,19 @@ class StocksApp extends App {
);
List<Stock> _sortedStocks;
+ bool _isSearching = false;
StocksApp() : super() {
_sortedStocks = oracle.stocks;
_sortedStocks.sort((a, b) => a.symbol.compareTo(b.symbol));
}
+ void _handleSearchClick(_) {
+ setState(() {
+ _isSearching = !_isSearching;
+ });
+ }
+
Node build() {
var drawer = new Drawer(
animation: _drawerAnimation,
@@ -78,6 +86,9 @@ class StocksApp extends App {
]
);
+ Node title = _isSearching ?
+ new Input(focused: true) : new Text('I am a stocks app');
+
var toolbar = new Toolbar(
children: [
new Icon(key: 'menu', style: _iconStyle,
@@ -86,11 +97,12 @@ class StocksApp extends App {
..events.listen('click', _drawerAnimation.toggle),
new Container(
style: _titleStyle,
- children: [new Text('I am a stocks app')]
+ children: [title]
),
new Icon(key: 'search', style: _iconStyle,
size: 24,
- type: 'action/search_white'),
+ type: 'action/search_white')
+ ..events.listen('click', _handleSearchClick),
new Icon(key: 'more_white', style: _iconStyle,
size: 24,
type: 'navigation/more_vert_white')
« no previous file with comments | « sky/examples/stocks-fn/stocks.sky ('k') | sky/framework/components/input.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698