OLD | NEW |
| (Empty) |
1 <!-- | |
2 // Copyright 2015 The Chromium Authors. All rights reserved. | |
3 // Use of this source code is governed by a BSD-style license that can be | |
4 // found in the LICENSE file. | |
5 --> | |
6 <import src="/sky/framework/elements/sky-box.sky" /> | |
7 <import src="/sky/framework/elements/sky-button.sky" /> | |
8 <import src="/sky/framework/elements/sky-checkbox.sky" /> | |
9 <import src="/sky/framework/elements/sky-element.sky" /> | |
10 <import src="/sky/framework/elements/sky-input.sky" /> | |
11 <import src="/sky/framework/elements/sky-radio.sky" /> | |
12 <import src="/sky/framework/elements/sky-scrollable.sky" /> | |
13 <sky-element> | |
14 <template> | |
15 <style> | |
16 :host { | |
17 font-family: 'Roboto Regular', 'Helvetica'; | |
18 } | |
19 div { | |
20 display: flex; | |
21 align-items: center; | |
22 } | |
23 sky-checkbox { | |
24 margin: 5px; | |
25 } | |
26 .output { | |
27 margin-left: 48px; | |
28 } | |
29 sky-scrollable { | |
30 height: -webkit-fill-available; | |
31 } | |
32 </style> | |
33 <sky-scrollable> | |
34 <sky-box title='Text'> | |
35 <sky-input id="text" value="{{ inputValue }}" /> | |
36 <div>value = {{ inputValue }}</div> | |
37 </sky-box> | |
38 | |
39 <sky-box title='Buttons'> | |
40 <div style="display: flex; flex-direction: horizontal"> | |
41 <div style="flex:1" /> | |
42 <sky-button level="1" id="button">CANCEL</sky-button> | |
43 <sky-button level="1" primary>CONFIRM</sky-button> | |
44 </div> | |
45 </sky-box> | |
46 | |
47 <sky-box title='Checkboxes'> | |
48 <div><sky-checkbox id='checkbox' checked='{{ checked }}'/>Checkbox</div> | |
49 <div class="output">highlight: {{ myCheckbox.highlight }}</div> | |
50 <div class="output">checked: {{ myCheckbox.checked }}</div> | |
51 <div><sky-checkbox id='checkbox' checked="true"/>Checkbox, default checked
.</div> | |
52 <div class="output">checked: {{ checked }}</div> | |
53 </sky-box> | |
54 | |
55 <sky-box title='Radios'> | |
56 <sky-box title='Group One'> | |
57 <div><sky-radio group='foo'/>one</div> | |
58 <div><sky-radio group='foo' selected='true' />two</div> | |
59 <div><sky-radio group='foo'/>three</div> | |
60 </sky-box> | |
61 <sky-box title='Group Two'> | |
62 <div><sky-radio group='bar'/>A</div> | |
63 <div><sky-radio group='bar'/>B</div> | |
64 <div><sky-radio group='bar' selected='true' />C</div> | |
65 </sky-box> | |
66 </sky-box> | |
67 </sky-scrollable> | |
68 </template> | |
69 <script> | |
70 import "dart:sky"; | |
71 | |
72 @Tagname('widget-root') | |
73 class WidgetRoot extends SkyElement { | |
74 Element _button; | |
75 Element _checkbox; | |
76 Element _text; | |
77 int _clickCount = 0; | |
78 String _inputValue = "Ready"; | |
79 bool _checked = false; | |
80 | |
81 void shadowRootReady() { | |
82 _button = this.shadowRoot.getElementById('button'); | |
83 _checkbox = this.shadowRoot.getElementById('checkbox'); | |
84 _text = this.shadowRoot.getElementById('text'); | |
85 | |
86 _button.addEventListener('click', _handleClick); | |
87 } | |
88 | |
89 void _handleClick(_) { | |
90 _clickCount++; | |
91 _checked = !_checked; | |
92 _inputValue = "Moar clicking ${_clickCount}"; | |
93 } | |
94 } | |
95 | |
96 _init(script) => register(script, WidgetRoot); | |
97 </script> | |
98 </sky-element> | |
OLD | NEW |