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

Unified Diff: sky/examples/stocks2/lib/stock_settings.dart

Issue 1191863002: Add settings page to Sky’s stocks example app (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: abarth cr feedback Created 5 years, 6 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/stocks2/lib/stock_home.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/stocks2/lib/stock_settings.dart
diff --git a/sky/examples/stocks2/lib/stock_settings.dart b/sky/examples/stocks2/lib/stock_settings.dart
new file mode 100644
index 0000000000000000000000000000000000000000..11b1c1012a0ccc7849e37330b272c518ad8d2f5d
--- /dev/null
+++ b/sky/examples/stocks2/lib/stock_settings.dart
@@ -0,0 +1,66 @@
+// 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 'dart:sky' as sky;
+
+import 'package:sky/theme2/colors.dart' as colors;
+import 'package:sky/theme2/typography.dart' as typography;
+import 'package:sky/widgets/basic.dart';
+import 'package:sky/widgets/checkbox.dart';
+import 'package:sky/widgets/icon_button.dart';
+import 'package:sky/widgets/menu_divider.dart';
+import 'package:sky/widgets/menu_item.dart';
+import 'package:sky/widgets/navigator.dart';
+import 'package:sky/widgets/raised_button.dart';
+import 'package:sky/widgets/scaffold.dart';
+import 'package:sky/widgets/tool_bar.dart';
+
+class StockSettings extends Component {
+
+ StockSettings(this._navigator);
+
+ Navigator _navigator;
+
+ bool _awesome = false;
+ void _handleAwesomeChanged(bool value) {
+ setState(() {
+ _awesome = value;
+ });
+ }
+
+ Widget buildToolBar() {
+ return new ToolBar(
+ left: new IconButton(
+ icon: 'navigation/arrow_back_white',
+ onGestureTap: (_) => _navigator.pop()),
+ center: new Text('Settings', style: typography.white.title),
+ backgroundColor: colors.Purple[500]
+ );
+ }
+
+ Widget buildSettingsPane() {
+ return new Container(
+ padding: const EdgeDims.symmetric(vertical: 20.0),
+ decoration: new BoxDecoration(backgroundColor: colors.Grey[50]),
+ child: new Block([
+ new MenuItem(
+ key: 'Optimistic Setting',
+ icon: 'action/thumb_up',
+ onGestureTap: (event) => _handleAwesomeChanged(!_awesome),
+ children: [
+ new Flexible(child: new Text('Everything is awesome')),
+ new Checkbox(key: 'awesome', value: _awesome, onChanged: _handleAwesomeChanged)
+ ]
+ ),
+ ])
+ );
+ }
+
+ Widget build() {
+ return new Scaffold(
+ toolbar: buildToolBar(),
+ body: buildSettingsPane()
+ );
+ }
+}
« no previous file with comments | « sky/examples/stocks2/lib/stock_home.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698