| 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 'package:sky/rendering/box.dart'; | 6 import 'package:sky/rendering/box.dart'; |
| 7 import 'package:sky/rendering/object.dart'; | 7 import 'package:sky/rendering/object.dart'; |
| 8 import 'package:sky/rendering/sky_binding.dart'; | 8 import 'package:sky/rendering/sky_binding.dart'; |
| 9 import 'package:sky/rendering/auto_layout.dart'; | 9 import 'package:sky/rendering/auto_layout.dart'; |
| 10 import 'package:cassowary/cassowary.dart' as al; | 10 import 'package:cassowary/cassowary.dart' as al; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 // The boxes must be stacked left to right | 40 // The boxes must be stacked left to right |
| 41 p1.rightEdge <= p2.leftEdge, | 41 p1.rightEdge <= p2.leftEdge, |
| 42 p2.rightEdge <= p3.leftEdge, | 42 p2.rightEdge <= p3.leftEdge, |
| 43 | 43 |
| 44 // The widths of the first and the third boxes should be equal | 44 // The widths of the first and the third boxes should be equal |
| 45 (p1.width == p3.width) as al.Constraint, | 45 (p1.width == p3.width) as al.Constraint, |
| 46 | 46 |
| 47 // The width of the second box should be twice as much as that of the first | 47 // The width of the second box should be twice as much as that of the first |
| 48 // and third | 48 // and third |
| 49 (p2.width * al.CM(2.0) == p1.width) as al.Constraint, | 49 (p2.width * al.cm(2.0) == p1.width) as al.Constraint, |
| 50 | 50 |
| 51 // The height of the three boxes should be equal to that of the container | 51 // The height of the three boxes should be equal to that of the container |
| 52 (p1.height == p2.height) as al.Constraint, | 52 (p1.height == p2.height) as al.Constraint, |
| 53 (p2.height == p3.height) as al.Constraint, | 53 (p2.height == p3.height) as al.Constraint, |
| 54 (p3.height == root.height) as al.Constraint, | 54 (p3.height == root.height) as al.Constraint, |
| 55 | 55 |
| 56 // The fourth box should be half as wide as the second and must be attached | 56 // The fourth box should be half as wide as the second and must be attached |
| 57 // to the right edge of the same (by its center) | 57 // to the right edge of the same (by its center) |
| 58 (p4.width == p2.width / al.CM(2.0)) as al.Constraint, | 58 (p4.width == p2.width / al.cm(2.0)) as al.Constraint, |
| 59 (p4.height == al.CM(50.0)) as al.Constraint, | 59 (p4.height == al.cm(50.0)) as al.Constraint, |
| 60 (p4.horizontalCenter == p2.rightEdge) as al.Constraint, | 60 (p4.horizontalCenter == p2.rightEdge) as al.Constraint, |
| 61 (p4.verticalCenter == p2.height / al.CM(2.0)) as al.Constraint, | 61 (p4.verticalCenter == p2.height / al.cm(2.0)) as al.Constraint, |
| 62 ]); | 62 ]); |
| 63 | 63 |
| 64 new SkyBinding(root: root); | 64 new SkyBinding(root: root); |
| 65 } | 65 } |
| OLD | NEW |