| 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 'dart:sky'; | 5 import 'dart:sky'; |
| 6 import 'dart:math' as math; | 6 import 'dart:math' as math; |
| 7 | 7 |
| 8 import 'package:sky/mojo/activity.dart' as activity; |
| 8 import 'package:sky/mojo/net/image_cache.dart' as image_cache; | 9 import 'package:sky/mojo/net/image_cache.dart' as image_cache; |
| 9 import 'package:sky/painting/text_style.dart'; | 10 import 'package:sky/painting/text_style.dart'; |
| 10 import 'package:sky/rendering/box.dart'; | 11 import 'package:sky/rendering/box.dart'; |
| 11 import 'package:sky/rendering/flex.dart'; | 12 import 'package:sky/rendering/flex.dart'; |
| 12 import 'package:sky/rendering/object.dart'; | 13 import 'package:sky/rendering/object.dart'; |
| 13 import 'package:sky/rendering/paragraph.dart'; | 14 import 'package:sky/rendering/paragraph.dart'; |
| 14 import 'package:sky/rendering/sky_binding.dart'; | 15 import 'package:sky/rendering/sky_binding.dart'; |
| 15 | 16 |
| 16 import 'solid_color_box.dart'; | 17 import 'solid_color_box.dart'; |
| 17 | 18 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 38 | 39 |
| 39 RenderImageGrow image; | 40 RenderImageGrow image; |
| 40 | 41 |
| 41 Map<int, Touch> touches = new Map(); | 42 Map<int, Touch> touches = new Map(); |
| 42 void handleEvent(event) { | 43 void handleEvent(event) { |
| 43 if (event is PointerEvent) { | 44 if (event is PointerEvent) { |
| 44 if (event.type == 'pointermove') | 45 if (event.type == 'pointermove') |
| 45 image.growth = math.max(0.0, image.growth + event.x - touches[event.pointe
r].x); | 46 image.growth = math.max(0.0, image.growth + event.x - touches[event.pointe
r].x); |
| 46 touches[event.pointer] = new Touch(event.x, event.y); | 47 touches[event.pointer] = new Touch(event.x, event.y); |
| 47 } | 48 } |
| 49 if (event.type == "back") { |
| 50 activity.finishCurrentActivity(); |
| 51 } |
| 48 } | 52 } |
| 49 | 53 |
| 50 void main() { | 54 void main() { |
| 51 void addFlexChildSolidColor(RenderFlex parent, Color backgroundColor, { int fl
ex: 0 }) { | 55 void addFlexChildSolidColor(RenderFlex parent, Color backgroundColor, { int fl
ex: 0 }) { |
| 52 RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor); | 56 RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor); |
| 53 parent.add(child); | 57 parent.add(child); |
| 54 child.parentData.flex = flex; | 58 child.parentData.flex = flex; |
| 55 } | 59 } |
| 56 | 60 |
| 57 var row = new RenderFlex(direction: FlexDirection.horizontal); | 61 var row = new RenderFlex(direction: FlexDirection.horizontal); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 column.parentData.flex = 8; | 98 column.parentData.flex = 8; |
| 95 | 99 |
| 96 RenderDecoratedBox root = new RenderDecoratedBox( | 100 RenderDecoratedBox root = new RenderDecoratedBox( |
| 97 decoration: new BoxDecoration(backgroundColor: const Color(0xFFFFFFFF)), | 101 decoration: new BoxDecoration(backgroundColor: const Color(0xFFFFFFFF)), |
| 98 child: row | 102 child: row |
| 99 ); | 103 ); |
| 100 | 104 |
| 101 new SkyBinding(root: root); | 105 new SkyBinding(root: root); |
| 102 view.setEventCallback(handleEvent); | 106 view.setEventCallback(handleEvent); |
| 103 } | 107 } |
| OLD | NEW |