| OLD | NEW |
| 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 'package:mojom/media/media.mojom.dart'; | 5 import 'package:mojom/media/media.mojom.dart'; |
| 6 import 'package:mojom/mojo/url_response.mojom.dart'; | 6 import 'package:mojom/mojo/url_response.mojom.dart'; |
| 7 import 'package:sky/mojo/net/fetch.dart'; | 7 import 'package:sky/mojo/net/fetch.dart'; |
| 8 import 'package:sky/mojo/shell.dart' as shell; | 8 import 'package:sky/mojo/shell.dart' as shell; |
| 9 import 'package:sky/rendering/box.dart'; | 9 import 'package:sky/rendering/box.dart'; |
| 10 import 'package:sky/rendering/flex.dart'; | 10 import 'package:sky/rendering/flex.dart'; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 UrlResponse response = await fetchUrl(key.soundUrl); | 65 UrlResponse response = await fetchUrl(key.soundUrl); |
| 66 await player.ptr.prepare(response.body); | 66 await player.ptr.prepare(response.body); |
| 67 key.player = player; | 67 key.player = player; |
| 68 } | 68 } |
| 69 mediaService.close(); | 69 mediaService.close(); |
| 70 // Are we leaking all the player connections? | 70 // Are we leaking all the player connections? |
| 71 scheduleBuild(); | 71 scheduleBuild(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 @override |
| 74 Widget build() { | 75 Widget build() { |
| 75 List<Widget> children = []; | 76 List<Widget> children = []; |
| 76 for (Key key in keys) { | 77 for (Key key in keys) { |
| 77 children.add( | 78 children.add( |
| 78 new Listener( | 79 new Listener( |
| 79 child: new Flexible( | 80 child: new Flexible( |
| 80 child: new Container( | 81 child: new Container( |
| 81 decoration: new BoxDecoration(backgroundColor: key.color) | 82 decoration: new BoxDecoration(backgroundColor: key.color) |
| 82 ) | 83 ) |
| 83 ), | 84 ), |
| 84 onPointerCancel: (_) => key.up(), | 85 onPointerCancel: (_) => key.up(), |
| 85 onPointerDown: (_) => key.down(), | 86 onPointerDown: (_) => key.down(), |
| 86 onPointerUp: (_) => key.up() | 87 onPointerUp: (_) => key.up() |
| 87 ) | 88 ) |
| 88 ); | 89 ); |
| 89 } | 90 } |
| 90 | 91 |
| 91 return new Flex( | 92 return new Flex( |
| 92 children, | 93 children, |
| 93 direction: FlexDirection.vertical | 94 direction: FlexDirection.vertical |
| 94 ); | 95 ); |
| 95 } | 96 } |
| 96 } | 97 } |
| 97 | 98 |
| 98 void main() { | 99 void main() { |
| 99 runApp(new PianoApp()); | 100 runApp(new PianoApp()); |
| 100 } | 101 } |
| OLD | NEW |