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

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

Issue 1225153003: Fix crash when toggling "Everything is awesome" in Stock's Settings. (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 | « no previous file | no next file » | 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 8b6311931f89afcf987ffa87798471ccd5cb6ae8..9cd6a97ea11ba9b9be7edb9c27852460b5f859b4 100644
--- a/sky/sdk/lib/widgets/material.dart
+++ b/sky/sdk/lib/widgets/material.dart
@@ -34,7 +34,7 @@ class Material extends AnimatedComponent {
if (level == null) level = 0;
_container = new AnimatedContainer()
..shadow = new AnimatedType<double>(level.toDouble())
- ..backgroundColor = new AnimatedColor(_getBackgroundColor(type, color))
+ ..backgroundColor = _getBackgroundColor(type, color)
..borderRadius = edges[type]
..shape = type == MaterialType.circle ? Shape.circle : Shape.rectangle;
watchPerformance(_container.createPerformance(
@@ -53,17 +53,14 @@ class Material extends AnimatedComponent {
super.syncFields(source);
}
- Color _getBackgroundColor(MaterialType type, Color color) {
- if (color != null)
- return color;
- switch (type) {
- case MaterialType.canvas:
- return Theme.of(this).canvasColor;
- case MaterialType.card:
- return Theme.of(this).cardColor;
- default:
- return null;
+ AnimatedColor _getBackgroundColor(MaterialType type, Color color) {
+ if (color == null) {
+ switch (type) {
+ case MaterialType.canvas: color = Theme.of(this).canvasColor; break;
+ case MaterialType.card: color = Theme.of(this).cardColor; break;
+ }
}
+ return color == null ? null : new AnimatedColor(color);
}
Widget build() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698