| 60 | } |
| 61 | |
| 62 | function createList(data) { |
| 63 | const list = new ListWidget() |
| 64 | list.setPadding(0, 4, 1, 4) |
| 65 | |
| 66 | const gradient = new LinearGradient() |
| 67 | gradient.locations = [0, 1] |
| 68 | gradient.colors = [ |
| 69 | backColor, |
| 70 | backColor2 |
| 71 | ] |
| 72 | list.backgroundGradient = gradient |
| 73 | |
| 74 | if (data.error) { |
| 75 | let errorMessage = list.addText('No station in selected radius found. Please set a greater radius in widget parameters') |
| 76 | errorMessage.font = Font.boldSystemFont(12) |
| 77 | errorMessage.textColor = textColor |
| 78 | } |
| 79 | return list |
| 80 | } |
| 81 | |
| 82 | async function createWidget(data) { |
| 83 | let list = createList(data); |