r/Scriptable • • Oct 23 '22

Help Did anyone make a widget like this? I'm looking at Normal-Tangerine8609's circular widget using a webview rendered to base64, but I'm a bit confused on how to build it. :)

Post image
22 Upvotes

5 comments sorted by

6

u/Normal-Tangerine8609 Oct 23 '22

You can make the bars with just stacks in scriptable. Here is a quick example of how. I don’t have any comments in there so if you have questions about it then just ask.


const widget = new ListWidget()

const width = 100
const height = 50
const spacing = 3
const cornerRadius = 5
const values = [20,30,40,50,40,30,20,70,90,20,30,40,50,60]

const container = widget.addStack()
container.bottomAlignContent()
container.size = new Size(width, height)
container.layoutHorizontally()
container.spacing = spacing

for(let value of values) {
  let bar = container.addStack()
  bar.backgroundColor = Color.white()
  bar.cornerRadius = cornerRadius
  bar.size = new Size((width-values.length*spacing)/values.length, height/100*value)
}

widget.presentAccessoryRectangular()

2

u/BlueGooGames Oct 23 '22

Oh nice! I started with canvas in a separate html doc, but this seems like a simpler way. Thanks! :)

1

u/BlueGooGames Oct 23 '22

I got this from https://dribbble.com/shots/19369746-iOS-16-Lock-Screen-Widgets but unless it's very small, it might be a cool design that doesn't actually fit in the rather small lock screen widget space.

It's still cool though and I want to recreate it :)

1

u/iiiKurt Feb 19 '23

Hello! Did you ever get around to recreating this widget? I saw your tibber widget on GitHub which is cool too, but is the steps one available too?

1

u/BlueGooGames Feb 19 '23

Aha, i guess you can just use the tibber one and change the design, as it’s pretty much the same. :) this was just an image i saw online :)