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

Unified Diff: sky/sdk/lib/widgets/material.dart

Issue 1224223004: Fix test failures from AnimatedContainer patch. (Closed) Base URL: git@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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/sdk/lib/widgets/animated_container.dart ('k') | sky/tests/examples/sector-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/widgets/material.dart
diff --git a/sky/sdk/lib/widgets/material.dart b/sky/sdk/lib/widgets/material.dart
index e56c59735a8220b0a717de08071e83717f586374..dab12135fd89ca5175502f44c6ba566a4c920ea2 100644
--- a/sky/sdk/lib/widgets/material.dart
+++ b/sky/sdk/lib/widgets/material.dart
@@ -29,14 +29,16 @@ class Material extends AnimatedComponent {
Material({
String key,
this.child,
- this.type: MaterialType.card,
+ MaterialType type: MaterialType.card,
int level: 0,
Color color: null
}) : super(key: key) {
if (level == null) level = 0;
_container = new AnimatedContainer()
..shadow = new AnimatedType<double>(level.toDouble())
- ..backgroundColor = new AnimatedColor(_getBackgroundColor(color));
+ ..backgroundColor = new AnimatedColor(_getBackgroundColor(type, color))
Matt Perry 2015/07/09 19:17:21 One thing I'm worried about here: do we create a n
abarth-chromium 2015/07/09 19:19:00 We create a new widget.
+ ..borderRadius = edges[type]
+ ..shape = type == MaterialType.circle ? Shape.circle : Shape.rectangle;
watch(_container.createPerformance(
_container.shadow, duration: _kAnimateShadowDuration).timeline);
watch(_container.createPerformance(
@@ -44,21 +46,19 @@ class Material extends AnimatedComponent {
}
Widget child;
- MaterialType type;
AnimatedContainer _container;
void syncFields(Material source) {
child = source.child;
- type = source.type;
_container.syncFields(source._container);
super.syncFields(source);
}
- Color _getBackgroundColor(Color color) {
+ Color _getBackgroundColor(MaterialType type, Color color) {
if (color != null)
return color;
- switch(type) {
+ switch (type) {
case MaterialType.canvas:
return Theme.of(this).canvasColor;
case MaterialType.card:
@@ -70,15 +70,8 @@ class Material extends AnimatedComponent {
Widget build() {
return _container.build(
- new Container(
- // TODO(mpcomplete): move the rest of this decoration into
- // AnimatedContainer as non-animated values.
- decoration: new BoxDecoration(
- borderRadius: edges[type],
- shape: type == MaterialType.circle ? Shape.circle : Shape.rectangle
- ),
- child: new DefaultTextStyle(style: Theme.of(this).text.body1, child: child)
- ));
+ new DefaultTextStyle(style: Theme.of(this).text.body1, child: child)
+ );
}
}
« no previous file with comments | « sky/sdk/lib/widgets/animated_container.dart ('k') | sky/tests/examples/sector-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698