Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: samples/slider/slider_sample.dart

Issue 11142015: update hello, world sample and remove slider (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: after merge with master Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « samples/slider/slider_sample.css ('k') | samples/slider/slider_sample.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library slider_sample;
6
7 import 'dart:html';
8 import '../ui_lib/view/view.dart';
9
10 const menuItems = const["Apple", "Banana", "Cherry", "Durian"];
11
12 main() {
13 var sliderMenu = new SliderMenu(menuItems, (selectedText) {
14 displaySelection(selectedText);
15 });
16 query("#menu").nodes.add(sliderMenu.node);
17
18 query('#next').on.click.add((e) {
19 sliderMenu.selectNext(true);
20 });
21
22 query('#prev').on.click.add((e) {
23 sliderMenu.selectPrevious(true);
24 });
25
26 document.on.keyDown.add((KeyboardEvent event) {
27 switch (event.keyIdentifier) {
28 case KeyName.LEFT:
29 sliderMenu.selectPrevious(true);
30 break;
31 case KeyName.RIGHT:
32 sliderMenu.selectNext(true);
33 break;
34 }
35 });
36
37 sliderMenu.enterDocument();
38 }
39
40 void displaySelection(String selectedText) {
41 query("#notes").text = "Selection: ${selectedText}";
42 }
OLDNEW
« no previous file with comments | « samples/slider/slider_sample.css ('k') | samples/slider/slider_sample.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698