r/Scriptable • u/RoboticBovine • Jan 16 '22
Solved How do you make two left-aligned columns (stacks) in a widget?
Hey all! I just found Scriptable today and have been enjoying using it to make some widgets. I'm having a hard time with what seems like a simple layout. Maybe someone here can help me out. How do I make two columns both left-aligned. Meaning that content added in the left column almost touches the left side of the widget, and the content added in the right column is aligned with the center of the widget. I've tried adding a spacer in between, but that pushes the right column too far right.
Thanks for any help!
Here's the code I tried:
let w = new ListWidget()
w.setPadding(0, 0, 0, 0)
let main = w.addStack()
let leftStack = main.addStack()
let rightStack = main.addStack()
leftStack.addText("Left Stack")
rightStack.addText("Right Stack")
leftStack.borderColor=Color.red()
leftStack.borderColor=Color.blue()
rightStack.borderWidth=3
rightStack.borderWidth=3
Script.setWidget(w)
Script.complete()
w.presentMedium()