| 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 '../painting/text_style.dart'; | 5 import '../painting/text_style.dart'; |
| 6 import 'basic.dart'; | 6 import 'basic.dart'; |
| 7 import 'button_base.dart'; | 7 import 'button_base.dart'; |
| 8 import 'default_text_style.dart'; | 8 import 'default_text_style.dart'; |
| 9 import 'icon.dart'; | 9 import 'icon.dart'; |
| 10 import 'ink_well.dart'; | 10 import 'ink_well.dart'; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 super.syncFields(source); | 40 super.syncFields(source); |
| 41 } | 41 } |
| 42 | 42 |
| 43 TextStyle get textStyle { | 43 TextStyle get textStyle { |
| 44 TextStyle result = Theme.of(this).text.body2; | 44 TextStyle result = Theme.of(this).text.body2; |
| 45 if (highlight) | 45 if (highlight) |
| 46 result = result.copyWith(color: Theme.of(this).primaryColor); | 46 result = result.copyWith(color: Theme.of(this).primaryColor); |
| 47 return result; | 47 return result; |
| 48 } | 48 } |
| 49 | 49 |
| 50 String get iconSuffix { |
| 51 switch(Theme.of(this).brightness) { |
| 52 case ThemeBrightness.dark: |
| 53 return "white"; |
| 54 case ThemeBrightness.light: |
| 55 return "black"; |
| 56 } |
| 57 } |
| 58 |
| 50 Widget buildContent() { | 59 Widget buildContent() { |
| 60 List<Widget> flexChildren = new List<Widget>(); |
| 61 if (icon != null) { |
| 62 flexChildren.add( |
| 63 new Opacity( |
| 64 opacity: highlight ? 1.0 : 0.45, |
| 65 child: new Padding( |
| 66 padding: const EdgeDims.symmetric(horizontal: 16.0), |
| 67 child: new Icon(type: "${icon}_${iconSuffix}", size: 24) |
| 68 ) |
| 69 ) |
| 70 ); |
| 71 } |
| 72 flexChildren.add( |
| 73 new Flexible( |
| 74 child: new Padding( |
| 75 padding: const EdgeDims.symmetric(horizontal: 16.0), |
| 76 child: new DefaultTextStyle( |
| 77 style: textStyle, |
| 78 child: new Flex(children, direction: FlexDirection.horizontal) |
| 79 ) |
| 80 ) |
| 81 ) |
| 82 ); |
| 51 return new Listener( | 83 return new Listener( |
| 52 onGestureTap: (_) { | 84 onGestureTap: (_) { |
| 53 if (onPressed != null) | 85 if (onPressed != null) |
| 54 onPressed(); | 86 onPressed(); |
| 55 }, | 87 }, |
| 56 child: new Container( | 88 child: new Container( |
| 57 height: 48.0, | 89 height: 48.0, |
| 58 decoration: highlight ? _kHighlightDecoration : _kHighlightBoring, | 90 decoration: highlight ? _kHighlightDecoration : _kHighlightBoring, |
| 59 child: new InkWell( | 91 child: new InkWell( |
| 60 child: new Flex([ | 92 child: new Flex(flexChildren) |
| 61 new Padding( | |
| 62 padding: const EdgeDims.symmetric(horizontal: 16.0), | |
| 63 child: new Icon(type: "${icon}_grey600", size: 24) | |
| 64 ), | |
| 65 new Flexible( | |
| 66 child: new Padding( | |
| 67 padding: const EdgeDims.symmetric(horizontal: 16.0), | |
| 68 child: new DefaultTextStyle( | |
| 69 style: textStyle, | |
| 70 child: new Flex(children, direction: FlexDirection.horizontal) | |
| 71 ) | |
| 72 ) | |
| 73 ) | |
| 74 ]) | |
| 75 ) | 93 ) |
| 76 ) | 94 ) |
| 77 ); | 95 ); |
| 78 } | 96 } |
| 79 } | 97 } |
| OLD | NEW |