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