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

Side by Side Diff: sky/sdk/lib/widgets/dialog.dart

Issue 1201273002: Add a confirmation dialog to stock app Settings page and style it by default (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: remove unused import 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
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 '../theme/colors.dart' as colors;
6 import 'basic.dart'; 6 import 'basic.dart';
7 import 'default_text_style.dart';
7 import 'material.dart'; 8 import 'material.dart';
8 import "theme.dart"; 9 import "theme.dart";
9 10
10 class Dialog extends Component { 11 class Dialog extends Component {
11 Dialog({ 12 Dialog({
12 String key, 13 String key,
13 this.title, 14 this.title,
14 this.content, 15 this.content,
15 this.actions, 16 this.actions,
16 this.onDismiss 17 this.onDismiss
(...skipping 13 matching lines...) Expand all
30 } 31 }
31 } 32 }
32 33
33 Widget build() { 34 Widget build() {
34 Container mask = new Container( 35 Container mask = new Container(
35 decoration: const BoxDecoration( 36 decoration: const BoxDecoration(
36 backgroundColor: const Color(0x7F000000))); 37 backgroundColor: const Color(0x7F000000)));
37 38
38 List<Widget> children = new List<Widget>(); 39 List<Widget> children = new List<Widget>();
39 40
40 if (title != null) 41 if (title != null) {
41 children.add(title); 42 children.add(new Padding(
43 padding: new EdgeDims(24.0, 24.0, content == null ? 20.0 : 0.0, 24.0),
44 child: new DefaultTextStyle(
45 style: Theme.of(this).text.title,
46 child: title
47 )
48 ));
49 }
42 50
43 if (content != null) 51 if (content != null) {
44 children.add(content); 52 children.add(new Padding(
53 padding: const EdgeDims(20.0, 24.0, 24.0, 24.0),
54 child: new DefaultTextStyle(
55 style: Theme.of(this).text.subhead,
56 child: content
57 )
58 ));
59 }
45 60
46 if (actions != null) 61 if (actions != null)
47 children.add(actions); 62 children.add(actions);
48 63
49 return new Stack([ 64 return new Stack([
50 new Listener( 65 new Listener(
51 child: mask, 66 child: mask,
52 onGestureTap: (_) => onDismiss() 67 onGestureTap: (_) => onDismiss()
53 ), 68 ),
54 new Center( 69 new Center(
55 child: new ConstrainedBox( 70 child: new Container(
56 constraints: new BoxConstraints(minWidth: 280.0), 71 margin: new EdgeDims.symmetric(horizontal: 40.0, vertical: 24.0),
57 child: new Material( 72 child: new ConstrainedBox(
58 level: 4, 73 constraints: new BoxConstraints(minWidth: 280.0),
59 color: color, 74 child: new Material(
60 child: new ShrinkWrapWidth( 75 level: 4,
61 child: new Block(children) 76 color: color,
77 child: new ShrinkWrapWidth(
78 child: new Block(children)
79 )
62 ) 80 )
63 ) 81 )
64 ) 82 )
65 ) 83 )
66 ]); 84 ]);
67 } 85 }
68 } 86 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698