Commit fdc05921 authored by Sindre Sorhus's avatar Sindre Sorhus

Dart app: minor tweaks

parent ae8c6a13
...@@ -23,7 +23,7 @@ class TodoApp { ...@@ -23,7 +23,7 @@ class TodoApp {
} }
void initLocalStorage() { void initLocalStorage() {
var jsonList = window.localStorage["todos-vanilladart"]; var jsonList = window.localStorage['todos-vanilladart'];
if (jsonList != null) { if (jsonList != null) {
try { try {
var todos = JSON.parse(jsonList); var todos = JSON.parse(jsonList);
...@@ -31,7 +31,7 @@ class TodoApp { ...@@ -31,7 +31,7 @@ class TodoApp {
addTodo(new Todo.fromJson(todo)); addTodo(new Todo.fromJson(todo));
} }
} catch (e) { } catch (e) {
window.console.log("Could not load todos form local storage."); window.console.log('Could not load todos form local storage.');
} }
} }
} }
...@@ -84,15 +84,10 @@ class TodoApp { ...@@ -84,15 +84,10 @@ class TodoApp {
} }
void updateFooterDisplay() { void updateFooterDisplay() {
if (todoWidgets.length == 0) { var display = todoWidgets.length == 0 ? 'none' : 'block';
checkAllCheckboxElement.style.display = 'none'; checkAllCheckboxElement.style.display = display;
mainElement.style.display = 'none'; mainElement.style.display = display;
footerElement.style.display = 'none'; footerElement.style.display = display;
} else {
checkAllCheckboxElement.style.display = 'block';
mainElement.style.display = 'block';
footerElement.style.display = 'block';
}
updateCounts(); updateCounts();
} }
...@@ -165,6 +160,6 @@ class TodoApp { ...@@ -165,6 +160,6 @@ class TodoApp {
for (TodoWidget todoWidget in todoWidgets) { for (TodoWidget todoWidget in todoWidgets) {
todos.add(todoWidget.todo); todos.add(todoWidget.todo);
} }
window.localStorage["todos-vanilladart"] = JSON.stringify(todos); window.localStorage['todos-vanilladart'] = JSON.stringify(todos);
} }
} }
...@@ -71,11 +71,7 @@ class TodoWidget { ...@@ -71,11 +71,7 @@ class TodoWidget {
} }
void set visible(bool visible) { void set visible(bool visible) {
if (visible) { element.style.display = visible ? 'block' : 'none';
element.style.display = 'block';
} else {
element.style.display = 'none';
}
} }
void toggle() { void toggle() {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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