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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « sky/sdk/lib/widgets/scaffold.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 import '../painting/text_style.dart';
6 import '../theme/typography.dart' as typography;
7 import 'basic.dart';
8 import 'default_text_style.dart';
9 import 'material.dart';
10 import 'theme.dart';
11
12 class SnackBarAction extends Component {
13 SnackBarAction({String key, this.label, this.onPressed }) : super(key: key) {
14 assert(label != null);
15 }
16
17 final String label;
18 final Function onPressed;
19
20 Widget build() {
21 return new Listener(
22 onGestureTap: (_) => onPressed(),
23 child: new Container(
24 margin: const EdgeDims.only(left: 24.0),
25 padding: const EdgeDims.only(top: 14.0, bottom: 14.0),
26 child: new Text(label)
27 )
28 );
29 }
30 }
31
32 class SnackBar extends Component {
33
34 SnackBar({
35 String key,
36 this.content,
37 this.actions
38 }) : super(key: key) {
39 assert(content != null);
40 }
41
42 final Widget content;
43 final List<SnackBarAction> actions;
44
45 Widget build() {
46 List<Widget> children = [
47 new Flexible(
48 child: new Container(
49 margin: const EdgeDims.symmetric(vertical: 14.0),
50 child: new DefaultTextStyle(
51 style: typography.white.subhead,
52 child: content
53 )
54 )
55 )
56 ]..addAll(actions);
57 return new Material(
58 level: 2,
59 color: const Color(0xFF323232),
60 type: MaterialType.canvas,
61 child: new Container(
62 margin: const EdgeDims.symmetric(horizontal: 24.0),
63 child: new DefaultTextStyle(
64 style: new TextStyle(color: Theme.of(this).accentColor),
65 child: new Flex(children)
66 )
67 )
68 );
69 }
70 }
OLDNEW
« 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