Commit bce16609 authored by Hans Muller's avatar Hans Muller

complete

parent 78e18a5d
...@@ -538,6 +538,7 @@ class FutureImage extends StatefulComponent { ...@@ -538,6 +538,7 @@ class FutureImage extends StatefulComponent {
image = source.image; image = source.image;
width = source.width; width = source.width;
height = source.height; height = source.height;
colorFilter = source.colorFilter;
if (needToResolveImage) if (needToResolveImage)
_resolveImage(); _resolveImage();
} }
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:sky' as sky;
import 'package:newton/newton.dart'; import 'package:newton/newton.dart';
import 'package:sky/animation/animation_performance.dart'; import 'package:sky/animation/animation_performance.dart';
...@@ -311,22 +312,29 @@ class Tab extends Component { ...@@ -311,22 +312,29 @@ class Tab extends Component {
Tab({ Tab({
Key key, Key key,
this.label, this.label,
this.selected: false this.color,
this.selected: false,
this.selectedColor
}) : super(key: key) { }) : super(key: key) {
assert(label.text != null || label.icon != null); assert(label.text != null || label.icon != null);
} }
final TabLabel label; final TabLabel label;
final Color color;
final bool selected; final bool selected;
final Color selectedColor;
Widget _buildLabelText() { Widget _buildLabelText() {
assert(label.text != null); assert(label.text != null);
return new Text(label.text); TextStyle style = new TextStyle(color: selected ? selectedColor : color);
return new Text(label.text, style: style);
} }
Widget _buildLabelIcon() { Widget _buildLabelIcon() {
assert(label.icon != null); assert(label.icon != null);
return new Icon(type: label.icon, size: _kTabIconSize); Color iconColor = selected ? selectedColor : color;
sky.ColorFilter filter = new sky.ColorFilter.mode(iconColor, sky.TransferMode.srcATop);
return new Icon(type: label.icon, size: _kTabIconSize, colorFilter: filter);
} }
Widget build() { Widget build() {
...@@ -350,13 +358,8 @@ class Tab extends Component { ...@@ -350,13 +358,8 @@ class Tab extends Component {
); );
} }
Widget highlightedLabel = new Opacity(
child: labelContents,
opacity: selected ? 1.0 : 0.7
);
Container centeredLabel = new Container( Container centeredLabel = new Container(
child: new Center(child: highlightedLabel), child: new Center(child: labelContents),
constraints: new BoxConstraints(minWidth: _kMinTabWidth), constraints: new BoxConstraints(minWidth: _kMinTabWidth),
padding: _kTabLabelPadding padding: _kTabLabelPadding
); );
...@@ -489,11 +492,13 @@ class TabBar extends Scrollable { ...@@ -489,11 +492,13 @@ class TabBar extends Scrollable {
return EventDisposition.ignored; return EventDisposition.ignored;
} }
Widget _toTab(TabLabel label, int tabIndex) { Widget _toTab(TabLabel label, int tabIndex, Color color, Color selectedColor) {
return new Listener( return new Listener(
child: new Tab( child: new Tab(
label: label, label: label,
selected: tabIndex == selectedIndex color: color,
selected: tabIndex == selectedIndex,
selectedColor: selectedColor
), ),
onGestureTap: (_) => _handleTap(tabIndex) onGestureTap: (_) => _handleTap(tabIndex)
); );
...@@ -510,14 +515,6 @@ class TabBar extends Scrollable { ...@@ -510,14 +515,6 @@ class TabBar extends Scrollable {
Widget buildContent() { Widget buildContent() {
assert(labels != null && labels.isNotEmpty); assert(labels != null && labels.isNotEmpty);
List<Widget> tabs = <Widget>[];
bool textAndIcons = false;
int tabIndex = 0;
for (TabLabel label in labels) {
tabs.add(_toTab(label, tabIndex++));
if (label.text != null && label.icon != null)
textAndIcons = true;
}
ThemeData themeData = Theme.of(this); ThemeData themeData = Theme.of(this);
Color backgroundColor = themeData.primaryColor; Color backgroundColor = themeData.primaryColor;
...@@ -539,6 +536,15 @@ class TabBar extends Scrollable { ...@@ -539,6 +536,15 @@ class TabBar extends Scrollable {
break; break;
} }
List<Widget> tabs = <Widget>[];
bool textAndIcons = false;
int tabIndex = 0;
for (TabLabel label in labels) {
tabs.add(_toTab(label, tabIndex++, textStyle.color, indicatorColor));
if (label.text != null && label.icon != null)
textAndIcons = true;
}
Matrix4 transform = new Matrix4.identity(); Matrix4 transform = new Matrix4.identity();
transform.translate(-scrollOffset, 0.0); transform.translate(-scrollOffset, 0.0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment