Code: here i have used home_bg
as a background for scrollview and i made 50 corner radious for top leading and trailing now i need only top background image border woth green colour how?
and in my Favourits i need small design change.. i need 4 items horizontally with equal spaces between them but i need favCell > Text(item.title ?? "")
should be as possible in one line. now for small word also it showing in two line.. plz guide me to fix
Need like this border on home_bg
with corner radious
and need some change in favCell like this not shadow and all just need spaces b/w each item and title text line like this
struct HomeNew: View {
var body: some View {
ZStack{
Color.white
.ignoresSafeArea()
VStack{
VStack{
HStack(alignment: .top) {
URLImageView(url: userPhoto.percentageEncoding(), placeholder: "NoProfilePic", width: 80, height: 80)
.cornerRadius(15)
.scaledToFit()
.overlay(
RoundedRectangle(cornerRadius: 15)
.stroke(Color.green, lineWidth: 2)
)
.onTapGesture {
gotoProfile = true
}
VStack(spacing: 4) {
Text("Welcome")
.font(.calibriRegular(with: 20))
.foregroundColor(.gray)
}
.foregroundStyle(.white)
Spacer()
}
.padding(16)
}
ScrollView {
VStack(spacing: 0) {
VStack(spacing: 0) {
//somecode for widget
}
favView()
.padding(.bottom, 30)
}
}
.background(
Image("home_bg")
.resizable()
.scaledToFill()
)
.contentShape(.rect)
.clipShape(
.rect(
topLeadingRadius: 50,
bottomLeadingRadius: 0,
bottomTrailingRadius: 0,
topTrailingRadius: 50
)
)
.padding(.bottom, -60)
VStack {
ZStack {
Color.appGreen2
Spacer()
ZStack {
Color.white
HStack {
//code for search
}
.padding()
}
.frame(height: 45)
.cornerRadius(30)
.padding()
.padding(.top, 30)
}
.frame(height: 160)
.clipShape(TopProtractorCurveShape())
}
}
}
@ViewBuilder func favView() -> some View {
VStack {
Text("Favourites")
.font(.calibriRegular(with: 24))
.foregroundStyle(Color(hex: 0x272A2C))
LazyVGrid(columns: [
GridItem(.flexible(), spacing: 20),
GridItem(.flexible(), spacing: 20),
GridItem(.flexible(), spacing: 20),
GridItem(.flexible(), spacing: 20)
], spacing: 20) { // Increased spacing between items
ForEach(0..<favMenu.count + 1, id: .self) { ind in
if (ind == favMenu.count) {
} else {
favoriteButton(for: ind)
}
}
}
.padding(.top, 16)
}
.padding(.top, 35)
.padding(.horizontal, 24)
}
@ViewBuilder func favoriteButton(for index: Int) -> some View {
Button {
} label: {
favCell(item: favMenu[index], index: index)
}
.buttonStyle(.plain)
}
@ViewBuilder func favCell(item: AllMenu, index: Int) -> some View {
VStack(spacing: 10) { // Increased spacing between image and text
VStack(spacing: 0) {
URLImageView(url: item.icon ?? "", width: 25, height: 25, renderingMode: .template, tintColor: .appGreen)
.frame(width: 25, height: 25)
.padding()
}
.frame(width: 60, height: 60)
.background(Color.white)
.clipShape(RoundedRectangle(cornerRadius: 13))
.overlay {
RoundedRectangle(cornerRadius: 10)
.stroke(Color.hexDFE5DB)
}
Text(item.title ?? "")
.font(.calibriRegular(with: 12))
.foregroundColor(.black)
.lineLimit(2)
.multilineTextAlignment(.center)
.frame(maxWidth: 50)
.padding(.horizontal, 4)
}
}
}
}
o/p: here fav cell small title also showing in two lines so plz adjuest my favCell