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

Side by Side Diff: sky/sdk/example/stocks/lib/stock_settings.dart

Issue 1218153005: Refactoring to support dark theme better (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix import issues Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « sky/sdk/example/stocks/lib/stock_home.dart ('k') | sky/sdk/example/widgets/sector.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import 'package:sky/theme/colors.dart' as colors;
6 import 'package:sky/widgets/basic.dart'; 5 import 'package:sky/widgets/basic.dart';
7 import 'package:sky/widgets/checkbox.dart'; 6 import 'package:sky/widgets/checkbox.dart';
8 import 'package:sky/widgets/switch.dart'; 7 import 'package:sky/widgets/switch.dart';
9 import 'package:sky/widgets/flat_button.dart'; 8 import 'package:sky/widgets/flat_button.dart';
10 import 'package:sky/widgets/dialog.dart'; 9 import 'package:sky/widgets/dialog.dart';
11 import 'package:sky/widgets/icon_button.dart'; 10 import 'package:sky/widgets/icon_button.dart';
11 import 'package:sky/widgets/material.dart';
12 import 'package:sky/widgets/menu_item.dart'; 12 import 'package:sky/widgets/menu_item.dart';
13 import 'package:sky/widgets/navigator.dart'; 13 import 'package:sky/widgets/navigator.dart';
14 import 'package:sky/widgets/scaffold.dart'; 14 import 'package:sky/widgets/scaffold.dart';
15 import 'package:sky/widgets/tool_bar.dart'; 15 import 'package:sky/widgets/tool_bar.dart';
16 16
17 import 'stock_types.dart'; 17 import 'stock_types.dart';
18 18
19 typedef void SettingsUpdater({ 19 typedef void SettingsUpdater({
20 StockMode optimism, 20 StockMode optimism,
21 BackupMode backup 21 BackupMode backup
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 left: new IconButton( 80 left: new IconButton(
81 icon: 'navigation/arrow_back_white', 81 icon: 'navigation/arrow_back_white',
82 onPressed: navigator.pop), 82 onPressed: navigator.pop),
83 center: new Text('Settings') 83 center: new Text('Settings')
84 ); 84 );
85 } 85 }
86 86
87 Widget buildSettingsPane() { 87 Widget buildSettingsPane() {
88 // TODO(ianh): Once we have the gesture API hooked up, fix https://github.co m/domokit/mojo/issues/281 88 // TODO(ianh): Once we have the gesture API hooked up, fix https://github.co m/domokit/mojo/issues/281
89 // (whereby tapping the widgets below causes both the widget and the menu it em to fire their callbacks) 89 // (whereby tapping the widgets below causes both the widget and the menu it em to fire their callbacks)
90 return new Container( 90 return new Material(
91 padding: const EdgeDims.symmetric(vertical: 20.0), 91 type: MaterialType.canvas,
92 decoration: new BoxDecoration(backgroundColor: colors.Grey[50]), 92 child: new Container(
93 child: new Block([ 93 padding: const EdgeDims.symmetric(vertical: 20.0),
94 new MenuItem( 94 child: new Block([
95 icon: 'action/thumb_up', 95 new MenuItem(
96 onPressed: () => _confirmOptimismChange(), 96 icon: 'action/thumb_up',
97 children: [ 97 onPressed: () => _confirmOptimismChange(),
98 new Flexible(child: new Text('Everything is awesome')), 98 children: [
99 new Checkbox(value: optimism == StockMode.optimistic, onChanged: _ha ndleOptimismChanged) 99 new Flexible(child: new Text('Everything is awesome')),
100 ] 100 new Checkbox(value: optimism == StockMode.optimistic, onChanged: _ handleOptimismChanged)
101 ), 101 ]
102 new MenuItem( 102 ),
103 icon: 'action/backup', 103 new MenuItem(
104 onPressed: () { _handleBackupChanged(!(backup == BackupMode.enabled)); }, 104 icon: 'action/backup',
105 children: [ 105 onPressed: () { _handleBackupChanged(!(backup == BackupMode.enabled) ); },
106 new Flexible(child: new Text('Back up stock list to the cloud')), 106 children: [
107 new Switch(value: backup == BackupMode.enabled, onChanged: _handleBa ckupChanged) 107 new Flexible(child: new Text('Back up stock list to the cloud')),
108 ] 108 new Switch(value: backup == BackupMode.enabled, onChanged: _handle BackupChanged)
109 ), 109 ]
110 ]) 110 ),
111 ])
112 )
111 ); 113 );
112 } 114 }
113 115
114 Widget build() { 116 Widget build() {
115 List<Widget> layers = [ 117 List<Widget> layers = [
116 new Scaffold( 118 new Scaffold(
117 toolbar: buildToolBar(), 119 toolbar: buildToolBar(),
118 body: buildSettingsPane() 120 body: buildSettingsPane()
119 ) 121 )
120 ]; 122 ];
(...skipping 13 matching lines...) Expand all
134 _handleOptimismChanged(true); 136 _handleOptimismChanged(true);
135 navigator.pop(); 137 navigator.pop();
136 } 138 }
137 ), 139 ),
138 ] 140 ]
139 )); 141 ));
140 } 142 }
141 return new Stack(layers); 143 return new Stack(layers);
142 } 144 }
143 } 145 }
OLDNEW
« no previous file with comments | « sky/sdk/example/stocks/lib/stock_home.dart ('k') | sky/sdk/example/widgets/sector.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698