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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 super.syncFields(source); | 42 super.syncFields(source); |
43 } | 43 } |
44 | 44 |
45 TextStyle get textStyle { | 45 TextStyle get textStyle { |
46 TextStyle result = Theme.of(this).text.body2; | 46 TextStyle result = Theme.of(this).text.body2; |
47 if (highlight) | 47 if (highlight) |
48 result = result.copyWith(color: Theme.of(this).primaryColor); | 48 result = result.copyWith(color: Theme.of(this).primaryColor); |
49 return result; | 49 return result; |
50 } | 50 } |
51 | 51 |
52 String get iconSuffix { | |
53 switch(Theme.of(this).brightness) { | |
54 case ThemeBrightness.dark: | |
55 return "white"; | |
56 case ThemeBrightness.light: | |
57 return "black"; | |
58 } | |
59 } | |
60 | |
61 Widget buildContent() { | 52 Widget buildContent() { |
62 List<Widget> flexChildren = new List<Widget>(); | 53 List<Widget> flexChildren = new List<Widget>(); |
63 if (icon != null) { | 54 if (icon != null) { |
64 flexChildren.add( | 55 flexChildren.add( |
65 new Opacity( | 56 new Opacity( |
66 opacity: selected ? 1.0 : 0.45, | 57 opacity: selected ? 1.0 : 0.45, |
67 child: new Padding( | 58 child: new Padding( |
68 padding: const EdgeDims.symmetric(horizontal: 16.0), | 59 padding: const EdgeDims.symmetric(horizontal: 16.0), |
69 child: new Icon(type: "${icon}_${iconSuffix}", size: 24) | 60 child: new Icon(type: icon, size: 24) |
70 ) | 61 ) |
71 ) | 62 ) |
72 ); | 63 ); |
73 } | 64 } |
74 flexChildren.add( | 65 flexChildren.add( |
75 new Flexible( | 66 new Flexible( |
76 child: new Padding( | 67 child: new Padding( |
77 padding: const EdgeDims.symmetric(horizontal: 16.0), | 68 padding: const EdgeDims.symmetric(horizontal: 16.0), |
78 child: new DefaultTextStyle( | 69 child: new DefaultTextStyle( |
79 style: textStyle, | 70 style: textStyle, |
(...skipping 13 matching lines...) Expand all Loading... |
93 child: new Container( | 84 child: new Container( |
94 decoration: highlight ? _kHighlightDecoration : _kHighlightBoring, | 85 decoration: highlight ? _kHighlightDecoration : _kHighlightBoring, |
95 child: new InkWell( | 86 child: new InkWell( |
96 child: new Flex(flexChildren) | 87 child: new Flex(flexChildren) |
97 ) | 88 ) |
98 ) | 89 ) |
99 ) | 90 ) |
100 ); | 91 ); |
101 } | 92 } |
102 } | 93 } |
OLD | NEW |