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

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

Issue 1217293003: Remove Material's opinion about background colours, since in fact the background colour varies dram… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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/material.dart ('k') | sky/tests/widgets/buttons-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/widgets/scrollable.dart
diff --git a/sky/sdk/lib/widgets/scrollable.dart b/sky/sdk/lib/widgets/scrollable.dart
index 7ff0ad78e185edf5b7e41abc82fbfb95d47bef35..3e9c924880dcf2d0fc2b32bff14f0f0d83cafe67 100644
--- a/sky/sdk/lib/widgets/scrollable.dart
+++ b/sky/sdk/lib/widgets/scrollable.dart
@@ -8,9 +8,12 @@ import 'dart:sky' as sky;
import '../animation/generators.dart';
import '../animation/mechanics.dart';
import '../animation/scroll_behavior.dart';
+import '../theme/colors.dart' as colors;
+import '../theme/theme_data.dart';
import '../theme/view_configuration.dart' as config;
import 'basic.dart';
import 'material.dart';
+import 'theme.dart';
const double _kMillisecondsPerSecond = 1000.0;
@@ -34,6 +37,17 @@ abstract class Scrollable extends Component {
backgroundColor = source.backgroundColor;
}
+ Color get _nonNullBackgroundColor {
+ if (backgroundColor != null)
+ return backgroundColor;
+ switch (Theme.of(this).brightness) {
+ case ThemeBrightness.light:
+ return colors.Grey[50];
+ case ThemeBrightness.dark:
+ return colors.Grey[850];
+ }
+ }
+
double _scrollOffset = 0.0;
double get scrollOffset => _scrollOffset;
@@ -54,7 +68,7 @@ abstract class Scrollable extends Component {
child: new Material(
child: buildContent(),
edge: MaterialEdge.canvas,
- color: backgroundColor
+ color: _nonNullBackgroundColor
),
onPointerDown: _handlePointerDown,
onPointerUp: _handlePointerUpOrCancel,
« no previous file with comments | « sky/sdk/lib/widgets/material.dart ('k') | sky/tests/widgets/buttons-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698