OLD | NEW |
(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 'basic.dart'; |
| 6 import 'material.dart'; |
| 7 |
| 8 class Dialog extends Component { |
| 9 Dialog({ |
| 10 String key, |
| 11 this.title, |
| 12 this.content, |
| 13 this.actions, |
| 14 this.onDismiss |
| 15 }) : super(key: key); |
| 16 |
| 17 final Widget title; |
| 18 final Widget content; |
| 19 final Widget actions; |
| 20 final Function onDismiss; |
| 21 |
| 22 Widget build() { |
| 23 Container mask = new Container( |
| 24 decoration: const BoxDecoration( |
| 25 backgroundColor: const Color(0x7F000000))); |
| 26 |
| 27 List<Widget> children = new List<Widget>(); |
| 28 |
| 29 if (title != null) |
| 30 children.add(title); |
| 31 |
| 32 if (content != null) |
| 33 children.add(content); |
| 34 |
| 35 if (actions != null) |
| 36 children.add(content); |
| 37 |
| 38 return new Stack([ |
| 39 new EventListenerNode(mask, onGestureTap: (_) => onDismiss()), |
| 40 new Center( |
| 41 child: new ConstrainedBox( |
| 42 constraints: new BoxConstraints(minWidth: 280.0), |
| 43 child: new Material( |
| 44 level: 4, |
| 45 child: new ShrinkWrapWidth( |
| 46 child: new Block(children) |
| 47 ) |
| 48 ) |
| 49 ) |
| 50 ) |
| 51 ]); |
| 52 } |
| 53 } |
OLD | NEW |