123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- //
- // ChatListView.swift
- // Chat
- //
- // Created by Sergey Tarasov on 24.07.2022.
- //
- import SwiftUI
- struct ChatListView: View {
- @Environment(\.colorScheme) var colorScheme
- var body: some View {
- List {
- ForEach(1..<14) { index in
- ZStack {
- HStack {
- Image(systemName: "person.crop.circle")
- .resizable()
- .scaledToFit()
- .foregroundColor(.secondary.opacity(0.5))
- .padding(.vertical, 8)
- VStack(alignment: .leading, spacing: 0) {
- HStack {
- Text("Андрей")
- Spacer()
- Text("23:04")
- .font(.callout)
- .foregroundColor(.secondary)
- }
- .padding(.vertical, 4)
- HStack {
- VStack {
- Text("Сообщение \(index)")
- .foregroundColor(.secondary)
- Spacer()
- }
- Spacer()
- Text("\(index)")
- .font(.callout)
- .foregroundColor(colorScheme == .light ? .white : .black)
- .padding(.horizontal, 6)
- .background(
- Capsule().foregroundColor(.secondary)
- )
- }
- .padding(.vertical, 6)
- }
- }
- .foregroundColor(.primary)
- .frame(height: 60)
- NavigationLink {
- ChatView()
- } label: {
- EmptyView()
- }
- .opacity(0.0)
- }
- }
- }
- .listStyle(.plain)
- .navigationTitle("Чаты")
- .navigationBarTitleDisplayMode(.inline)
- }
- }
- struct ChatListView_Previews: PreviewProvider {
- static var previews: some View {
- Group {
- NavigationView {
- ChatListView()
- }
- NavigationView {
- ChatListView()
- }
- .preferredColorScheme(.dark)
- }
- }
- }
|