OLD | NEW |
1 <sky> | 1 <app> |
2 <import src="../resources/run-after-display.sky" as="runAfterDisplay" /> | 2 <import src="../resources/run-after-display.sky" /> |
3 <import src="/sky/examples/flights-app/flights-app.sky" /> | 3 <style> |
| 4 * { box-sizing: border-box; } |
| 5 |
| 6 t, span { |
| 7 display: inline; |
| 8 } |
| 9 |
| 10 app { |
| 11 display: flex; |
| 12 flex-direction: column; |
| 13 min-height: 100%; |
| 14 background-color: #494949; |
| 15 font-family: "Helvetica", sans-serif; |
| 16 font-size: 16px; |
| 17 color: #2B2B2B; |
| 18 } |
| 19 |
| 20 app-header { |
| 21 display: flex; |
| 22 background: linear-gradient(#3E77B7, #6C98C4); |
| 23 padding: 8px; |
| 24 color: white; |
| 25 border-bottom: 1px solid #3E77B7; |
| 26 } |
| 27 |
| 28 app-title { |
| 29 flex: 1; |
| 30 display: flex; |
| 31 align-items: center; |
| 32 font-size: 22px; |
| 33 margin-left: 8px; |
| 34 } |
| 35 |
| 36 app-menu-button { |
| 37 display: flex; |
| 38 border-radius: 4px; |
| 39 justify-content: center; |
| 40 align-items: center; |
| 41 width: 30px; |
| 42 height: 30px; |
| 43 } |
| 44 |
| 45 .menu-icon { |
| 46 width: 18px; |
| 47 } |
| 48 |
| 49 .menu-icon-inner { |
| 50 width: 14px; |
| 51 } |
| 52 |
| 53 app-scrollable { |
| 54 flex: 1; |
| 55 box-shadow: inset 0px 0px 22px 2px rgba(22, 22, 22, 0.63); |
| 56 overflow: hidden; |
| 57 } |
| 58 |
| 59 app-panel { |
| 60 display: flex; |
| 61 flex-direction: column; |
| 62 background-color: white; |
| 63 } |
| 64 |
| 65 app-panel-header { |
| 66 background-color: #DEDEDE; |
| 67 padding: 8px; |
| 68 display: flex; |
| 69 align-items: center; |
| 70 } |
| 71 |
| 72 app-panel-content { |
| 73 display: flex; |
| 74 } |
| 75 |
| 76 app-toolbar { |
| 77 background-color: #F6F6F6; |
| 78 padding: 0 8px; |
| 79 } |
| 80 |
| 81 app-search-input { |
| 82 background-color: #F6F6F6; |
| 83 padding: 4px; |
| 84 display: flex; |
| 85 align-items: center; |
| 86 font-size: 1.2em; |
| 87 } |
| 88 |
| 89 app-toast { |
| 90 position: absolute; |
| 91 bottom: 32px; |
| 92 right: 32px; |
| 93 max-width: 55%; |
| 94 box-shadow: 0px 0px 12px 2px rgba(22, 22, 22, 0.4); |
| 95 background-image: linear-gradient(#E5D658, #DFCF43); |
| 96 border: 1px solid #AEA477; |
| 97 padding: 6px; |
| 98 border-radius: 2px; |
| 99 display: flex; |
| 100 align-items: center; |
| 101 font-size: 0.8em; |
| 102 overflow: hidden; |
| 103 } |
| 104 |
| 105 app-toast-header { |
| 106 flex-shrink: 0; |
| 107 margin-right: 6px; |
| 108 } |
| 109 |
| 110 app-toast-close-box { |
| 111 position: absolute; |
| 112 top: 3px; |
| 113 right: 3px; |
| 114 width: 1em; |
| 115 overflow: hidden; |
| 116 text-align: center; |
| 117 outline: 1px solid #AEA477; |
| 118 } |
| 119 |
| 120 .tip-icon { |
| 121 font-weight: bold; |
| 122 font-size: 24px; |
| 123 border-radius: 16px; |
| 124 width: 32px; |
| 125 height: 32px; |
| 126 border: 2px solid black; |
| 127 line-height: 30px; |
| 128 text-align: center; |
| 129 } |
| 130 |
| 131 .tip-price { |
| 132 font-weight: bold; |
| 133 } |
| 134 |
| 135 .input-text { |
| 136 margin-left: 8px; |
| 137 } |
| 138 |
| 139 .route-result { |
| 140 margin: 16px 16px 0 16px; |
| 141 outline: 1px solid black; |
| 142 } |
| 143 |
| 144 .route-title { |
| 145 flex: 1; |
| 146 } |
| 147 |
| 148 .airline { |
| 149 border-radius: 2px; |
| 150 align-items: center; |
| 151 padding: 8px; |
| 152 } |
| 153 |
| 154 .airline-name { |
| 155 flex: 1; |
| 156 } |
| 157 |
| 158 .airline-logo-image { |
| 159 width: 50px; |
| 160 flex-shrink: 0; |
| 161 } |
| 162 |
| 163 .airline-best-price { |
| 164 color: #ABB4B6; |
| 165 } |
| 166 |
| 167 .airline-name, |
| 168 .airline-best-price { |
| 169 padding: 8px; |
| 170 } |
| 171 |
| 172 a { |
| 173 text-decoration: none; |
| 174 color: #1155CC; |
| 175 } |
| 176 </style> |
| 177 <app-header> |
| 178 <app-title> |
| 179 <t>Search</t> |
| 180 </app-title> |
| 181 <app-menu-button> |
| 182 <img src="/sky/examples/flights/images/menu-white.png" class="menu-icon"> |
| 183 </app-menu-button> |
| 184 </app-header> |
| 185 <app-toolbar> |
| 186 <app-search-input> |
| 187 <span class="input-icon"> |
| 188 <img src="/sky/examples/flights/images/magnifying-glass.png" style="widt
h: 16px"> |
| 189 </span> |
| 190 <span class="input-text"><t>flights today to dc by price</t></span> |
| 191 </app-search-input> |
| 192 </app-toolbar> |
| 193 <app-scrollable> |
| 194 <app-panel class="route-result"> |
| 195 <app-panel-header> |
| 196 <div class="route-title"> |
| 197 <t>SFO to DCA</t> |
| 198 </div> |
| 199 <app-menu-button> |
| 200 <img src="/sky/examples/flights/images/menu-enabled.png" class="menu-i
con-inner"> |
| 201 </app-menu-button> |
| 202 </app-panel-header> |
| 203 <app-panel-content class="airline"> |
| 204 <div class="airline-logo"> |
| 205 <img class="airline-logo-image" src="/sky/examples/flights/images/virg
in-america.jpg"> |
| 206 </div> |
| 207 <div class="airline-name"> |
| 208 <t>Virgin America</t> |
| 209 </div> |
| 210 <div class="airline-best-price"> |
| 211 <t><a>$800</a></t> |
| 212 </div> |
| 213 </app-panel-content> |
| 214 <app-panel-content class="airline"> |
| 215 <div class="airline-logo"> |
| 216 <img class="airline-logo-image" src="/sky/examples/flights/images/ba.j
pg"> |
| 217 </div> |
| 218 <div class="airline-name"> |
| 219 <t>British Airways</t> |
| 220 </div> |
| 221 <div class="airline-best-price"> |
| 222 <t><a>$700</a></t> |
| 223 </div> |
| 224 </app-panel-content> |
| 225 <app-panel-content class="airline"> |
| 226 <div class="airline-logo"> |
| 227 <img class="airline-logo-image" src="/sky/examples/flights/images/unit
ed.jpg"> |
| 228 </div> |
| 229 <div class="airline-name"> |
| 230 <t>United</t> |
| 231 </div> |
| 232 <div class="airline-best-price"> |
| 233 <t><a>$667</a></t> |
| 234 </div> |
| 235 </app-panel-content> |
| 236 <app-panel-content class="airline"> |
| 237 <div class="airline-logo"> |
| 238 <img class="airline-logo-image" src="/sky/examples/flights/images/delt
a.jpg"> |
| 239 </div> |
| 240 <div class="airline-name"> |
| 241 <t>Delta</t> |
| 242 </div> |
| 243 <div class="airline-best-price"> |
| 244 <t><a>$450</a></t> |
| 245 </div> |
| 246 </app-panel-content> |
| 247 </app-panel> |
| 248 <app-panel class="route-result"> |
| 249 <app-panel-header> |
| 250 <div class="route-title"> |
| 251 <t>SJC to DCA</t> |
| 252 </div> |
| 253 <app-menu-button> |
| 254 <img src="/sky/examples/flights/images/menu-enabled.png" class="menu-i
con-inner"> |
| 255 </app-menu-button> |
| 256 </app-panel-header> |
| 257 <app-panel-content class="airline"> |
| 258 <div class="airline-logo"> |
| 259 <img class="airline-logo-image" src="/sky/examples/flights/images/virg
in-america.jpg"> |
| 260 </div> |
| 261 <div class="airline-name"> |
| 262 <t>Virgin America</t> |
| 263 </div> |
| 264 <div class="airline-best-price"> |
| 265 <t><a>$1500</a></t> |
| 266 </div> |
| 267 </app-panel-content> |
| 268 <app-panel-content class="airline"> |
| 269 <div class="airline-logo"> |
| 270 <img class="airline-logo-image" src="/sky/examples/flights/images/jetb
lue.jpg"> |
| 271 </div> |
| 272 <div class="airline-name"> |
| 273 <t>jetBlue</t> |
| 274 </div> |
| 275 <div class="airline-best-price"> |
| 276 <t><a>$650</a></t> |
| 277 </div> |
| 278 </app-panel-content> |
| 279 <app-panel-content class="airline"> |
| 280 <div class="airline-logo"> |
| 281 <img class="airline-logo-image" src="/sky/examples/flights/images/unit
ed.jpg"> |
| 282 </div> |
| 283 <div class="airline-name"> |
| 284 <t>United</t> |
| 285 </div> |
| 286 <div class="airline-best-price"> |
| 287 <t><a>$367</a></t> |
| 288 </div> |
| 289 </app-panel-content> |
| 290 </app-panel> |
| 291 </app-scrollable> |
| 292 <app-toast> |
| 293 <app-toast-header> |
| 294 <div class="tip-icon"> |
| 295 <t>?</t> |
| 296 </div> |
| 297 </app-toast-header> |
| 298 <app-toast-content> |
| 299 <t>Flights are <span class="tip-price">$200</span> cheaper tomorrow.</t> |
| 300 </app-toast-content> |
| 301 <app-toast-close-box> |
| 302 X |
| 303 </app-toast-close-box> |
| 304 </app-toast> |
4 <script> | 305 <script> |
| 306 import "dart:sky"; |
| 307 import "dart:sky.internals" as internals; |
| 308 import "dart:async"; |
| 309 |
5 var app; | 310 var app; |
6 | 311 |
7 function imagesLoaded() { | 312 bool imagesLoaded() { |
8 var images = app.shadowRoot.querySelectorAll('img'); | 313 var images = window.document.querySelectorAll('img'); |
9 for (var i = 0; i < images.length; i++) { | 314 for (var i = 0; i < images.length; i++) { |
10 if (!images[i].complete) | 315 if (!images.item(i).complete) |
11 return false; | 316 return false; |
12 } | 317 } |
13 return true; | 318 return true; |
14 } | 319 } |
15 | 320 |
16 function checkImagesLoaded() { | 321 void checkImagesLoaded() { |
17 if (!imagesLoaded()) { | 322 if (!imagesLoaded()) { |
18 setTimeout(checkImagesLoaded, 10); | 323 new Timer(new Duration(seconds:10), checkImagesLoaded); |
19 return; | 324 return; |
20 } | 325 } |
21 runAfterDisplay(function() { | 326 runAfterDisplay(() { |
22 internals.notifyTestComplete(""); | 327 internals.notifyTestComplete(""); |
23 }); | 328 }); |
24 } | 329 } |
25 | 330 void main() { |
26 addEventListener("load", function() { | 331 window.addEventListener("load", (_) { |
27 app = document.createElement("flights-app"); | 332 var input = document.querySelector('.input-text'); |
28 document.querySelector("sky").appendChild(app); | 333 window.getSelection().selectAllChildren(input.firstChild); |
29 checkImagesLoaded(); | 334 checkImagesLoaded(); |
30 }); | 335 }); |
| 336 } |
31 </script> | 337 </script> |
32 </sky> | 338 </app> |
OLD | NEW |