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 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 import 'dart:mirrors'; | 7 import 'dart:mirrors'; |
8 import 'dart:sky' as sky; | 8 import 'dart:sky' as sky; |
9 | 9 |
10 import '../base/hit_test.dart'; | 10 import '../base/hit_test.dart'; |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 } | 216 } |
217 | 217 |
218 class ParentDataNode extends TagNode { | 218 class ParentDataNode extends TagNode { |
219 ParentDataNode(Widget child, this.parentData, { String key }) | 219 ParentDataNode(Widget child, this.parentData, { String key }) |
220 : super(child, key: key); | 220 : super(child, key: key); |
221 final ParentData parentData; | 221 final ParentData parentData; |
222 } | 222 } |
223 | 223 |
224 abstract class _Heir implements Widget { | 224 abstract class _Heir implements Widget { |
225 Map<Type, Inherited> _traits; | 225 Map<Type, Inherited> _traits; |
226 Inherited inheritedOfType(Type type) => _traits[type]; | 226 Inherited inheritedOfType(Type type) => _traits == null ? null : _traits[type]
; |
227 | 227 |
228 static _Heir _getHeirAncestor(Widget widget) { | 228 static _Heir _getHeirAncestor(Widget widget) { |
229 Widget ancestor = widget; | 229 Widget ancestor = widget; |
230 while (ancestor != null && !(ancestor is _Heir)) { | 230 while (ancestor != null && !(ancestor is _Heir)) { |
231 ancestor = ancestor.parent; | 231 ancestor = ancestor.parent; |
232 } | 232 } |
233 return ancestor as _Heir; | 233 return ancestor as _Heir; |
234 } | 234 } |
235 | 235 |
236 void _updateTraitsFromParent(Widget parent) { | 236 void _updateTraitsFromParent(Widget parent) { |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
999 if (root.parent == null) { | 999 if (root.parent == null) { |
1000 // we haven't attached it yet | 1000 // we haven't attached it yet |
1001 assert(_container.child == null); | 1001 assert(_container.child == null); |
1002 _container.child = root; | 1002 _container.child = root; |
1003 } | 1003 } |
1004 assert(root.parent == _container); | 1004 assert(root.parent == _container); |
1005 } | 1005 } |
1006 | 1006 |
1007 Widget build() => builder(); | 1007 Widget build() => builder(); |
1008 } | 1008 } |
OLD | NEW |