| Index: sky/sdk/lib/widgets/tabs.dart
|
| diff --git a/sky/sdk/lib/widgets/tabs.dart b/sky/sdk/lib/widgets/tabs.dart
|
| index 5812413fef1f657f97334027da45122fa42ce2e7..0ee96e93571ffadb05c3efd2c9331c6d4db1afe1 100644
|
| --- a/sky/sdk/lib/widgets/tabs.dart
|
| +++ b/sky/sdk/lib/widgets/tabs.dart
|
| @@ -88,11 +88,13 @@ class RenderTabBar extends RenderBox with
|
| }
|
| }
|
|
|
| + @override
|
| void setupParentData(RenderBox child) {
|
| if (child.parentData is! TabBarParentData)
|
| child.parentData = new TabBarParentData();
|
| }
|
|
|
| + @override
|
| double getMinIntrinsicWidth(BoxConstraints constraints) {
|
| BoxConstraints widthConstraints =
|
| new BoxConstraints(maxWidth: constraints.maxWidth, maxHeight: constraints.maxHeight);
|
| @@ -108,6 +110,7 @@ class RenderTabBar extends RenderBox with
|
| return constraints.constrainWidth(width);
|
| }
|
|
|
| + @override
|
| double getMaxIntrinsicWidth(BoxConstraints constraints) {
|
| BoxConstraints widthConstraints =
|
| new BoxConstraints(maxWidth: constraints.maxWidth, maxHeight: constraints.maxHeight);
|
| @@ -129,8 +132,10 @@ class RenderTabBar extends RenderBox with
|
|
|
| double _getIntrinsicHeight(BoxConstraints constraints) => constraints.constrainHeight(_tabBarHeight);
|
|
|
| + @override
|
| double getMinIntrinsicHeight(BoxConstraints constraints) => _getIntrinsicHeight(constraints);
|
|
|
| + @override
|
| double getMaxIntrinsicHeight(BoxConstraints constraints) => _getIntrinsicHeight(constraints);
|
|
|
| void layoutFixedWidthTabs() {
|
| @@ -191,6 +196,7 @@ class RenderTabBar extends RenderBox with
|
| }
|
| }
|
|
|
| + @override
|
| void performLayout() {
|
| assert(constraints is BoxConstraints);
|
|
|
| @@ -209,6 +215,7 @@ class RenderTabBar extends RenderBox with
|
| reportLayoutChangedIfNeeded();
|
| }
|
|
|
| + @override
|
| void hitTestChildren(HitTestResult result, { Point position }) {
|
| defaultHitTestChildren(result, position: position);
|
| }
|
| @@ -226,9 +233,10 @@ class RenderTabBar extends RenderBox with
|
| canvas.drawRect(rect, new Paint()..color = indicatorColor);
|
| }
|
|
|
| + @override
|
| void paint(PaintingCanvas canvas, Offset offset) {
|
| if (backgroundColor != null) {
|
| - double width = layoutWidths != null
|
| + double width = layoutWidths != null
|
| ? layoutWidths.reduce((sum, width) => sum + width)
|
| : size.width;
|
| Rect rect = offset & new Size(width, size.height);
|
| @@ -256,19 +264,23 @@ class TabBarWrapper extends MultiChildRenderObjectWrapper {
|
| this.textAndIcons,
|
| this.scrollable: false,
|
| this.onLayoutChanged,
|
| - String key
|
| + String key
|
| }) : super(key: key, children: children);
|
|
|
| final int selectedIndex;
|
| final Color backgroundColor;
|
| final Color indicatorColor;
|
| - final bool textAndIcons;
|
| + final bool textAndIcons;
|
| final bool scrollable;
|
| final LayoutChanged onLayoutChanged;
|
|
|
| + @override
|
| RenderTabBar get root => super.root;
|
| +
|
| + @override
|
| RenderTabBar createNode() => new RenderTabBar(onLayoutChanged);
|
|
|
| + @override
|
| void syncRenderObject(Widget old) {
|
| super.syncRenderObject(old);
|
| root.selectedIndex = selectedIndex;
|
| @@ -310,6 +322,7 @@ class Tab extends Component {
|
| return new Icon(type: label.icon, size: _kTabIconSize);
|
| }
|
|
|
| + @override
|
| Widget build() {
|
| Widget labelContents;
|
| if (label.icon == null) {
|
| @@ -324,7 +337,7 @@ class Tab extends Component {
|
| margin: const EdgeDims.only(bottom: 10.0)
|
| ),
|
| _buildLabelText()
|
| - ],
|
| + ],
|
| justifyContent: FlexJustifyContent.center,
|
| alignItems: FlexAlignItems.center,
|
| direction: FlexDirection.vertical
|
| @@ -332,7 +345,7 @@ class Tab extends Component {
|
| }
|
|
|
| Widget highlightedLabel = new Opacity(
|
| - child: labelContents,
|
| + child: labelContents,
|
| opacity: selected ? 1.0 : 0.7
|
| );
|
|
|
| @@ -351,6 +364,7 @@ class TabBarScrollBehavior extends ScrollBehavior {
|
|
|
| double maxScrollOffset;
|
|
|
| + @override
|
| Simulation release(Particle particle) {
|
| if (particle.velocity == 0.0 || particle.position < 0.0 || particle.position >= maxScrollOffset)
|
| return null;
|
| @@ -362,6 +376,7 @@ class TabBarScrollBehavior extends ScrollBehavior {
|
| return new Simulation(system, terminationCondition: () => particle.position == 0.0);
|
| }
|
|
|
| + @override
|
| double applyCurve(double scrollOffset, double scrollDelta) {
|
| return (scrollOffset + scrollDelta).clamp(0.0, maxScrollOffset);
|
| }
|
| @@ -381,6 +396,7 @@ class TabBar extends Scrollable {
|
| SelectedIndexChanged onChanged;
|
| bool scrollable;
|
|
|
| + @override
|
| void syncFields(TabBar source) {
|
| super.syncFields(source);
|
| labels = source.labels;
|
| @@ -391,7 +407,10 @@ class TabBar extends Scrollable {
|
| scrollTo(0.0);
|
| }
|
|
|
| + @override
|
| ScrollBehavior createScrollBehavior() => new TabBarScrollBehavior();
|
| +
|
| + @override
|
| TabBarScrollBehavior get scrollBehavior => super.scrollBehavior;
|
|
|
| void _handleTap(int tabIndex) {
|
| @@ -423,6 +442,7 @@ class TabBar extends Scrollable {
|
| });
|
| }
|
|
|
| + @override
|
| Widget buildContent() {
|
| assert(labels != null && labels.isNotEmpty);
|
| List<Widget> tabs = <Widget>[];
|
| @@ -441,7 +461,7 @@ class TabBar extends Scrollable {
|
| }
|
|
|
| TabBarWrapper tabBarWrapper = new TabBarWrapper(
|
| - children: tabs,
|
| + children: tabs,
|
| selectedIndex: selectedIndex,
|
| backgroundColor: backgroundColor,
|
| indicatorColor: indicatorColor,
|
| @@ -489,6 +509,7 @@ class TabNavigator extends Component {
|
| onChanged(tabIndex);
|
| }
|
|
|
| + @override
|
| Widget build() {
|
| assert(views != null && views.isNotEmpty);
|
| assert(selectedIndex >= 0 && selectedIndex < views.length);
|
|
|