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

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

Issue 1216613004: Initial implementation of SnackBar (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: abarth cr feedback 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/scaffold.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/widgets/snack_bar.dart
diff --git a/sky/sdk/lib/widgets/snack_bar.dart b/sky/sdk/lib/widgets/snack_bar.dart
new file mode 100644
index 0000000000000000000000000000000000000000..d1cb54027a63cdcce4c1bb34463079e49e32f4fb
--- /dev/null
+++ b/sky/sdk/lib/widgets/snack_bar.dart
@@ -0,0 +1,70 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import '../painting/text_style.dart';
+import '../theme/typography.dart' as typography;
+import 'basic.dart';
+import 'default_text_style.dart';
+import 'material.dart';
+import 'theme.dart';
+
+class SnackBarAction extends Component {
+ SnackBarAction({String key, this.label, this.onPressed }) : super(key: key) {
+ assert(label != null);
+ }
+
+ final String label;
+ final Function onPressed;
+
+ Widget build() {
+ return new Listener(
+ onGestureTap: (_) => onPressed(),
+ child: new Container(
+ margin: const EdgeDims.only(left: 24.0),
+ padding: const EdgeDims.only(top: 14.0, bottom: 14.0),
+ child: new Text(label)
+ )
+ );
+ }
+}
+
+class SnackBar extends Component {
+
+ SnackBar({
+ String key,
+ this.content,
+ this.actions
+ }) : super(key: key) {
+ assert(content != null);
+ }
+
+ final Widget content;
+ final List<SnackBarAction> actions;
+
+ Widget build() {
+ List<Widget> children = [
+ new Flexible(
+ child: new Container(
+ margin: const EdgeDims.symmetric(vertical: 14.0),
+ child: new DefaultTextStyle(
+ style: typography.white.subhead,
+ child: content
+ )
+ )
+ )
+ ]..addAll(actions);
+ return new Material(
+ level: 2,
+ color: const Color(0xFF323232),
+ type: MaterialType.canvas,
+ child: new Container(
+ margin: const EdgeDims.symmetric(horizontal: 24.0),
+ child: new DefaultTextStyle(
+ style: new TextStyle(color: Theme.of(this).accentColor),
+ child: new Flex(children)
+ )
+ )
+ );
+ }
+}
« no previous file with comments | « sky/sdk/lib/widgets/scaffold.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698