Rev 17 | Rev 23 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
//// NotificationListView.swift// twogetskills//// Created by Efrain Yanez Recanatini on 7/31/22.//import SwiftUIstruct NotificationListView: View {@EnvironmentObject private var networkMonitor : NetworkMonitor@EnvironmentObject private var appNavigation : AppNavigation@ObservedObject var viewModel :NotificationListViewModel = NotificationListViewModel()var body: some View {VStack(spacing: 0) {HStack {Image("logo").resizable().frame(width: 32, height: 32, alignment: .center).aspectRatio(contentMode: .fit).foregroundColor(networkMonitor.status == .disconnected ? Color("color_network_disconnected_foreground") : Color("color_app_bar_foreground")).padding(.leading, 16)Text(networkMonitor.status == .disconnected ? Config.LANG_ERROR_NETWORK_MESSAGE_SHORT : Config.LANG_TAB_BAR_BUTTON_NOTIFICATIONS).font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_APP_BAR_HEAD1 )).foregroundColor(networkMonitor.status == .disconnected ? Color("color_network_disconnected_foreground") : Color("color_app_bar_foreground")).padding(.leading, 4)Spacer()}.edgesIgnoringSafeArea(.top).frame(height: 50).background(networkMonitor.status == .disconnected ? Color("color_network_disconnected_background") : Color("color_app_bar_background"))Divider().background(networkMonitor.status == .disconnected ? Color("color_network_disconnected_background") : Color("color_app_bar_background"))ScrollView {if self.viewModel.notifications.count == 0 {NotificationListItemEmptyView()} else {LazyVStack {// ForEach(0..<self.viewModel.notifications.count) { index in// let notificationItem = self.viewModel.notifications[index]ForEach(self.viewModel.notifications) { notificationItem inNotificationListItemView(notification: notificationItem) {self.viewModel.removeItem(id: notificationItem.id)}}}}}.padding(.top, 5)}}}struct NotificationListView_Previews: PreviewProvider {static var previews: some View {NotificationListView()}}