Steve Tardell
Steve Tardell

Reputation: 1

Changing font size in drop-down picker

Below are three snippets in my code. The font sizes do not change in the picker drop-down values (holeRow). The font type and size work everywhere else in my code.

  private func headerRow() -> some View {
        HStack(spacing: 0) {
            Text("HOLE")
                .font(.custom("Metropolis-SemiBold", size: 12))
                .frame(width: 60, height: 25)
                .background(Color("PGA_Dark_Cerulean"))
                .foregroundColor(.white)
                .border(Color.gray, width: 0.25)
            Text("PAR")
                .font(.custom("Metropolis-SemiBold", size: 12))
                .frame(width: 50, height: 25)
                .background(Color("PGA_Carmine_Pink"))
                .foregroundColor(.white)
                .border(Color.gray, width: 0.25)
            ForEach(golfers.indices, id: \.self) { index in
                Text(golfers[index].name)
                    .font(.custom("Metropolis-SemiBold", size: 12))
                    .frame(width: 72, height: 25)
                    .background(Color("PGA_Carmine_Pink"))
                    .foregroundColor(.white)
                    .border(Color.gray, width: 0.25)
            }
        }
    }

    private func holeRow(hole: Int) -> some View {
        HStack(spacing: 0) {
            Text("\(hole + 1)")
                .font(.custom("Metropolis-SemiBold", size: 12))
                .frame(width: 60, height: 25)
                .background(Color("PGA_Dark_Cerulean"))
                .foregroundColor(.white)
                .border(Color.gray, width: 0.25)
            Picker("", selection: $parValues[hole]) {
                ForEach(0..<6) { value in
                    Text("\(value)")
                        .font(.custom("Metropolis-SemiBold", size: 12))
                        .foregroundColor(Color("PGA_Dark_Cerulean"))
                        .tag(value)
                }
            }
            .pickerStyle(MenuPickerStyle())
            .frame(width: 50, height: 25)
            .background(Color.white)
            .border(Color("PGA_Dark_Cerulean"), width: 0.25)

            ForEach(golfers.indices, id: \.self) { golferIndex in
                Picker("", selection: $scores[golferIndex][hole]) {
                    ForEach(0..<11) { value in
                        Text("\(value)")
                            .font(.custom("Metropolis-SemiBold", size: 12))
                            .foregroundColor(Color("PGA_Dark_Cerulean"))
                            .tag(value)
                    }
                }
                .pickerStyle(MenuPickerStyle())
                .frame(width: 72, height: 25)
                .background(Color.white)
                .border(Color("PGA_Dark_Cerulean"), width: 0.25)
            }
        }
    }

    private func summaryRow(title: String, total: @escaping () -> Int) -> some View {
        let totalValue = total()
        return HStack(spacing: 0) {
            Text(title)
                .font(.custom("Metropolis-SemiBold", size: 12))
                .frame(width: 60, height: 25)
                .background(Color("PGA_Dark_Cerulean"))
                .foregroundColor(.white)
                .border(Color.gray, width: 0.25)
            Text("\(totalValue)")
                .font(.custom("Metropolis-SemiBold", size: 12))
                .frame(width: 50, height: 25)
                .background(Color.white)
                .foregroundColor(Color("PGA_Dark_Cerulean"))
                .border(Color("PGA_Dark_Cerulean"), width: 0.25)
            ForEach(golfers.indices, id: \.self) { golferIndex in
                let golferTotal = totalGolfer(for: golferIndex)
                Text("\(golferTotal)")
                    .font(.custom("Metropolis-SemiBold", size: 12))
                    .frame(width: 72, height: 25)
                    .background(Color.white)
                    .foregroundColor(Color("PGA_Dark_Cerulean"))
                    .border(Color("PGA_Dark_Cerulean"), width: 0.25)
            }

I have researched the problem and used AI, but so far I have not been able to correct the font type/size.

Upvotes: 0

Views: 44

Answers (0)

Related Questions