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 'package:sky/theme/theme_data.dart'; | 5 import '../theme/theme_data.dart'; |
6 import 'basic.dart'; | 6 import 'basic.dart'; |
7 import 'widget.dart'; | 7 import 'widget.dart'; |
8 | 8 |
| 9 export '../theme/theme_data.dart' show ThemeBrightness; |
| 10 |
9 class Theme extends Inherited { | 11 class Theme extends Inherited { |
10 | 12 |
11 Theme({ | 13 Theme({ |
12 String key, | 14 String key, |
13 this.data, | 15 this.data, |
14 Widget child | 16 Widget child |
15 }) : super(key: key, child: child) { | 17 }) : super(key: key, child: child) { |
16 assert(child != null); | 18 assert(child != null); |
17 assert(data != null); | 19 assert(data != null); |
18 } | 20 } |
19 | 21 |
20 final ThemeData data; | 22 final ThemeData data; |
21 | 23 |
22 static ThemeData _kFallbackTheme = new ThemeData.fallback(); | 24 static final ThemeData _kFallbackTheme = new ThemeData.fallback(); |
23 | 25 |
24 static ThemeData of(Component component) { | 26 static ThemeData of(Component component) { |
25 Theme theme = component.inheritedOfType(Theme); | 27 Theme theme = component.inheritedOfType(Theme); |
26 return theme == null ? _kFallbackTheme : theme.data; | 28 return theme == null ? _kFallbackTheme : theme.data; |
27 } | 29 } |
28 } | 30 } |
OLD | NEW |