let bgView = View.bg(UIColor.c_mask_b)
let contentView = View.bg("white").radius(Specs.metric.cornerRadius).pin(.center)
contentView.addTo(bgView).makeCons({ (make) in
make.right.equal(bgView).offset(Specs.metric.ratioMargin)
make.right.equal(bgView).offset(-Specs.metric.ratioMargin)
make.center.equal(bgView)
})
var stacks = [Any]()
for (index, desc) in descs.enumerated() {
var text = "\(index+1)"
if !firstHasNo {
text = "\(index)"
}
let icon = Button
.bg(UIColor.c_tint)
.str(text)
.color("white")
.font(Specs.font.small)
.pin(.wh(16, 16))
.radius(8)
let label = Label
.str(desc)
.lines(0)
.font(Specs.font.small)
.color(UIColor.c_title)
if !firstHasNo && index == 0 {
stacks.append(
HStack(label).align(.top)
)
} else {
stacks.append(
HStack(icon ,label).gap(Specs.metric.marginTen).align(.top)
)
}
stacks.append(Specs.metric.marginTen)
}
let imgView = ImageView
.bg("gray")
.pin(.whRatio(1.86))
let imgStack = HStack(Specs.metric.ratioMargin, imgView, Specs.metric.ratioMargin)
let sureButton = Button
.str("Được").color("white").font(Specs.font.llarge)
.bg(UIColor.c_tint)
.radius(Specs.metric.cornerRadius)
.pin(.h(44.0))
let buttonStack = HStack(sureButton)
VStack(imgStack,
Specs.metric.ratioMargin,
stacks,
Specs.metric.ratioMargin,
buttonStack
)
.embedIn(contentView, Specs.metric.ratioMargin)
.align(.fill)
bgView.embedIn(UIApplication.shared.keyWindow!)
bgView.setNeedsLayout()
bgView.layoutIfNeeded()