Created
December 7, 2020 13:05
-
-
Save Elvis10ten/05e903b98fce00da6f3664789fd20463 to your computer and use it in GitHub Desktop.
This file contains 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
{ | |
"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