Skip to content

Commit b5429a1

Browse files
authored
Merge pull request #8 from rushhiii/test
Update MyToyota.js
2 parents 00f4f8d + 324a7b2 commit b5429a1

1 file changed

Lines changed: 28 additions & 3 deletions

File tree

Toyota Widget/MyToyota.js

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,34 @@ const textColor = Color.white()
1818
const secondaryTextColor = new Color("#AAAAAA")
1919
const accentColor = new Color("#F5F5F5")
2020

21-
// Toyota Car Widget - Part 2: Entry
22-
const widget = new ListWidget()
23-
widget.backgroundColor = backgroundColor
21+
// Toyota Car Widget - Part 3: Large Layout
22+
async function buildLargeWidget(widget) {
23+
const imgReq = new Request(carInfo.imageURL)
24+
const carImage = await imgReq.loadImage()
25+
26+
const imgStack = widget.addStack()
27+
imgStack.size = new Size(0, 160)
28+
imgStack.centerAlignContent()
29+
const image = imgStack.addImage(carImage)
30+
image.imageSize = new Size(320, 160)
31+
image.cornerRadius = 10
32+
image.resizable = true
33+
widget.addSpacer(10)
34+
35+
const brandStack = widget.addStack()
36+
brandStack.centerAlignContent()
37+
const logo = brandStack.addText("🚗 " + carInfo.brand)
38+
logo.font = Font.mediumSystemFont(16)
39+
logo.textColor = textColor
40+
widget.addSpacer(2)
41+
42+
const modelText = widget.addText(carInfo.model)
43+
modelText.font = Font.semiboldSystemFont(20)
44+
modelText.textColor = accentColor
45+
widget.addSpacer(8)
46+
47+
addDetailsGrid(widget)
48+
}
2449

2550
if (widgetSize === "large") {
2651
await buildLargeWidget(widget)

0 commit comments

Comments
 (0)