-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathTestPerformance1.dart
35 lines (30 loc) · 1.09 KB
/
TestPerformance1.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
//Sample Code: LinearLayout Test Performance 1
import 'package:rikulo_ui/view.dart';
void main() {
printc("started");
final View mainView = new View()
..layout.text = "type: linear; orient: vertical"
..on.layout.listen((event) {
if (event.target == event.currentTarget) //filter out children
printc("done");
});
for (int i = 0; i < 50; ++i) {
View hlayout = new View();
hlayout.profile.text = "width: flex; height: content";
hlayout.layout.type = "linear";
hlayout.style.border = "1px solid #885";
for (int j = 0; j < 50; ++j) {
TextView view = new TextView("$i.$j");
view.style.backgroundColor = "orange";
view.style.lineHeight = "30px";
view.style.textAlign = "center";
view.profile.text = "width: 50; height: 30";
//performance is much better if not to use "content" (default)
//note: don't assign to view.width/height directly since it is slower (measureWidth_ will be called)
hlayout.addChild(view);
}
mainView.addChild(hlayout);
}
mainView.addToDocument();
printc("after view added");
}