chore(preview): add #Preview to RecordSheet + DebugAIRunner
之前 HomeView/MeView/TrendsView/ArchiveListView/RootView/SymptomStartSheet 都有 #Preview,只剩这两个。补完后所有主屏 View 都能在 Xcode Canvas 直接 预览,改 UI 不用 build & run。
This commit is contained in:
@@ -200,4 +200,12 @@ struct DebugAIRunner: View {
|
|||||||
refreshModelStatus()
|
refreshModelStatus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#Preview("DebugAIRunner") {
|
||||||
|
ScrollView {
|
||||||
|
DebugAIRunner()
|
||||||
|
.padding(.vertical, 24)
|
||||||
|
}
|
||||||
|
.background(Tj.Palette.sand.ignoresSafeArea())
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -108,3 +108,26 @@ struct RecordSheet: View {
|
|||||||
.presentationCornerRadius(Tj.Radius.xl)
|
.presentationCornerRadius(Tj.Radius.xl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#Preview("RecordSheet · 直接渲染") {
|
||||||
|
RecordSheet { kind in print("picked: \(kind)") }
|
||||||
|
.frame(width: 390, height: 560)
|
||||||
|
.background(Tj.Palette.sand)
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview("RecordSheet · sheet 模式") {
|
||||||
|
PreviewContainer()
|
||||||
|
}
|
||||||
|
|
||||||
|
private struct PreviewContainer: View {
|
||||||
|
@State private var show = true
|
||||||
|
var body: some View {
|
||||||
|
Text("点这里再开一次")
|
||||||
|
.onTapGesture { show = true }
|
||||||
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
|
.background(Tj.Palette.sand.ignoresSafeArea())
|
||||||
|
.sheet(isPresented: $show) {
|
||||||
|
RecordSheet { kind in print("picked: \(kind)"); show = false }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user