| OLD | NEW |
| 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 '../theme/colors.dart' as colors; | 5 import '../theme/colors.dart' as colors; |
| 6 import 'basic.dart'; | 6 import 'basic.dart'; |
| 7 import 'material_button.dart'; | 7 import 'material_button.dart'; |
| 8 import 'theme.dart'; | 8 import 'theme.dart'; |
| 9 | 9 |
| 10 class RaisedButton extends MaterialButton { | 10 class RaisedButton extends MaterialButton { |
| 11 | 11 |
| 12 RaisedButton({ | 12 RaisedButton({ |
| 13 String key, | 13 String key, |
| 14 Widget child, | 14 Widget child, |
| 15 bool enabled: true, | 15 bool enabled: true, |
| 16 Function onPressed | 16 Function onPressed |
| 17 }) : super(key: key, | 17 }) : super(key: key, |
| 18 child: child, | 18 child: child, |
| 19 enabled: enabled, | 19 enabled: enabled, |
| 20 onPressed: onPressed); | 20 onPressed: onPressed); |
| 21 | 21 |
| 22 @override |
| 22 Color get color { | 23 Color get color { |
| 23 if (enabled) { | 24 if (enabled) { |
| 24 switch (Theme.of(this).brightness) { | 25 switch (Theme.of(this).brightness) { |
| 25 case ThemeBrightness.light: | 26 case ThemeBrightness.light: |
| 26 if (highlight) | 27 if (highlight) |
| 27 return colors.Grey[350]; | 28 return colors.Grey[350]; |
| 28 else | 29 else |
| 29 return colors.Grey[300]; | 30 return colors.Grey[300]; |
| 30 break; | 31 break; |
| 31 case ThemeBrightness.dark: | 32 case ThemeBrightness.dark: |
| 32 if (highlight) | 33 if (highlight) |
| 33 return Theme.of(this).primarySwatch[700]; | 34 return Theme.of(this).primarySwatch[700]; |
| 34 else | 35 else |
| 35 return Theme.of(this).primarySwatch[600]; | 36 return Theme.of(this).primarySwatch[600]; |
| 36 break; | 37 break; |
| 37 } | 38 } |
| 38 } else { | 39 } else { |
| 39 return colors.Grey[350]; | 40 return colors.Grey[350]; |
| 40 } | 41 } |
| 41 } | 42 } |
| 42 | 43 |
| 44 @override |
| 43 int get level => enabled ? (highlight ? 2 : 1) : 0; | 45 int get level => enabled ? (highlight ? 2 : 1) : 0; |
| 44 } | 46 } |
| OLD | NEW |