Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

134
Visualizações
slider is move to the top when i use HStack

The slider is move to the top when i use HStack, VStack is work well, any ideas?

struct LockerSlider<V>: View where V : BinaryFloatingPoint, V.Stride : BinaryFloatingPoint {
var body: some View {
        GeometryReader { proxy in
            ZStack(alignment: .leading) {
                RoundedRectangle(cornerRadius: 15)
                    .frame(height: 30)
                
                RoundedRectangle(cornerRadius: 15)
                .frame(width:(proxy.size.width - 30) * ratio + 30,height: 30)
                Circle()
                    .frame(width: 50, height: 50)
                    .offset(x: (proxy.size.width - 30) * ratio)
                    .gesture(DragGesture(minimumDistance: 0)
                    .onChanged({ updateStatus(value: $0, proxy: proxy)
                    })
                                .onEnded { _ in startX = nil
                    
            }
            .frame(height: 30)
            .simultaneousGesture(DragGesture(minimumDistance: 0)
                                    .onChanged({ update(value: $0, proxy: proxy) }))
            .onAppear {
                ratio = min(1, max(0,CGFloat(value / bounds.upperBound)))
            }
        }
    }
}
HStack{
      Text("Custom Slider")
      LockerSlider(value: $number, in: 0...1050000, step: 0.02, length: 15,ball: 30, onEditingChanged: { _ in
      print("111")
                })
            }

when i use HStack,the slider is moving to the top areas,and i missing something?

enter image description here

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda