ios – SwiftUI ScrollView margins of every merchandise have elevated and can’t be decreased

Spread the love


enter picture description right here

After I use this technique, the margins in my venture have elevated. I do not know the right way to deal with it.
After I use this technique, the margins in my venture have elevated. I do not know the right way to deal with it.
After I use this technique, the margins in my venture have elevated. I do not know the right way to deal with it.
After I use this technique, the margins in my venture have elevated. I do not know the right way to deal with it.
After I use this technique, the margins in my venture have elevated. I do not know the right way to deal with it.
After I use this technique, the margins in my venture have elevated. I do not know the right way to deal with it.

//

//  ContentView.swift

//  icbo2

//

//  Created by 张潇 on 2023/9/30.

//



import SwiftUI







struct ContentView: View {

    var physique: some View {

        NavigationStack{

            VStack(spacing: 0){

                Divider()

                

                HStack{

                    Textual content("当页人民币汇总")

                        .padding(.main, 10.0)

                        .font(.system(measurement: 15))

                    

                    ZStack{

                        Textual content("收: +55,")

                            .foregroundColor(Colour(UIColor(displayP3Red: 206/255, inexperienced: 64/255, blue: 54/255, alpha: 1)))

                            .font(.system(measurement:14))

                            .padding(.trailing,20)

                        Textual content("345.45")

                            .foregroundColor(Colour(UIColor(displayP3Red: 206/255, inexperienced: 64/255, blue: 54/255, alpha: 1)))

                            .font(.system(measurement:14))

                            .padding(.main,65)

                        

                    }

                    

                    Textual content("支: -0.00")

                        .foregroundColor(Colour.grey)

                        .padding(.main, 30.0)

                        .font(.system(measurement:14))

                    Spacer()

                    

                }

                .padding(.vertical, 7.0)

                

                ScrollView(){

                    singer(date:"2023年10月",date_number_one: "21", date_number:"10",week:"周二",week_one: "周六",shouru_lixi:"+0.13",shouru: "+14,",xiaoshu: "379.60",whole:"16,",yue:"13.07",wan: "051.08",pad:5.0,pa:5.0)

                    Divider()

                        .padding(.main, 50.0)

                    

                    singer(date:"2023年09月",date_number_one: "21", date_number:"11",week:"周一",week_one: "周四",shouru_lixi:"+0.13",shouru: "+14,",xiaoshu: "379.60",whole:"16,",yue:"13.07",wan: "051.08",pad:5.0,pa:13.0)

                    Divider()

                        .padding(.main, 50.0)

                    

                    singer(date:"2023年08月",date_number_one: "21", date_number:"11",week:"周一",week_one: "周四",shouru_lixi:"+0.13",shouru: "+14,",xiaoshu: "379.60",whole:"16,",yue:"13.07",wan: "051.08",pad:5.0,pa:13.0)

                    Divider()

                        .padding(.main, 50.0)

                    

                    singer(date:"2023年07月",date_number_one: "21", date_number:"11",week:"周一",week_one: "周四",shouru_lixi:"+0.13",shouru: "+14,",xiaoshu: "379.60",whole:"16,",yue:"13.07",wan: "051.08",pad:5.0,pa:13.0)

                    Divider()

                        .padding(.main, 50.0)

                    

                    singer(date:"2023年06月",date_number_one: "21", date_number:"11",week:"周一",week_one: "周四",shouru_lixi:"+0.13",shouru: "+14,",xiaoshu: "379.60",whole:"16,",yue:"13.07",wan: "051.08",pad:5.0,pa:13.0)

                    Divider()

                        .padding(.main, 50.0)

                    

                    

                    

                    

                    

                    

                    

                    

                    

                    

                    Spacer()

                    

                    

                }

            }

            

            .navigationBarTitleDisplayMode(.inline)

            // 自定义导航栏标题内容

            .toolbar {

                ToolbarItem(placement: .principal) {

                    VStack {

                        Textual content("查询明细").fontWeight(.common)

                            .foregroundColor(Colour(UIColor(displayP3Red: 96/255, inexperienced: 116/255, blue: 131/255, alpha: 1))).padding(.backside, 2).font(.system(measurement: 20))

                    }

                }

            }

            .navigationBarItems(

            main: Button(motion: {},

            label: {

                Picture(systemName: "chevron.left")

                    .foregroundColor(Colour(UIColor(displayP3Red: 96/255, inexperienced: 116/255, blue: 131/255, alpha: 1)))

            }

                            

            ),

            trailing: Button(motion: {}, label:{Textual content("我的账户")

                .foregroundColor(Colour(UIColor(displayP3Red: 96/255, inexperienced: 116/255, blue: 131/255, alpha: 1)))}))

            

        }

    }

}



struct singer: View{

    var date: String = ""

    var date_number_one: String=""

    var date_number: String = ""

    var week: String = ""

    var week_one: String = ""

    var shouru_lixi: String = ""

    var shouru: String = ""

    var xiaoshu: String = ""

    var whole: String = ""

    var yue: String = ""

    var wan: String = ""

    var pad: Double=0

    var pa: Double=0

    var physique: some View{

        

        HStack{

            Textual content(self.date)

                .fontWeight(.common)

                .font(.system(measurement:19))

                

                .padding(.high,self.pad)

                .padding(.backside,3.0)

                .padding(.high,self.pa)

                .padding(.main,8.0)

                

            Spacer()

        }.background(Colour(UIColor(displayP3Red: 245/255, inexperienced: 245/255, blue: 245/255, alpha: 1)))

        HStack{

            Textual content(self.date_number_one)

                .font(.system(measurement: 23))

                .foregroundColor(Colour(UIColor(displayP3Red: 96/255, inexperienced: 116/255, blue: 131/255, alpha: 1)))

                .multilineTextAlignment(.middle)

                .padding(.horizontal, 15.0)

            

            Textual content("利息")

                .multilineTextAlignment(.middle)

                .font(.system(measurement:15))

                .foregroundColor(Colour(UIColor(displayP3Red: 51/255, inexperienced: 51/255, blue: 51/255, alpha: 1)))

            Spacer()



                Textual content(self.shouru_lixi)

                .foregroundColor(Colour(UIColor(displayP3Red: 206/255, inexperienced: 64/255, blue: 54/255, alpha: 1)))



            .padding(.trailing,15)

            

        }

        HStack{

            Textual content(self.week_one)

                .font(.system(measurement: 12))

                .foregroundColor(Colour(UIColor(displayP3Red: 96/255, inexperienced: 116/255, blue: 131/255, alpha: 1)))

                .padding(.horizontal, 15.0)

            

            Textual content("批量业务").font(.system(measurement: 13))

                .foregroundColor(Colour(UIColor(displayP3Red: 96/255, inexperienced: 116/255, blue: 131/255, alpha: 1)))

            Spacer()

            

            

            ZStack{

                Textual content("余额:"+self.yue)

                    .font(.system(measurement: 12))

                    .foregroundColor(Colour(UIColor(displayP3Red: 96/255, inexperienced: 116/255, blue: 131/255, alpha: 1)))

                

                

            }.padding(.trailing,15)

        }

            Divider()

            HStack{

                Textual content(self.date_number)

                    .font(.system(measurement: 23))

                    .foregroundColor(Colour(UIColor(displayP3Red: 96/255, inexperienced: 116/255, blue: 131/255, alpha: 1)))

                    .multilineTextAlignment(.middle)

                    .padding(.horizontal, 15.0)

                

                Textual content("他行汇入")

                    .multilineTextAlignment(.middle)

                    .font(.system(measurement:15))

                    .foregroundColor(Colour(UIColor(displayP3Red: 51/255, inexperienced: 51/255, blue: 51/255, alpha: 1)))

                Spacer()

                

                ZStack{

                    Textual content(self.shouru)

                        .foregroundColor(Colour(UIColor(displayP3Red: 206/255, inexperienced: 64/255, blue: 54/255, alpha: 1)))

                    Textual content(self.xiaoshu).padding(.main,70)

                        .foregroundColor(Colour(UIColor(displayP3Red: 206/255, inexperienced: 64/255, blue: 54/255, alpha: 1)))

                }

                .padding(.trailing,15)

            }

            HStack{

                Textual content(self.week)

                    .font(.system(measurement: 12))

                    .foregroundColor(Colour(UIColor(displayP3Red: 96/255, inexperienced: 116/255, blue: 131/255, alpha: 1)))

                    .padding(.horizontal, 15.0)

                

                Textual content("xxx科技有限公司").font(.system(measurement: 13))

                    .foregroundColor(Colour(UIColor(displayP3Red: 96/255, inexperienced: 116/255, blue: 131/255, alpha: 1)))

                Spacer()

                

                

                ZStack{

                    Textual content("余额:"+self.whole)

                        .font(.system(measurement: 12))

                        .foregroundColor(Colour(UIColor(displayP3Red: 96/255, inexperienced: 116/255, blue: 131/255, alpha: 1)))

                    

                    Textual content(self.wan)

                        .font(.system(measurement: 12))

                        .foregroundColor(Colour(UIColor(displayP3Red: 96/255, inexperienced: 116/255, blue: 131/255, alpha: 1)))

                        .padding(.main,80)

                    

                }.padding(.trailing,15)

            }

        .padding(.backside, 3.0)

        

    }

}



struct ContentView_Previews: PreviewProvider {

static var previews: some View {

ContentView()

}

}

After I use this technique, the margins in my venture have elevated. I do not know the right way to deal with it

I do not know the place to set or add any attributes

Leave a Reply

Your email address will not be published. Required fields are marked *