| 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 'package:sky/painting/text_style.dart'; |
| 6 import 'basic.dart'; | 6 import 'package:sky/widgets/basic.dart'; |
| 7 import 'widget.dart'; | 7 import 'package:sky/widgets/widget.dart'; |
| 8 | 8 |
| 9 class DefaultTextStyle extends Inherited { | 9 class DefaultTextStyle extends Inherited { |
| 10 | 10 |
| 11 DefaultTextStyle({ | 11 DefaultTextStyle({ |
| 12 String key, | 12 String key, |
| 13 this.style, | 13 this.style, |
| 14 Widget child | 14 Widget child |
| 15 }) : super(key: key, child: child) { | 15 }) : super(key: key, child: child) { |
| 16 assert(style != null); | 16 assert(style != null); |
| 17 assert(child != null); | 17 assert(child != null); |
| 18 } | 18 } |
| 19 | 19 |
| 20 final TextStyle style; | 20 final TextStyle style; |
| 21 | 21 |
| 22 static TextStyle of(Component component) { | 22 static TextStyle of(Component component) { |
| 23 DefaultTextStyle result = component.inheritedOfType(DefaultTextStyle); | 23 DefaultTextStyle result = component.inheritedOfType(DefaultTextStyle); |
| 24 return result == null ? null : result.style; | 24 return result == null ? null : result.style; |
| 25 } | 25 } |
| 26 | 26 |
| 27 bool syncShouldNotify(DefaultTextStyle old) => style != old.style; | 27 bool syncShouldNotify(DefaultTextStyle old) => style != old.style; |
| 28 | 28 |
| 29 } | 29 } |
| OLD | NEW |