Commit cbbdbae6 authored by Mathieu Lorber's avatar Mathieu Lorber

New formatter on all vanilladart code

parent fe473ce1
...@@ -5,7 +5,7 @@ class Todo { ...@@ -5,7 +5,7 @@ class Todo {
String title; String title;
bool completed; bool completed;
Todo(this.id, this.title, {this.completed : false}); Todo(this.id, this.title, {this.completed: false});
Todo.fromJson(Map json) { Todo.fromJson(Map json) {
id = json['id']; id = json['id'];
...@@ -15,10 +15,6 @@ class Todo { ...@@ -15,10 +15,6 @@ class Todo {
// this is automatically called by JSON.encode // this is automatically called by JSON.encode
Map toJson() { Map toJson() {
return { return {'id': id, 'title': title, 'completed': completed};
'id': id,
'title': title,
'completed': completed
};
} }
} }
part of todomvc; part of todomvc;
class TodoApp { class TodoApp {
List<TodoWidget> todoWidgets = new List<TodoWidget>(); List<TodoWidget> todoWidgets = new List<TodoWidget>();
Element todoListElement = querySelector('#todo-list'); Element todoListElement = querySelector('#todo-list');
...@@ -12,7 +11,8 @@ class TodoApp { ...@@ -12,7 +11,8 @@ class TodoApp {
Element clearCompletedElement = querySelector('#clear-completed'); Element clearCompletedElement = querySelector('#clear-completed');
Element showAllElement = querySelector('#filters a[href="#/"]'); Element showAllElement = querySelector('#filters a[href="#/"]');
Element showActiveElement = querySelector('#filters a[href="#/active"]'); Element showActiveElement = querySelector('#filters a[href="#/active"]');
Element showCompletedElement = querySelector('#filters a[href="#/completed"]'); Element showCompletedElement =
querySelector('#filters a[href="#/completed"]');
TodoApp() { TodoApp() {
initLocalStorage(); initLocalStorage();
...@@ -93,7 +93,8 @@ class TodoApp { ...@@ -93,7 +93,8 @@ class TodoApp {
var complete = todoWidgets.where((w) => w.todo.completed).length; var complete = todoWidgets.where((w) => w.todo.completed).length;
checkAllCheckboxElement.checked = (complete == todoWidgets.length); checkAllCheckboxElement.checked = (complete == todoWidgets.length);
var left = todoWidgets.length - complete; var left = todoWidgets.length - complete;
countElement.innerHtml = '<strong>$left</strong> item${left != 1 ? 's' : ''} left'; countElement.innerHtml =
'<strong>$left</strong> item${left != 1 ? 's' : ''} left';
if (complete == 0) { if (complete == 0) {
clearCompletedElement.style.display = 'none'; clearCompletedElement.style.display = 'none';
} else { } else {
...@@ -108,7 +109,7 @@ class TodoApp { ...@@ -108,7 +109,7 @@ class TodoApp {
} }
void updateFilter() { void updateFilter() {
switch(window.location.hash) { switch (window.location.hash) {
case '#/active': case '#/active':
showActive(); showActive();
break; break;
......
part of todomvc; part of todomvc;
class TodoWidget { class TodoWidget {
static const HtmlEscape htmlEscape = const HtmlEscape(); static const HtmlEscape htmlEscape = const HtmlEscape();
TodoApp todoApp; TodoApp todoApp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment