[view]View.hidden not work properly
Closed this issue · 0 comments
henrichen commented
call _left.hidden=true; _right.hidden=false; then requestLayout, expect _right to show(which was original hidden) but it does not.
B0003.dart
#import('../../client/app/app.dart');
#import('../../client/view/view.dart');
#import('../../client/model/model.dart');
#import('../../client/event/event.dart');
class B0003 extends Activity {
View _left, _right;
void onCreate_() {
mainView.layout.type = "linear";
mainView.layout.orient = "vertical";
//hlayout
View hlayout = new View();
hlayout.layout.type = "linear";
hlayout.layout.orient = "horizontal";
hlayout.profile.width = "100%";
hlayout.profile.height = "content";
mainView.addChild(hlayout);
//left text
TextView left = new TextView("LEFT TEXT");
hlayout.addChild(left);
_left = left;
//right text
TextView right = new TextView("RIGHT TEXT");
right.hidden = true;
hlayout.addChild(right);
_right = right;
_left.on.click.add((event) {_left.hidden = true; _right.hidden = false; mainView.requestLayout();});
_right.on.click.add((event) {_left.hidden = false; _right.hidden = true; mainView.requestLayout();});
}
}
main() {
new B0003().run();
}
B0003.html
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="stylesheet" type="text/css" href="../../resources/css/view.css" />
</head>
<body>
<script type="application/dart" src="B0003.dart"></script>
<script src="../../resources/js/dart.js"></script>
</body>
</html>