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

Unified Diff: sky/framework/components/material.dart

Issue 983903003: Re-work MaterialComponent (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: rebase Created 5 years, 9 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/framework/components/floating_action_button.dart ('k') | sky/framework/components/menu_item.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/components/material.dart
diff --git a/sky/framework/components/material.dart b/sky/framework/components/material.dart
index 4e8d5f1a3ae8ecdfde3ac03eb394757f88e3755c..81a5158d408da4dc37ca8e704a0d66bdc5455603 100644
--- a/sky/framework/components/material.dart
+++ b/sky/framework/components/material.dart
@@ -7,10 +7,10 @@ import 'dart:sky' as sky;
import 'dart:collection';
import 'ink_splash.dart';
-abstract class Material extends Component {
+class Material extends Component {
static const _splashesKey = const Object();
- static final Style _style = new Style('''
+ static final Style _splashesStyle = new Style('''
transform: translateX(0);
position: absolute;
top: 0;
@@ -21,24 +21,32 @@ abstract class Material extends Component {
LinkedHashSet<SplashAnimation> _splashes;
- Material({ Object key }) : super(key: key) {
+ Style style;
+ List<Node> children;
+
+ Material({ Object key, this.style, this.children }) : super(key: key) {
events.listen('gesturescrollstart', _cancelSplashes);
events.listen('wheel', _cancelSplashes);
events.listen('pointerdown', _startSplash);
}
Node build() {
- List<Node> children = [];
+ List<Node> childrenIncludingSplashes = [];
if (_splashes != null) {
- children.addAll(_splashes.map((s) => new InkSplash(s.onStyleChanged)));
+ childrenIncludingSplashes.add(new Container(
+ style: _splashesStyle,
+ children: new List.from(_splashes.map(
+ (s) => new InkSplash(s.onStyleChanged))),
+ key: 'Splashes'
+ ));
}
- return new Container(
- style: _style,
- children: children,
- key: _splashesKey
- );
+ if (children != null)
+ childrenIncludingSplashes.addAll(children);
+
+ return new Container(key: 'Material', style: style,
+ children: childrenIncludingSplashes);
}
sky.ClientRect _getBoundingRect() => (getRoot() as sky.Element).getBoundingClientRect();
« no previous file with comments | « sky/framework/components/floating_action_button.dart ('k') | sky/framework/components/menu_item.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698