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

Side by Side Diff: sky/sdk/lib/widgets/dialog.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, 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/theme/theme_data.dart ('k') | sky/sdk/lib/widgets/flat_button.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import '../theme/colors.dart' as colors;
5 import 'basic.dart'; 6 import 'basic.dart';
6 import 'material.dart'; 7 import 'material.dart';
8 import "theme.dart";
7 9
8 class Dialog extends Component { 10 class Dialog extends Component {
9 Dialog({ 11 Dialog({
10 String key, 12 String key,
11 this.title, 13 this.title,
12 this.content, 14 this.content,
13 this.actions, 15 this.actions,
14 this.onDismiss 16 this.onDismiss
15 }) : super(key: key); 17 }) : super(key: key);
16 18
17 final Widget title; 19 final Widget title;
18 final Widget content; 20 final Widget content;
19 final Widget actions; 21 final Widget actions;
20 final Function onDismiss; 22 final Function onDismiss;
21 23
24 Color get color {
25 switch (Theme.of(this).brightness) {
26 case ThemeBrightness.light:
27 return colors.White;
28 case ThemeBrightness.dark:
29 return colors.Grey[800];
30 }
31 }
32
22 Widget build() { 33 Widget build() {
23 Container mask = new Container( 34 Container mask = new Container(
24 decoration: const BoxDecoration( 35 decoration: const BoxDecoration(
25 backgroundColor: const Color(0x7F000000))); 36 backgroundColor: const Color(0x7F000000)));
26 37
27 List<Widget> children = new List<Widget>(); 38 List<Widget> children = new List<Widget>();
28 39
29 if (title != null) 40 if (title != null)
30 children.add(title); 41 children.add(title);
31 42
32 if (content != null) 43 if (content != null)
33 children.add(content); 44 children.add(content);
34 45
35 if (actions != null) 46 if (actions != null)
36 children.add(actions); 47 children.add(actions);
37 48
38 return new Stack([ 49 return new Stack([
39 new Listener( 50 new Listener(
40 child: mask, 51 child: mask,
41 onGestureTap: (_) => onDismiss() 52 onGestureTap: (_) => onDismiss()
42 ), 53 ),
43 new Center( 54 new Center(
44 child: new ConstrainedBox( 55 child: new ConstrainedBox(
45 constraints: new BoxConstraints(minWidth: 280.0), 56 constraints: new BoxConstraints(minWidth: 280.0),
46 child: new Material( 57 child: new Material(
47 level: 4, 58 level: 4,
59 color: color,
48 child: new ShrinkWrapWidth( 60 child: new ShrinkWrapWidth(
49 child: new Block(children) 61 child: new Block(children)
50 ) 62 )
51 ) 63 )
52 ) 64 )
53 ) 65 )
54 ]); 66 ]);
55 } 67 }
56 } 68 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/theme/theme_data.dart ('k') | sky/sdk/lib/widgets/flat_button.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698