add carousel view to message details screen

pull/874/head
Ryan Zhao 2 years ago
parent 6568ab0d19
commit b4d414bbfe

@ -16,6 +16,7 @@ struct MessageInfoView: View {
Color.black Color.black
} }
ScrollView(.vertical, showsIndicators: false) {
VStack( VStack(
alignment: .leading, alignment: .leading,
spacing: 10 spacing: 10
@ -44,14 +45,29 @@ struct MessageInfoView: View {
.fixedSize(horizontal: true, vertical: true) .fixedSize(horizontal: true, vertical: true)
.padding( .padding(
EdgeInsets( EdgeInsets(
top: 10, top: 8,
leading: 30, leading: 30,
bottom: 10, bottom: 4,
trailing: 30 trailing: 30
) )
) )
} }
// TODO: Attachment carousel view // TODO: Attachment carousel view
SessionCarouselView_SwiftUI(colors: [.orange, .gray, .blue, .yellow])
.frame(
maxWidth: .infinity,
maxHeight: .infinity,
alignment: .topLeading
)
.padding(
EdgeInsets(
top: 4,
leading: 0,
bottom: 4,
trailing: 0
)
)
// Attachment Info // Attachment Info
if (messageViewModel.attachments?.isEmpty != false) { if (messageViewModel.attachments?.isEmpty != false) {
@ -164,9 +180,9 @@ struct MessageInfoView: View {
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)
.padding( .padding(
EdgeInsets( EdgeInsets(
top: 10, top: 4,
leading: 30, leading: 30,
bottom: 10, bottom: 4,
trailing: 30 trailing: 30
) )
) )
@ -261,9 +277,9 @@ struct MessageInfoView: View {
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)
.padding( .padding(
EdgeInsets( EdgeInsets(
top: 10, top: 4,
leading: 30, leading: 30,
bottom: 10, bottom: 4,
trailing: 30 trailing: 30
) )
) )
@ -287,6 +303,7 @@ struct MessageInfoView: View {
} }
} }
} }
}
struct MessageInfoView_Previews: PreviewProvider { struct MessageInfoView_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {

@ -2,12 +2,17 @@
import SwiftUI import SwiftUI
struct SessionCarouselView_SwiftUI: View { public struct SessionCarouselView_SwiftUI: View {
@State var index = 0 @State var index = 0
var colors: [Color] = [.red, .orange, .blue] var colors: [Color]
var body: some View {
HStack { public init(colors: [Color]) {
self.colors = colors
}
public var body: some View {
HStack(spacing: 0) {
ArrowView(value: $index.animation(.easeInOut), range: 0...(colors.count - 1), type: .decrement) ArrowView(value: $index.animation(.easeInOut), range: 0...(colors.count - 1), type: .decrement)
.zIndex(1) .zIndex(1)
@ -175,7 +180,7 @@ struct SessionCarouselView_SwiftUI_Previews: PreviewProvider {
Color.black Color.black
} }
SessionCarouselView_SwiftUI() SessionCarouselView_SwiftUI(colors: [.red, .orange, .blue])
} }
} }
} }

Loading…
Cancel
Save