| 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:math' as math; | 5 import 'dart:math' as math; |
| 6 import 'dart:sky' as sky; | 6 import 'dart:sky' as sky; |
| 7 | 7 |
| 8 import 'package:sky/painting/text_style.dart'; | 8 import 'package:sky/painting/text_style.dart'; |
| 9 import 'package:sky/rendering/box.dart'; | 9 import 'package:sky/rendering/box.dart'; |
| 10 import 'package:sky/rendering/object.dart'; | 10 import 'package:sky/rendering/object.dart'; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 assert(child.parentData is TabBarParentData); | 87 assert(child.parentData is TabBarParentData); |
| 88 child = child.parentData.nextSibling; | 88 child = child.parentData.nextSibling; |
| 89 } | 89 } |
| 90 return childCount; | 90 return childCount; |
| 91 } | 91 } |
| 92 | 92 |
| 93 void performLayout() { | 93 void performLayout() { |
| 94 assert(constraints is BoxConstraints); | 94 assert(constraints is BoxConstraints); |
| 95 | 95 |
| 96 size = constraints.constrain(new Size(constraints.maxWidth, _kTabBarHeight))
; | 96 size = constraints.constrain(new Size(constraints.maxWidth, _kTabBarHeight))
; |
| 97 assert(size.width < double.INFINITY); | 97 assert(!size.isInfinite); |
| 98 assert(size.height < double.INFINITY); | |
| 99 | 98 |
| 100 int childCount = _childCount(); | 99 int childCount = _childCount(); |
| 101 if (childCount == 0) | 100 if (childCount == 0) |
| 102 return; | 101 return; |
| 103 | 102 |
| 104 double tabWidth = size.width / childCount; | 103 double tabWidth = size.width / childCount; |
| 105 BoxConstraints tabConstraints = | 104 BoxConstraints tabConstraints = |
| 106 new BoxConstraints.tightFor(width: tabWidth, height: size.height); | 105 new BoxConstraints.tightFor(width: tabWidth, height: size.height); |
| 107 double x = 0.0; | 106 double x = 0.0; |
| 108 RenderBox child = firstChild; | 107 RenderBox child = firstChild; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 assert(labels != null && labels.isNotEmpty); | 252 assert(labels != null && labels.isNotEmpty); |
| 254 List<Widget> tabs = <Widget>[]; | 253 List<Widget> tabs = <Widget>[]; |
| 255 for (int tabIndex = 0; tabIndex < labels.length; tabIndex++) { | 254 for (int tabIndex = 0; tabIndex < labels.length; tabIndex++) { |
| 256 tabs.add(_toTab(labels[tabIndex], tabIndex)); | 255 tabs.add(_toTab(labels[tabIndex], tabIndex)); |
| 257 } | 256 } |
| 258 return new TabBarWrapper(tabs, selectedIndex); | 257 return new TabBarWrapper(tabs, selectedIndex); |
| 259 } | 258 } |
| 260 } | 259 } |
| 261 | 260 |
| 262 | 261 |
| OLD | NEW |