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

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

Issue 1192773004: Teach Sky buttons and dialogs how to use the new Theme system (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: rebase Created 5 years, 6 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/flat_button.dart ('k') | sky/sdk/lib/widgets/material_button.dart » ('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 73b52cb66f8372c9efd909ff6fa42a766af5cf7b..864cf1a6af204ac7dd1dba5c20582b17a2492a37 100644
--- a/sky/sdk/lib/widgets/material.dart
+++ b/sky/sdk/lib/widgets/material.dart
@@ -3,6 +3,7 @@
// found in the LICENSE file.
import '../painting/box_painter.dart';
+import '../theme/colors.dart' as colors;
import '../theme/edges.dart';
import '../theme/shadows.dart';
import 'basic.dart';
@@ -24,6 +25,17 @@ class Material extends Component {
final MaterialEdge edge;
final Color color;
+ Color get backgroundColor {
+ if (color != null)
+ return color;
+ switch (Theme.of(this).brightness) {
+ case ThemeBrightness.light:
+ return colors.Grey[50];
+ case ThemeBrightness.dark:
+ return colors.Grey[850];
+ }
+ }
+
// TODO(ianh): we should make this animate level changes and color changes
Widget build() {
@@ -31,7 +43,7 @@ class Material extends Component {
decoration: new BoxDecoration(
boxShadow: shadows[level],
borderRadius: edges[edge],
- backgroundColor: color == null ? Theme.of(this).backgroundColor : color,
+ backgroundColor: backgroundColor,
shape: edge == MaterialEdge.circle ? Shape.circle : Shape.rectangle
),
child: new DefaultTextStyle(style: Theme.of(this).text.body1, child: child)
« no previous file with comments | « sky/sdk/lib/widgets/flat_button.dart ('k') | sky/sdk/lib/widgets/material_button.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698