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

Side by Side Diff: sky/examples/stocks2/lib/stock_settings.dart

Issue 1188993003: Use semantic names for callbacks instead of onGestureTap (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 unified diff | Download patch
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/theme2/colors.dart' as colors; 5 import 'package:sky/theme2/colors.dart' as colors;
6 import 'package:sky/theme2/typography.dart' as typography; 6 import 'package:sky/theme2/typography.dart' as typography;
7 import 'package:sky/widgets/basic.dart'; 7 import 'package:sky/widgets/basic.dart';
8 import 'package:sky/widgets/checkbox.dart'; 8 import 'package:sky/widgets/checkbox.dart';
9 import 'package:sky/widgets/icon_button.dart'; 9 import 'package:sky/widgets/icon_button.dart';
10 import 'package:sky/widgets/menu_item.dart'; 10 import 'package:sky/widgets/menu_item.dart';
(...skipping 11 matching lines...) Expand all
22 void _handleAwesomeChanged(bool value) { 22 void _handleAwesomeChanged(bool value) {
23 setState(() { 23 setState(() {
24 _awesome = value; 24 _awesome = value;
25 }); 25 });
26 } 26 }
27 27
28 Widget buildToolBar() { 28 Widget buildToolBar() {
29 return new ToolBar( 29 return new ToolBar(
30 left: new IconButton( 30 left: new IconButton(
31 icon: 'navigation/arrow_back_white', 31 icon: 'navigation/arrow_back_white',
32 onGestureTap: (_) => _navigator.pop()), 32 onPressed: _navigator.pop),
33 center: new Text('Settings', style: typography.white.title), 33 center: new Text('Settings', style: typography.white.title),
34 backgroundColor: colors.Purple[500] 34 backgroundColor: colors.Purple[500]
35 ); 35 );
36 } 36 }
37 37
38 Widget buildSettingsPane() { 38 Widget buildSettingsPane() {
39 return new Container( 39 return new Container(
40 padding: const EdgeDims.symmetric(vertical: 20.0), 40 padding: const EdgeDims.symmetric(vertical: 20.0),
41 decoration: new BoxDecoration(backgroundColor: colors.Grey[50]), 41 decoration: new BoxDecoration(backgroundColor: colors.Grey[50]),
42 child: new Block([ 42 child: new Block([
43 new MenuItem( 43 new MenuItem(
44 key: 'Optimistic Setting', 44 key: 'Optimistic Setting',
45 icon: 'action/thumb_up', 45 icon: 'action/thumb_up',
46 onGestureTap: (event) => _handleAwesomeChanged(!_awesome), 46 onPressed: () => _handleAwesomeChanged(!_awesome),
47 children: [ 47 children: [
48 new Flexible(child: new Text('Everything is awesome')), 48 new Flexible(child: new Text('Everything is awesome')),
49 new Checkbox(key: 'awesome', value: _awesome, onChanged: _handleAwes omeChanged) 49 new Checkbox(key: 'awesome', value: _awesome, onChanged: _handleAwes omeChanged)
50 ] 50 ]
51 ), 51 ),
52 ]) 52 ])
53 ); 53 );
54 } 54 }
55 55
56 Widget build() { 56 Widget build() {
57 return new Scaffold( 57 return new Scaffold(
58 toolbar: buildToolBar(), 58 toolbar: buildToolBar(),
59 body: buildSettingsPane() 59 body: buildSettingsPane()
60 ); 60 );
61 } 61 }
62 } 62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698