layout on create icon view

haptic feedback when saving
This commit is contained in:
Trey t
2022-02-15 10:50:32 -06:00
parent fce13af84e
commit 8076254d3d

View File

@@ -116,10 +116,10 @@ struct CreateIconView: View {
Spacer() Spacer()
Group { Divider().background(Color(UIColor.tertiarySystemBackground))
Divider().background(Color(UIColor.tertiarySystemBackground))
HStack { Group {
HStack(alignment: .center) {
Spacer() Spacer()
VStack(alignment: .center) { VStack(alignment: .center) {
Menu("Left Eye") { Menu("Left Eye") {
@@ -161,92 +161,100 @@ struct CreateIconView: View {
} }
Spacer() Spacer()
} }
.padding()
.background(
Color(uiColor: theme.currentTheme.secondaryBGColor)
)
} }
.frame(height: 5)
.padding([.leading, .trailing]) Divider().background(Color(UIColor.tertiarySystemBackground))
.padding([.top, .bottom], 10)
Group { Group {
Divider().background(Color(UIColor.tertiarySystemBackground)) HStack {
ForEach(BackGroundOptions.selectable, id: \.self) { bg in
VStack{ Image(bg.rawValue, bundle: .main)
HStack { .resizable()
ForEach(BackGroundOptions.selectable, id: \.self) { bg in .aspectRatio(contentMode: .fill)
Image(bg.rawValue, bundle: .main) .frame(minWidth: 10, idealWidth: 40, maxWidth: 40,
.resizable() minHeight: 10, idealHeight: 40, maxHeight: 40,
.aspectRatio(contentMode: .fill) alignment: .center)
.frame(minWidth: 10, idealWidth: 40, maxWidth: 40,
minHeight: 10, idealHeight: 40, maxHeight: 40,
alignment: .center)
.onTapGesture {
update(background: bg)
}
}
mixBG
.onTapGesture { .onTapGesture {
update(background: .random) update(background: bg)
} }
ColorPicker("", selection: $customIcon.bgOverlayColor)
} }
mixBG
.onTapGesture {
update(background: .random)
}
ColorPicker("", selection: $customIcon.bgOverlayColor)
} }
.padding()
.background(
Color(uiColor: theme.currentTheme.secondaryBGColor)
)
} }
.padding([.leading, .trailing])
.padding([.top, .bottom], 10)
Divider().background(Color(UIColor.tertiarySystemBackground))
Group { Group {
Divider().background(Color(UIColor.tertiarySystemBackground)) VStack {
HStack(spacing: 0) {
VStack(alignment: .center) {
Text("background")
ColorPicker("", selection: $customIcon.bgColor)
.labelsHidden()
}
.frame(minWidth: 0, maxWidth: .infinity)
HStack { VStack(alignment: .center) {
Spacer() Text("Inner")
VStack(alignment: .center) { ColorPicker("", selection: $customIcon.innerColor)
Text("background") .labelsHidden()
ColorPicker("", selection: $customIcon.bgColor) }
.labelsHidden() .frame(minWidth: 0, maxWidth: .infinity)
}
Spacer()
VStack(alignment: .center) {
Text("Inner")
ColorPicker("", selection: $customIcon.innerColor)
.labelsHidden()
}
Spacer()
VStack(alignment: .center) {
Text("Face Outline")
ColorPicker("", selection: $customIcon.circleStrokeColor)
.labelsHidden()
}
Spacer()
}
HStack { VStack(alignment: .center) {
Spacer() Text("Face Outline")
VStack(alignment: .center) { ColorPicker("", selection: $customIcon.circleStrokeColor)
Text("Left Eye") .labelsHidden()
ColorPicker("", selection: $customIcon.leftEyeColor) }
.labelsHidden() .frame(minWidth: 0, maxWidth: .infinity)
} }
Spacer()
VStack(alignment: .center) { HStack(spacing: 0) {
Text("right eye") VStack(alignment: .center) {
ColorPicker("", selection: $customIcon.rightEyeColor) Text("Left Eye")
.labelsHidden() ColorPicker("", selection: $customIcon.leftEyeColor)
.labelsHidden()
}
.frame(minWidth: 0, maxWidth: .infinity)
VStack(alignment: .center) {
Text("right eye")
ColorPicker("", selection: $customIcon.rightEyeColor)
.labelsHidden()
}
.frame(minWidth: 0, maxWidth: .infinity)
VStack(alignment: .center) {
Text("mouth")
ColorPicker("", selection: $customIcon.mouthColor)
.labelsHidden()
}
.frame(minWidth: 0, maxWidth: .infinity)
} }
Spacer()
VStack(alignment: .center) {
Text("mouth")
ColorPicker("", selection: $customIcon.mouthColor)
.labelsHidden()
}
Spacer()
} }
.padding()
.background(
Color(uiColor: theme.currentTheme.secondaryBGColor)
)
} }
.padding([.leading, .trailing])
.padding([.top, .bottom], 10) Divider().background(Color(UIColor.tertiarySystemBackground))
Group { Group {
Divider().background(Color(UIColor.tertiarySystemBackground))
HStack(alignment: .center, spacing: 0) { HStack(alignment: .center, spacing: 0) {
Button(action: { Button(action: {
createRandom() createRandom()
@@ -267,6 +275,9 @@ struct CreateIconView: View {
let icon = bigIconView.snapshot() let icon = bigIconView.snapshot()
if let data = icon.pngData() { if let data = icon.pngData() {
savedCustomIcon = data savedCustomIcon = data
let impactMed = UIImpactFeedbackGenerator(style: .heavy)
impactMed.impactOccurred()
} }
}, label: { }, label: {
Text("Save") Text("Save")
@@ -285,6 +296,11 @@ struct CreateIconView: View {
struct CreateIconView_Previews: PreviewProvider { struct CreateIconView_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
CreateIconView() Group {
CreateIconView()
CreateIconView()
.preferredColorScheme(.dark)
}
} }
} }