Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(906)

Side by Side Diff: sky/sdk/lib/widgets/tabs.dart

Issue 1209233002: Let's hide double.INFINITY a bit more, by providing cleaner APIs for the cases where we're currentl… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/sdk/lib/widgets/scaffold.dart ('k') | sky/tests/widgets/syncs1.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « sky/sdk/lib/widgets/scaffold.dart ('k') | sky/tests/widgets/syncs1.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698