Changing picker style

pull/11/head
Johan LACHENAL 11 months ago
parent 2154d4401e
commit 1962e025bf

@ -19,28 +19,31 @@ struct DoushiQiPicker<EnumType: RawRepresentable & Identifiable & Hashable>: Vie
} }
var body: some View { var body: some View {
Menu { VStack(spacing: 0) {
Picker(title, selection: $selectedOption) { Divider().background(Color.gray)
ForEach(options) { option in Menu {
Text(option.rawValue.description) Picker(title, selection: $selectedOption) {
ForEach(options) { option in
Text(option.rawValue.description)
.padding()
}
} }
.labelsHidden()
.pickerStyle(InlinePickerStyle())
} label: {
HStack {
Text(title)
.foregroundColor(.black)
.padding()
Spacer()
Text(selectedOption.rawValue.description)
.foregroundColor(.black)
.padding()
}
.frame(maxWidth: .infinity)
.padding(EdgeInsets(top: 0, leading: 32, bottom: 0, trailing: 32))
} }
.labelsHidden() Divider().background(Color.gray)
.pickerStyle(InlinePickerStyle())
} label: {
HStack {
Text(title)
.foregroundColor(.white)
.padding()
Spacer()
Text(selectedOption.rawValue.description)
.foregroundColor(.white)
.padding()
}
.frame(maxWidth: .infinity)
.padding(EdgeInsets(top: 10, leading: 32, bottom: 10, trailing: 32))
.background(Color.black)
.clipShape(Capsule())
} }
} }
} }

@ -17,7 +17,7 @@ struct MainMenuButton<Content : View>: View {
} }
var body: some View { var body: some View {
NavigationLink(title){ NavigationLink("parties enregistrées"){
// ici mettre la vue sur les parties enregistrées à la place du texte n'hésite pas à tester sur la preview la navigation ça marche, faire pareil pour les autres // ici mettre la vue sur les parties enregistrées à la place du texte n'hésite pas à tester sur la preview la navigation ça marche, faire pareil pour les autres
content content
} }
@ -29,6 +29,7 @@ struct MainMenuButton<Content : View>: View {
.background(.black) .background(.black)
.buttonBorderShape(.roundedRectangle) .buttonBorderShape(.roundedRectangle)
.clipShape(Capsule()) .clipShape(Capsule())
Spacer().frame(height: 50)
} }
} }

@ -22,7 +22,7 @@ enum Language: String, CaseIterable, Identifiable, Hashable {
} }
enum Rules: String, CaseIterable, Identifiable, Hashable { enum Rules: String, CaseIterable, Identifiable, Hashable {
case Easy = "Simple" case Easy = "Simplifié"
case Regular = "Normal" case Regular = "Normal"
var id: String { self.rawValue } var id: String { self.rawValue }
} }
@ -32,7 +32,7 @@ struct ParametersMenuView: View {
@State private var selectedLanguageOption: Language = .French @State private var selectedLanguageOption: Language = .French
@State private var selectedRulesOption: Rules = .Regular @State private var selectedRulesOption: Rules = .Regular
var body: some View { var body: some View {
VStack { VStack(alignment: .leading) {
ToggleView() ToggleView()
DoushiQiPicker(title: "Sélectionne une IA :", DoushiQiPicker(title: "Sélectionne une IA :",
selectedOption: $selectedAIOption, selectedOption: $selectedAIOption,
@ -44,7 +44,7 @@ struct ParametersMenuView: View {
selectedOption: $selectedRulesOption, selectedOption: $selectedRulesOption,
options: Rules.allCases) options: Rules.allCases)
} }.frame(maxHeight: .infinity, alignment: .top)
} }
} }

Loading…
Cancel
Save