OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 import '../theme2/edges.dart'; | |
6 import '../theme2/colors.dart'; | |
7 import 'button_base.dart'; | |
8 import 'ink_well.dart'; | |
9 import 'material.dart'; | |
10 import 'basic.dart'; | |
11 | |
12 enum RaisedButtonTheme { light, dark } | |
13 | |
14 class RaisedButton extends ButtonBase { | |
15 | |
16 RaisedButton({ Object key, this.child, this.onPressed, this.theme: RaisedButto
nTheme.light }) : super(key: key); | |
17 | |
18 UINode child; | |
19 int level; | |
20 Function onPressed; | |
21 RaisedButtonTheme theme; | |
22 | |
23 void syncFields(RaisedButton source) { | |
24 child = source.child; | |
25 level = source.level; | |
26 onPressed = source.onPressed; | |
27 super.syncFields(source); | |
28 } | |
29 | |
30 UINode buildContent() { | |
31 return new EventListenerNode( | |
32 new Container( | |
33 height: 36.0, | |
34 constraints: new BoxConstraints(minWidth: 88.0), | |
35 margin: new EdgeDims.all(4.0), | |
36 child: new Material( | |
37 edge: MaterialEdge.card, | |
38 child: new InkWell( | |
39 child: new Container( | |
40 padding: new EdgeDims.symmetric(horizontal: 8.0), | |
41 child: new Center(child: child) | |
42 ) | |
43 ), | |
44 level: highlight ? 2 : 1, | |
45 color: theme == RaisedButtonTheme.light | |
46 ? (highlight ? Grey[350] : Grey[300]) | |
47 : (highlight ? Blue[700] : Blue[600]) | |
48 ) | |
49 ), | |
50 onGestureTap: (_) { if (onPressed != null) onPressed(); } | |
51 ); | |
52 } | |
53 | |
54 } | |
OLD | NEW |