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,15 +161,15 @@ struct CreateIconView: View {
} }
Spacer() Spacer()
} }
.padding()
.background(
Color(uiColor: theme.currentTheme.secondaryBGColor)
)
} }
.frame(height: 5)
.padding([.leading, .trailing])
.padding([.top, .bottom], 10)
Group {
Divider().background(Color(UIColor.tertiarySystemBackground)) Divider().background(Color(UIColor.tertiarySystemBackground))
VStack{ Group {
HStack { HStack {
ForEach(BackGroundOptions.selectable, id: \.self) { bg in ForEach(BackGroundOptions.selectable, id: \.self) { bg in
Image(bg.rawValue, bundle: .main) Image(bg.rawValue, bundle: .main)
@@ -189,64 +189,72 @@ struct CreateIconView: View {
ColorPicker("", selection: $customIcon.bgOverlayColor) ColorPicker("", selection: $customIcon.bgOverlayColor)
} }
.padding()
.background(
Color(uiColor: theme.currentTheme.secondaryBGColor)
)
} }
}
.padding([.leading, .trailing])
.padding([.top, .bottom], 10)
Group {
Divider().background(Color(UIColor.tertiarySystemBackground)) Divider().background(Color(UIColor.tertiarySystemBackground))
HStack { Group {
Spacer() VStack {
HStack(spacing: 0) {
VStack(alignment: .center) { VStack(alignment: .center) {
Text("background") Text("background")
ColorPicker("", selection: $customIcon.bgColor) ColorPicker("", selection: $customIcon.bgColor)
.labelsHidden() .labelsHidden()
} }
Spacer() .frame(minWidth: 0, maxWidth: .infinity)
VStack(alignment: .center) { VStack(alignment: .center) {
Text("Inner") Text("Inner")
ColorPicker("", selection: $customIcon.innerColor) ColorPicker("", selection: $customIcon.innerColor)
.labelsHidden() .labelsHidden()
} }
Spacer() .frame(minWidth: 0, maxWidth: .infinity)
VStack(alignment: .center) { VStack(alignment: .center) {
Text("Face Outline") Text("Face Outline")
ColorPicker("", selection: $customIcon.circleStrokeColor) ColorPicker("", selection: $customIcon.circleStrokeColor)
.labelsHidden() .labelsHidden()
} }
Spacer() .frame(minWidth: 0, maxWidth: .infinity)
} }
HStack { HStack(spacing: 0) {
Spacer()
VStack(alignment: .center) { VStack(alignment: .center) {
Text("Left Eye") Text("Left Eye")
ColorPicker("", selection: $customIcon.leftEyeColor) ColorPicker("", selection: $customIcon.leftEyeColor)
.labelsHidden() .labelsHidden()
} }
Spacer() .frame(minWidth: 0, maxWidth: .infinity)
VStack(alignment: .center) { VStack(alignment: .center) {
Text("right eye") Text("right eye")
ColorPicker("", selection: $customIcon.rightEyeColor) ColorPicker("", selection: $customIcon.rightEyeColor)
.labelsHidden() .labelsHidden()
} }
Spacer() .frame(minWidth: 0, maxWidth: .infinity)
VStack(alignment: .center) { VStack(alignment: .center) {
Text("mouth") Text("mouth")
ColorPicker("", selection: $customIcon.mouthColor) ColorPicker("", selection: $customIcon.mouthColor)
.labelsHidden() .labelsHidden()
} }
Spacer() .frame(minWidth: 0, maxWidth: .infinity)
} }
} }
.padding([.leading, .trailing]) .padding()
.padding([.top, .bottom], 10) .background(
Color(uiColor: theme.currentTheme.secondaryBGColor)
)
}
Group {
Divider().background(Color(UIColor.tertiarySystemBackground)) Divider().background(Color(UIColor.tertiarySystemBackground))
Group {
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 {
Group {
CreateIconView() CreateIconView()
CreateIconView()
.preferredColorScheme(.dark)
}
} }
} }