-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathTestLinearLayout2.dart
73 lines (66 loc) · 2.06 KB
/
TestLinearLayout2.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//Test Code: TestLinearLayout2
import 'package:rikulo_ui/view.dart';
void test1(View parent, int left, int top) {
//case 1: fixed size
View vlayout = new View();
vlayout.left = left;
vlayout.top = top;
vlayout.style.backgroundColor = "#ddb";
vlayout.layout.type = "linear";
vlayout.layout.orient = "vertical";
vlayout.profile.width = vlayout.profile.height = "content";
parent.addChild(vlayout);
View view = new View();
view.style.backgroundColor = "blue";
view.profile.height = "30"; //test profile.height
view.width = 50; //test width
vlayout.addChild(view);
view = new View();
view.style.backgroundColor = "orange";
view.height = 50;
view.profile.width = "40";
vlayout.addChild(view);
view = new View();
view.style.backgroundColor = "yellow";
view.height = 70;
view.width = 30;
view.profile.align = "end";
vlayout.addChild(view);
}
void test2(View parent, int left, int top) {
//case 2: flex
View vlayout = new View();
vlayout.left = left;
vlayout.top = top;
vlayout.style.border = "1px solid #884";
vlayout.layout.type = "linear";
vlayout.layout.align = "center";
vlayout.layout.orient = "vertical";
vlayout.layout.spacing = "5 5";
vlayout.profile.height = "70%";
//we can't use flex (which implies parent.clientHeight)
//of course, we can use vlayout to partition but it is not tested here
vlayout.width = 50; //..layout.width = "50" is also OK
parent.addChild(vlayout);
View view = new View();
view.style.backgroundColor = "blue";
view.profile.height = "flex"; //test profile.width
view.profile.width = "flex";
vlayout.addChild(view);
view = new View();
view.style.backgroundColor = "orange";
view.profile.height = "flex 2";
view.profile.width = "50%";
vlayout.addChild(view);
view = new View();
view.style.backgroundColor = "yellow";
view.profile.height = "flex 3";
view.profile.width = "100%";
vlayout.addChild(view);
}
void main() {
final View mainView = new View()..addToDocument();
mainView.style.backgroundColor = "#cca";
test1(mainView, 10, 10);
test2(mainView, 100, 10);
}