Last active
June 3, 2018 12:53
-
-
Save iapolog2u/aad162bbbc50926bb8aff5016f6bddb3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>A Minimalist App</title> | |
| <script defer src="main.dart.js"></script> | |
| </head> | |
| <body> | |
| <h2>Todo</h2> | |
| <div> | |
| <input id="to-do-input" type="text" placeholder="What needs to be done?"> | |
| </div> | |
| <div> | |
| <ul id="to-do-list"> | |
| </ul> | |
| </div> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Copyright (c) 2012, the Dart project authors. | |
| // Please see the AUTHORS file // for details. | |
| // All rights reserved. Use of this source code | |
| // is governed by a BSD-style license that can be | |
| // found in the LICENSE file. | |
| import 'dart:html'; | |
| // 请注意这些变量的类型:InputElement和UListElement。这些都是Element的子类。dart:html库有几十个Element子类,其中很多都与某些HTML标签相对应 | |
| InputElement toDoInput; | |
| UListElement toDoList; | |
| void main() { | |
| toDoInput = querySelector('#to-do-input'); | |
| toDoList = querySelector('#to-do-list'); | |
| toDoInput.onChange.listen(addToDoItem); | |
| } | |
| void addToDoItem(Event e) { | |
| var newToDo = new LIElement(); | |
| newToDo.text = toDoInput.value; | |
| toDoInput.value = ''; | |
| toDoList.children.add(newToDo); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body { | |
| font-family: 'Open Sans', sans-serif; | |
| background-color: WhiteSmoke; | |
| margin: 15px; | |
| color: black; | |
| } | |
| #to-do-input { | |
| font-family: 'Open Sans', sans-serif; | |
| font-size: 14px; | |
| font-weight: normal; | |
| padding: 5px 0px 5px 5px; | |
| width: 100%; | |
| border: 1px solid Silver; | |
| background-color: White; | |
| } | |
| #to-do-list { | |
| padding: 0; | |
| margin: 0; | |
| list-style-position: inside; | |
| } | |
| #to-do-list li { | |
| padding: 5px 0px 5px 5px; | |
| border-bottom: 1px dotted Silver; | |
| } | |
| #to-do-list li:hover { | |
| color: red; | |
| cursor: pointer; | |
| } | |
| #delete-all { | |
| margin-top: 8px; | |
| background-color: #F8F8F8; | |
| border: 1px dotted #ccc; | |
| border-radius: 1em; | |
| float: right; | |
| } | |
| #delete-all:hover { | |
| background-color: #ddd; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment