| 54 | } |
| 55 | |
| 56 | function createList(data) { |
| 57 | const list = new ListWidget() |
| 58 | list.setPadding(0, 4, 1, 4) |
| 59 | |
| 60 | const gradient = new LinearGradient() |
| 61 | gradient.locations = [0, 1] |
| 62 | gradient.colors = [ |
| 63 | backColor, |
| 64 | backColor2 |
| 65 | ] |
| 66 | list.backgroundGradient = gradient |
| 67 | |
| 68 | if (data.error) { |
| 69 | let errorMessage = list.addText('No stations found.') |
| 70 | errorMessage.font = Font.boldSystemFont(12) |
| 71 | errorMessage.textColor = textColor |
| 72 | } |
| 73 | return list |
| 74 | } |
| 75 | |
| 76 | async function createWidget(data, fuelType) { |
| 77 | let list = createList(data); |