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 | 6 |
7 import 'package:sky/rendering/box.dart'; | 7 import 'package:sky/rendering/box.dart'; |
8 import 'package:sky/rendering/object.dart'; | 8 import 'package:sky/rendering/object.dart'; |
9 import 'package:sky/widgets/basic.dart'; | 9 import 'package:sky/widgets/basic.dart'; |
10 import 'package:sky/widgets/icon.dart'; | 10 import 'package:sky/widgets/icon.dart'; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 child.parentData.position = new Point(x, 0.0); | 124 child.parentData.position = new Point(x, 0.0); |
125 x += tabWidth; | 125 x += tabWidth; |
126 child = child.parentData.nextSibling; | 126 child = child.parentData.nextSibling; |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 void hitTestChildren(HitTestResult result, { Point position }) { | 130 void hitTestChildren(HitTestResult result, { Point position }) { |
131 defaultHitTestChildren(result, position: position); | 131 defaultHitTestChildren(result, position: position); |
132 } | 132 } |
133 | 133 |
134 void _paintIndicator(RenderCanvas canvas, RenderBox selectedTab, Offset offset
) { | 134 void _paintIndicator(PaintingCanvas canvas, RenderBox selectedTab, Offset offs
et) { |
135 if (indicatorColor == null) | 135 if (indicatorColor == null) |
136 return; | 136 return; |
137 | 137 |
138 var size = new Size(selectedTab.size.width, _kTabIndicatorHeight); | 138 var size = new Size(selectedTab.size.width, _kTabIndicatorHeight); |
139 var point = new Point( | 139 var point = new Point( |
140 selectedTab.parentData.position.x, | 140 selectedTab.parentData.position.x, |
141 _tabBarHeight - _kTabIndicatorHeight | 141 _tabBarHeight - _kTabIndicatorHeight |
142 ); | 142 ); |
143 Rect rect = (point + offset) & size; | 143 Rect rect = (point + offset) & size; |
144 canvas.drawRect(rect, new Paint()..color = indicatorColor); | 144 canvas.drawRect(rect, new Paint()..color = indicatorColor); |
145 } | 145 } |
146 | 146 |
147 void paint(RenderCanvas canvas, Offset offset) { | 147 void paint(PaintingCanvas canvas, Offset offset) { |
148 if (backgroundColor != null) { | 148 if (backgroundColor != null) { |
149 Rect rect = offset & size; | 149 Rect rect = offset & size; |
150 canvas.drawRect(rect, new Paint()..color = backgroundColor); | 150 canvas.drawRect(rect, new Paint()..color = backgroundColor); |
151 } | 151 } |
152 | 152 |
153 int index = 0; | 153 int index = 0; |
154 RenderBox child = firstChild; | 154 RenderBox child = firstChild; |
155 while (child != null) { | 155 while (child != null) { |
156 assert(child.parentData is TabBarParentData); | 156 assert(child.parentData is TabBarParentData); |
157 canvas.paintChild(child, child.parentData.position + offset); | 157 canvas.paintChild(child, child.parentData.position + offset); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 onChanged: _handleSelectedIndexChanged, | 342 onChanged: _handleSelectedIndexChanged, |
343 selectedIndex: selectedIndex | 343 selectedIndex: selectedIndex |
344 ); | 344 ); |
345 | 345 |
346 Widget content = views[selectedIndex].buildContent(); | 346 Widget content = views[selectedIndex].buildContent(); |
347 return new Flex([tabBar, new Flexible(child: content)], | 347 return new Flex([tabBar, new Flexible(child: content)], |
348 direction: FlexDirection.vertical | 348 direction: FlexDirection.vertical |
349 ); | 349 ); |
350 } | 350 } |
351 } | 351 } |
OLD | NEW |