comparison GeoQuiz/ContentView.swift @ 10:a793f33f05fb

refactor code and fix layout
author Dennis C. M. <dennis@denniscm.com>
date Sat, 08 Oct 2022 21:36:40 +0200
parents e09959b4e4a8
children 039b26a99a48
comparison
equal deleted inserted replaced
9:3540c7efc216 10:a793f33f05fb
12 @State private var showingSettingsModalView = false 12 @State private var showingSettingsModalView = false
13 13
14 var body: some View { 14 var body: some View {
15 NavigationView { 15 NavigationView {
16 ScrollView(showsIndicators: false) { 16 ScrollView(showsIndicators: false) {
17 VStack(spacing: 20) { 17 VStack(alignment: .leading, spacing: 20) {
18
19 Text("Select a game 🎮")
20 .font(.largeTitle.bold())
21 .padding(.bottom)
18 22
19 NavigationLink(destination: GuessTheFlagView()) { 23 NavigationLink(destination: GuessTheFlagView()) {
20 GameButton( 24 GameButton(
21 gradient: .main, 25 gradient: .main,
22 level: "Level 1", symbol: "flag.fill", name: "Guess the flag" 26 level: "Level 1", symbol: "flag.fill", name: "Guess the flag"
34 GameButton( 38 GameButton(
35 gradient: .tertiary, 39 gradient: .tertiary,
36 level: "Level 3", symbol: "globe.americas.fill", name: "Guess the country" 40 level: "Level 3", symbol: "globe.americas.fill", name: "Guess the country"
37 ) 41 )
38 } 42 }
39 43
40 // NavigationLink( 44 NavigationLink(destination: GuessThePopulationView()) {
41 // destination: Text("Guess the population"), 45 GameButton(
42 // tag: GameName.guessThePopulation, 46 gradient: .quaternary,
43 // selection: $gameName 47 level: "Level 4", symbol: "person.fill", name: "Guess the population"
44 // ) { 48 )
45 // GameButton( 49 }
46 // gradient: .quaternary,
47 // level: "Level 4", symbol: "person.3.fill", name: "Guess the population"
48 // )
49 // }
50 } 50 }
51 .padding() 51 .padding()
52 } 52 }
53 .navigationTitle("Select a game 🎮") 53 .navigationTitle("GeoQuiz")
54 .navigationBarTitleDisplayMode(.inline)
54 .toolbar { 55 .toolbar {
55 ToolbarItem(placement: .navigationBarLeading) { 56 ToolbarItem(placement: .navigationBarLeading) {
56 Button { 57 Button {
57 showingSettingsModalView = true 58 showingSettingsModalView = true
58 } label: { 59 } label: {