-
Notifications
You must be signed in to change notification settings - Fork 0
Style/#96 선택한 시술 그라디언트 추가 #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The head ref may contain hidden characters: "style/#96-\uADF8\uB77C\uB514\uC5B8\uD2B8\uCD94\uAC00"
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,10 @@ struct SelectedTreatmentView: View { | |
| return contentHeight + 24.adjustedH | ||
| } | ||
|
|
||
| @State private var topGlobalY: CGFloat = .zero | ||
| @State private var initialTopGlobalY: CGFloat? = nil | ||
| @State private var bottomOffsetY: CGFloat = .zero | ||
|
|
||
| var body: some View { | ||
| VStack(spacing: 0) { | ||
| VStack(spacing: 0) { | ||
|
|
@@ -46,24 +50,86 @@ struct SelectedTreatmentView: View { | |
| x: 0, | ||
| y: -5 | ||
| ) | ||
| ScrollView(.vertical, showsIndicators: false) { | ||
| VStack(spacing: spacing) { | ||
| ForEach(selectedTreatments, id: \.id) { treatment in | ||
| TreatmentRowView( | ||
| displayMode: .summary, | ||
| treatmentEntity: treatment, | ||
| isSelected: .constant(true), | ||
| action: { removeTreatment(treatment) } | ||
| ) | ||
| .frame(height: itemHeight) | ||
| ZStack { | ||
| ScrollView(.vertical, showsIndicators: false) { | ||
| VStack(spacing: spacing) { | ||
| scrollViewTopMarkerView | ||
| .allowsHitTesting(false) | ||
|
|
||
| ForEach(selectedTreatments, id: \.id) { treatment in | ||
| TreatmentRowView( | ||
| displayMode: .summary, | ||
| treatmentEntity: treatment, | ||
| isSelected: .constant(true), | ||
| action: { removeTreatment(treatment) } | ||
| ) | ||
| .frame(height: itemHeight) | ||
| } | ||
|
|
||
| scrollViewBottomMarkerView | ||
| .allowsHitTesting(false) | ||
| } | ||
| .padding(.vertical, 14.adjustedH) | ||
| } | ||
| .padding(.vertical, 14.adjustedH) | ||
|
|
||
| GradientBox(isTop: true) | ||
| .frame(height: 42) | ||
| .allowsHitTesting(false) | ||
| .opacity(shouldShowGradientTop ? 1 : 0) | ||
| .frame(maxHeight: .infinity, alignment: .top) | ||
|
|
||
| GradientBox(isTop: false) | ||
| .frame(height: 42) | ||
| .allowsHitTesting(false) | ||
| .opacity(shouldShowGradientBottom ? 1 : 0) | ||
| .frame(maxHeight: .infinity, alignment: .bottom) | ||
| } | ||
| .frame(height: scrollViewHeight) | ||
| .scrollDisabled(selectedTreatments.count <= maxVisibleCount) | ||
| .padding(.horizontal, 24.5.adjustedW) | ||
| .coordinateSpace(name: "SelectedTreatmentScroll") | ||
| .onPreferenceChange(ScrollTopPreferenceKey.self) { minY in | ||
| if initialTopGlobalY == nil { initialTopGlobalY = minY } | ||
| topGlobalY = minY | ||
| } | ||
| .onPreferenceChange(ScrollBottomPreferenceKey.self) { height in | ||
| bottomOffsetY = height | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| extension SelectedTreatmentView { | ||
| private var scrollViewTopMarkerView: some View { | ||
| GeometryReader { proxy in | ||
| Color.clear | ||
| .preference( | ||
| key: ScrollTopPreferenceKey.self, | ||
| value: proxy.frame(in: .named("SelectedTreatmentScroll")).minY | ||
| ) | ||
| } | ||
| .frame(height: 0) | ||
| } | ||
|
|
||
| private var scrollViewBottomMarkerView: some View { | ||
| GeometryReader { proxy in | ||
| Color.clear | ||
| .preference( | ||
| key: ScrollBottomPreferenceKey.self, | ||
| value: proxy.frame(in: .named("SelectedTreatmentScroll")).maxY | ||
| ) | ||
| } | ||
| .frame(height: 0) | ||
| } | ||
|
|
||
| private var shouldShowGradientTop: Bool { | ||
| guard selectedTreatments.count > maxVisibleCount else { return false } | ||
| guard let initial = initialTopGlobalY else { return false } | ||
| return topGlobalY < initial - 1 | ||
| } | ||
|
|
||
| private var shouldShowGradientBottom: Bool { | ||
| let remaining = bottomOffsetY - scrollViewHeight.adjustedH | ||
| return remaining > 1 | ||
|
Comment on lines
+131
to
+133
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 하단 그라디언트가 비스크롤 상태에서도 노출될 수 있습니다
🐛 제안 변경- private var shouldShowGradientBottom: Bool {
- let remaining = bottomOffsetY - scrollViewHeight.adjustedH
- return remaining > 1
- }
+ private var shouldShowGradientBottom: Bool {
+ guard selectedTreatments.count > maxVisibleCount else { return false }
+ let remaining = bottomOffsetY - scrollViewHeight
+ return remaining > 1
+ }🤖 Prompt for AI Agents |
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
옵셔널 nil 초기화 제거로 린트 경고 해소
SwiftLint의
redundant_optional_initialization경고가 나옵니다.= nil을 제거해도 동작은 동일합니다.♻️ 제안 변경
📝 Committable suggestion
🧰 Tools
🪛 SwiftLint (0.57.0)
[Warning] 25-25: Initializing an optional variable with nil is redundant
(redundant_optional_initialization)
🤖 Prompt for AI Agents