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

Side by Side Diff: sky/sdk/lib/widgets/raised_button.dart

Issue 1190793002: Rename UINode to Widget. (Closed) Base URL: https://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
« no previous file with comments | « sky/sdk/lib/widgets/radio.dart ('k') | sky/sdk/lib/widgets/scaffold.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 '../theme2/colors.dart'; 5 import '../theme2/colors.dart';
6 import '../theme2/edges.dart'; 6 import '../theme2/edges.dart';
7 import 'basic.dart'; 7 import 'basic.dart';
8 import 'button_base.dart'; 8 import 'button_base.dart';
9 import 'ink_well.dart'; 9 import 'ink_well.dart';
10 import 'material.dart'; 10 import 'material.dart';
11 11
12 enum RaisedButtonTheme { light, dark } 12 enum RaisedButtonTheme { light, dark }
13 13
14 class RaisedButton extends ButtonBase { 14 class RaisedButton extends ButtonBase {
15 15
16 RaisedButton({ 16 RaisedButton({
17 String key, 17 String key,
18 this.child, 18 this.child,
19 this.enabled: true, 19 this.enabled: true,
20 this.onPressed, 20 this.onPressed,
21 this.theme: RaisedButtonTheme.light 21 this.theme: RaisedButtonTheme.light
22 }) : super(key: key); 22 }) : super(key: key);
23 23
24 UINode child; 24 Widget child;
25 bool enabled; 25 bool enabled;
26 Function onPressed; 26 Function onPressed;
27 RaisedButtonTheme theme; 27 RaisedButtonTheme theme;
28 28
29 void syncFields(RaisedButton source) { 29 void syncFields(RaisedButton source) {
30 child = source.child; 30 child = source.child;
31 enabled = source.enabled; 31 enabled = source.enabled;
32 onPressed = source.onPressed; 32 onPressed = source.onPressed;
33 theme = source.theme; 33 theme = source.theme;
34 super.syncFields(source); 34 super.syncFields(source);
35 } 35 }
36 36
37 UINode buildContent() { 37 Widget buildContent() {
38 UINode contents = new Container( 38 Widget contents = new Container(
39 padding: new EdgeDims.symmetric(horizontal: 8.0), 39 padding: new EdgeDims.symmetric(horizontal: 8.0),
40 child: new Center(child: child) // TODO(ianh): figure out a way to compell the child to have gray text when disabled... 40 child: new Center(child: child) // TODO(ianh): figure out a way to compell the child to have gray text when disabled...
41 ); 41 );
42 Color color; 42 Color color;
43 if (enabled) { 43 if (enabled) {
44 switch (theme) { 44 switch (theme) {
45 case RaisedButtonTheme.light: 45 case RaisedButtonTheme.light:
46 if (highlight) 46 if (highlight)
47 color = Grey[350]; 47 color = Grey[350];
48 else 48 else
(...skipping 19 matching lines...) Expand all
68 child: enabled ? new InkWell(child: contents) : contents, 68 child: enabled ? new InkWell(child: contents) : contents,
69 level: enabled ? (highlight ? 2 : 1) : 0, 69 level: enabled ? (highlight ? 2 : 1) : 0,
70 color: color 70 color: color
71 ) 71 )
72 ), 72 ),
73 onGestureTap: (_) { if (onPressed != null && enabled) onPressed(); } 73 onGestureTap: (_) { if (onPressed != null && enabled) onPressed(); }
74 ); 74 );
75 } 75 }
76 76
77 } 77 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/widgets/radio.dart ('k') | sky/sdk/lib/widgets/scaffold.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698