无结果时隐藏格式化结果区域
This commit is contained in:
+10
-15
@@ -18,7 +18,9 @@ struct FormatterView: View {
|
||||
List {
|
||||
inputSection
|
||||
actionSection
|
||||
resultSection
|
||||
if !outputText.isEmpty {
|
||||
resultSection
|
||||
}
|
||||
}
|
||||
.listStyle(.insetGrouped)
|
||||
.navigationTitle("文案格式化")
|
||||
@@ -83,25 +85,18 @@ struct FormatterView: View {
|
||||
|
||||
private var resultSection: some View {
|
||||
Section {
|
||||
if outputText.isEmpty {
|
||||
Text("点击上方按钮生成格式化结果")
|
||||
.foregroundStyle(.secondary)
|
||||
} else {
|
||||
TextEditor(text: .constant(outputText))
|
||||
.frame(minHeight: 160)
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(Color(.secondarySystemGroupedBackground))
|
||||
}
|
||||
TextEditor(text: .constant(outputText))
|
||||
.frame(minHeight: 160)
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(Color(.secondarySystemGroupedBackground))
|
||||
} header: {
|
||||
HStack {
|
||||
Text("格式化结果")
|
||||
Spacer()
|
||||
if !outputText.isEmpty {
|
||||
Button(action: copyOutput) {
|
||||
Image(systemName: "doc.on.doc")
|
||||
}
|
||||
.font(.subheadline)
|
||||
Button(action: copyOutput) {
|
||||
Image(systemName: "doc.on.doc")
|
||||
}
|
||||
.font(.subheadline)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user