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 'package:sky/theme/theme_data.dart'; |
| 6 import 'basic.dart'; |
| 7 import 'widget.dart'; |
| 8 |
| 9 class Theme extends Inherited { |
| 10 |
| 11 Theme({ |
| 12 String key, |
| 13 this.data, |
| 14 Widget child |
| 15 }) : super(key: key, child: child) { |
| 16 assert(child != null); |
| 17 assert(data != null); |
| 18 } |
| 19 |
| 20 final ThemeData data; |
| 21 |
| 22 static ThemeData of(Component component) { |
| 23 Theme theme = component.inheritedOfType(Theme); |
| 24 // If you hit this assert, you need to wrap your Component in a Theme |
| 25 assert(theme != null); |
| 26 return theme.data; |
| 27 } |
| 28 } |
OLD | NEW |