From f59d00016b12166a185a61997e9d26f24745acd8 Mon Sep 17 00:00:00 2001 From: Vladimir Dubovik Date: Mon, 9 Dec 2024 12:55:01 +0300 Subject: [PATCH] Commit --- Schedule ICTIS/Main/ScheduleView.swift | 77 ++++++++++++++------------ 1 file changed, 42 insertions(+), 35 deletions(-) diff --git a/Schedule ICTIS/Main/ScheduleView.swift b/Schedule ICTIS/Main/ScheduleView.swift index 6f34a3b..3bcac4c 100644 --- a/Schedule ICTIS/Main/ScheduleView.swift +++ b/Schedule ICTIS/Main/ScheduleView.swift @@ -10,48 +10,55 @@ import SwiftUI struct ScheduleView: View { @ObservedObject var vm: ViewModel var body: some View { - ScrollView(.vertical, showsIndicators: false) { - VStack (spacing: 20) { - ForEach(vm.classes.indices, id: \.self) { index in - if index != 0 && index != 1 && index == vm.selectedIndex { - let daySchedule = vm.classes[index] // Это массив строк для дня - ForEach(daySchedule.indices.dropFirst(), id: \.self) { lessonIndex in - let lesson = daySchedule[lessonIndex] // Это строка с расписанием одной пары - if !lesson.isEmpty { - HStack(spacing: 10) { - VStack { - Text(convertTimeString(vm.classes[1][lessonIndex])[0]) - .font(.system(size: 15, weight: .regular)) - Text(convertTimeString(vm.classes[1][lessonIndex])[1]) - .font(.system(size: 15, weight: .regular)) + ZStack (alignment: .top) { + ScrollView(.vertical, showsIndicators: false) { + VStack (spacing: 20) { + ForEach(vm.classes.indices, id: \.self) { index in + if index != 0 && index != 1 && index == vm.selectedIndex { + let daySchedule = vm.classes[index] // Это массив строк для дня + ForEach(daySchedule.indices.dropFirst(), id: \.self) { lessonIndex in + let lesson = daySchedule[lessonIndex] // Это строка с расписанием одной пары + if !lesson.isEmpty { + HStack(spacing: 10) { + VStack { + Text(convertTimeString(vm.classes[1][lessonIndex])[0]) + .font(.system(size: 15, weight: .regular)) + Text(convertTimeString(vm.classes[1][lessonIndex])[1]) + .font(.system(size: 15, weight: .regular)) + } + .padding(.top, 7) + .padding(.bottom, 7) + .padding(.leading, 10) + Rectangle() + .frame(width: 2) + .frame(maxHeight: UIScreen.main.bounds.height - 18) + .padding(.top, 7) + .padding(.bottom, 7) + .foregroundColor(onlineOrOffline(lesson) ? Color("greenForOffline") : Color("blueForOnline")) + Text(lesson) + .font(.system(size: 18, weight: .regular)) + .padding(.top, 7) + .padding(.bottom, 7) + Spacer() } - .padding(.top, 7) - .padding(.bottom, 7) - .padding(.leading, 10) - Rectangle() - .frame(width: 2) - .frame(maxHeight: UIScreen.main.bounds.height - 18) - .padding(.top, 7) - .padding(.bottom, 7) - .foregroundColor(onlineOrOffline(lesson) ? Color("greenForOffline") : Color("blueForOnline")) - Text(lesson) - .font(.system(size: 18, weight: .regular)) - .padding(.top, 7) - .padding(.bottom, 7) - Spacer() + .frame(maxWidth: UIScreen.main.bounds.width - 40, maxHeight: 230) + .background(Color.white) + .cornerRadius(20) + .shadow(color: .black.opacity(0.25), radius: 4, x: 2, y: 2) } - .frame(maxWidth: UIScreen.main.bounds.width - 40, maxHeight: 230) - .background(Color.white) - .cornerRadius(20) - .shadow(color: .black.opacity(0.25), radius: 4, x: 4, y: 4) } } } } + .frame(width: UIScreen.main.bounds.width) + .padding(.bottom, 100) + .padding(.top, 30) + } + VStack { + Rectangle() + .frame(width: UIScreen.main.bounds.width, height: 25) + .foregroundColor(Color("background").opacity(0.9)) } - .frame(width: UIScreen.main.bounds.width) - .padding(.bottom, 100) - .padding(.top, 10) } }