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/sky-box.sky" /> |
| 7 <import src="/sky/framework/sky-button.sky" /> |
| 8 <import src="/sky/framework/sky-checkbox.sky" /> |
| 9 <import src="/sky/framework/sky-element.sky" /> |
| 10 <import src="/sky/framework/sky-input.sky" /> |
| 11 <import src="/sky/framework/sky-radio.sky" /> |
| 12 <import src="/sky/framework/sky-scrollable.sky" /> |
| 13 <sky-element> |
| 14 <template> |
| 15 <style> |
| 16 div { |
| 17 display: flex; |
| 18 align-items: center; |
| 19 } |
| 20 sky-checkbox { |
| 21 margin: 5px; |
| 22 } |
| 23 .output { |
| 24 margin-left: 48px; |
| 25 } |
| 26 sky-scrollable { |
| 27 height: -webkit-fill-available; |
| 28 } |
| 29 </style> |
| 30 <sky-scrollable> |
| 31 <sky-box title='Text'> |
| 32 <sky-input id="text" value="{{ inputValue }}" /> |
| 33 <div>value = {{ inputValue }}</div> |
| 34 </sky-box> |
| 35 |
| 36 <sky-box title='Buttons'> |
| 37 <sky-button id='button'>Button</sky-button> |
| 38 <div>highlight: {{ myButton.highlight }}</div> |
| 39 <div>clickCount: {{ clickCount }}</div> |
| 40 </sky-box> |
| 41 |
| 42 <sky-box title='Checkboxes'> |
| 43 <div><sky-checkbox id='checkbox' checked='{{ checked }}'/>Checkbox</div> |
| 44 <div class="output">highlight: {{ myCheckbox.highlight }}</div> |
| 45 <div class="output">checked: {{ myCheckbox.checked }}</div> |
| 46 <div><sky-checkbox id='checkbox' checked="true"/>Checkbox, default checked
.</div> |
| 47 <div class="output">checked: {{ checked }}</div> |
| 48 </sky-box> |
| 49 |
| 50 <sky-box title='Radios'> |
| 51 <sky-box title='Group One'> |
| 52 <div><sky-radio group='foo'/>one</div> |
| 53 <div><sky-radio group='foo' selected='true' />two</div> |
| 54 <div><sky-radio group='foo'/>three</div> |
| 55 </sky-box> |
| 56 <sky-box title='Group Two'> |
| 57 <div><sky-radio group='bar'/>A</div> |
| 58 <div><sky-radio group='bar'/>B</div> |
| 59 <div><sky-radio group='bar' selected='true' />C</div> |
| 60 </sky-box> |
| 61 </sky-box> |
| 62 </sky-scrollable> |
| 63 </template> |
| 64 <script> |
| 65 import "dart:sky"; |
| 66 |
| 67 @Tagname('widget-root') |
| 68 class WidgetRoot extends SkyElement { |
| 69 Element _button; |
| 70 Element _checkbox; |
| 71 Element _text; |
| 72 int _clickCount = 0; |
| 73 String _inputValue = "Ready"; |
| 74 bool _checked = false; |
| 75 |
| 76 void shadowRootReady() { |
| 77 _button = this.shadowRoot.getElementById('button'); |
| 78 _checkbox = this.shadowRoot.getElementById('checkbox'); |
| 79 _text = this.shadowRoot.getElementById('text'); |
| 80 |
| 81 _button.addEventListener('click', _handleClick); |
| 82 } |
| 83 |
| 84 void _handleClick(_) { |
| 85 _clickCount++; |
| 86 _checked = !_checked; |
| 87 _inputValue = "Moar clicking ${_clickCount}"; |
| 88 } |
| 89 } |
| 90 |
| 91 _init(script) => register(script, WidgetRoot); |
| 92 </script> |
| 93 </sky-element> |
OLD | NEW |