mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Add shadow in the scroll
This commit is contained in:
parent
c45390408c
commit
0eaa9bc1e0
1 changed files with 63 additions and 39 deletions
|
|
@ -395,35 +395,47 @@ struct NotchClipboardList: View {
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
.padding(.vertical, 30) // Add padding so it's not touching header
|
.padding(.vertical, 30) // Add padding so it's not touching header
|
||||||
} else {
|
} else {
|
||||||
ScrollView {
|
ZStack {
|
||||||
LazyVStack(spacing: 4) { // Tighter spacing
|
ScrollView {
|
||||||
ForEach(clipboardManager.clipboardHistory) { item in
|
LazyVStack(spacing: 4) { // Tighter spacing
|
||||||
NotchClipboardItemRow(
|
ForEach(clipboardManager.clipboardHistory) { item in
|
||||||
item: item,
|
NotchClipboardItemRow(
|
||||||
isHovered: hoveredItemId == item.id,
|
item: item,
|
||||||
justCopied: justCopiedId == item.id
|
isHovered: hoveredItemId == item.id,
|
||||||
)
|
justCopied: justCopiedId == item.id
|
||||||
.contentShape(Rectangle())
|
)
|
||||||
.onHover { isHovered in
|
.contentShape(Rectangle())
|
||||||
hoveredItemId = isHovered ? item.id : nil
|
.onHover { isHovered in
|
||||||
}
|
hoveredItemId = isHovered ? item.id : nil
|
||||||
.onTapGesture {
|
|
||||||
clipboardManager.copyToClipboard(item)
|
|
||||||
withAnimation {
|
|
||||||
justCopiedId = item.id
|
|
||||||
}
|
}
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
|
.onTapGesture {
|
||||||
if justCopiedId == item.id {
|
clipboardManager.copyToClipboard(item)
|
||||||
withAnimation {
|
withAnimation {
|
||||||
justCopiedId = nil
|
justCopiedId = item.id
|
||||||
|
}
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
|
||||||
|
if justCopiedId == item.id {
|
||||||
|
withAnimation {
|
||||||
|
justCopiedId = nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.padding(.horizontal, 16)
|
||||||
|
.padding(.bottom, 20)
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 16)
|
|
||||||
.padding(.bottom, 20)
|
LinearGradient(colors: [Color.black.opacity(0.65), .clear], startPoint: .top, endPoint: .bottom)
|
||||||
|
.frame(height: 16)
|
||||||
|
.allowsHitTesting(false)
|
||||||
|
.frame(maxHeight: .infinity, alignment: .top)
|
||||||
|
|
||||||
|
LinearGradient(colors: [.clear, Color.black.opacity(0.65)], startPoint: .top, endPoint: .bottom)
|
||||||
|
.frame(height: 16)
|
||||||
|
.allowsHitTesting(false)
|
||||||
|
.frame(maxHeight: .infinity, alignment: .bottom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -700,26 +712,38 @@ struct NoteListView: View {
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
} else {
|
} else {
|
||||||
ScrollView {
|
ZStack {
|
||||||
let useGrid = sortedNotes.count > 3
|
ScrollView {
|
||||||
let columns = useGrid ? [GridItem(.flexible(), spacing: 8), GridItem(.flexible(), spacing: 8)] : [GridItem(.flexible())]
|
let useGrid = sortedNotes.count > 3
|
||||||
|
let columns = useGrid ? [GridItem(.flexible(), spacing: 8), GridItem(.flexible(), spacing: 8)] : [GridItem(.flexible())]
|
||||||
LazyVGrid(columns: columns, spacing: 8) {
|
|
||||||
ForEach(sortedNotes) { note in
|
LazyVGrid(columns: columns, spacing: 8) {
|
||||||
NoteRow(
|
ForEach(sortedNotes) { note in
|
||||||
note: note,
|
NoteRow(
|
||||||
onDelete: { onDeleteItem(note) },
|
note: note,
|
||||||
onTogglePin: { onTogglePin(note) },
|
onDelete: { onDeleteItem(note) },
|
||||||
isCompact: useGrid
|
onTogglePin: { onTogglePin(note) },
|
||||||
)
|
isCompact: useGrid
|
||||||
.contentShape(Rectangle())
|
)
|
||||||
.onTapGesture {
|
.contentShape(Rectangle())
|
||||||
onSelect(note)
|
.onTapGesture {
|
||||||
|
onSelect(note)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.padding(.horizontal, 16)
|
||||||
|
.padding(.bottom, 20)
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 16)
|
|
||||||
.padding(.bottom, 20)
|
LinearGradient(colors: [Color.black.opacity(0.65), .clear], startPoint: .top, endPoint: .bottom)
|
||||||
|
.frame(height: 16)
|
||||||
|
.allowsHitTesting(false)
|
||||||
|
.frame(maxHeight: .infinity, alignment: .top)
|
||||||
|
|
||||||
|
LinearGradient(colors: [.clear, Color.black.opacity(0.65)], startPoint: .top, endPoint: .bottom)
|
||||||
|
.frame(height: 16)
|
||||||
|
.allowsHitTesting(false)
|
||||||
|
.frame(maxHeight: .infinity, alignment: .bottom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue