Skip to content

Instantly share code, notes, and snippets.

@Elvis10ten
Created December 7, 2020 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Elvis10ten/05e903b98fce00da6f3664789fd20463 to your computer and use it in GitHub Desktop.
Save Elvis10ten/05e903b98fce00da6f3664789fd20463 to your computer and use it in GitHub Desktop.
{
"todo_list": {
"type": "screen",
"children": [
{
"type": "text_field",
"key": "search_term",
"width": "match_parent",
"hint": "Search for stuff"
},
{
"type": "button",
"width": "match_parent",
"text": "Add",
"on_click": {
"type": "command",
"command": "INSERT INTO todos(title)",
"params": [
"Another one"
]
}
},
{
"type": "list",
"width": "match_parent",
"items": "SELECT id, title, is_done FROM todos WHERE title LIKE '%{search_term}%'",
"divider": true,
"item_layout": "item_layout_todo"
}
]
},
"item_layout_todo": {
"type": "row",
"padding": 16,
"children": [
{
"type": "check_box",
"is_checked": "{is_done}",
"on_click": {
"type": "command",
"command": "UPDATE todos SET is_done = ? WHERE id = ?",
"params": [
"{self.is_checked}",
"{item.id}"
]
}
},
{
"type": "column",
"padding_left": 16,
"children": [
{
"type": "text",
"text": "{item.title}"
}
]
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment