Skip to content

Commit

Permalink
添加文字效果
Browse files Browse the repository at this point in the history
  • Loading branch information
ming1016 committed Apr 21, 2024
1 parent 4db156d commit be59f85
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 18 deletions.
26 changes: 25 additions & 1 deletion SwiftPamphletApp/App/IntroView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,26 @@
import SwiftUI
import MarkdownUI

struct LightingView<Content: View>: View {
@Environment(\.colorScheme) var colorSchemeMode
let content: Content
init(@ViewBuilder content: () -> Content) {
self.content = content()
}
var body: some View {
ZStack {
content
.blendMode(colorSchemeMode == .dark ? .colorDodge : .colorBurn)
content
.blendMode(colorSchemeMode == .dark ? .softLight : .softLight)
content
.blur(radius: 1)
content

}
}
}

struct IntroView: View {
var body: some View {
VStack(spacing: 15) {
Expand All @@ -16,7 +36,11 @@ struct IntroView: View {
.aspectRatio(contentMode: .fit)
.frame(width: 120, height: 120)
Text("戴铭的开发小册子").bold()
Text("Swift Pamphlet App").gradientTitle(color: .mint)
LightingView {
Text("Swift Pamphlet App").gradientTitle(color: .mint)
}


HStack {
Text("一本活的开发手册")
Link("GitHub 地址", destination: URL(string: "https://github.com/ming1016/SwiftPamphletApp")!)
Expand Down
24 changes: 8 additions & 16 deletions SwiftPamphletApp/InfoOrganizer/Info/EditInfoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ struct EditInfoView: View {
VStack {
Form {
Section {
titleInputView()
urlInputView()
titleInputView
urlInputView
} // end Section

Section {
categoryInputView()
categoryInputView
}
// MARK: Tab 切换
Section(footer: Text("文本支持 markdown 格式")) {
Expand Down Expand Up @@ -252,7 +252,7 @@ struct EditInfoView: View {

// MARK: WebView
@ViewBuilder
func webViewView() -> some View {
private func webViewView() -> some View {
if let url = URL(string: info.url) {
VStack {
WebUIViewWithSave(
Expand All @@ -271,7 +271,7 @@ struct EditInfoView: View {

// MARK: Text And Preview
@ViewBuilder
func textAndPreviewView() -> some View {
private func textAndPreviewView() -> some View {
TextEditor(text: $info.des).border()
.padding(10)
.tabItem { Label("文本", systemImage: "circle") }
Expand All @@ -284,8 +284,7 @@ struct EditInfoView: View {


// MARK: Category
@ViewBuilder
func categoryInputView() -> some View {
private var categoryInputView: some View {
HStack {
Picker("分类:", selection: $info.category) {
Text("未分类")
Expand Down Expand Up @@ -340,15 +339,9 @@ struct EditInfoView: View {
}

// MARK: URL
@ViewBuilder
func urlInputView() -> some View {
private var urlInputView: some View {
HStack {
TextField("地址:", text: $info.url, prompt: Text("输入或粘贴 url,例如 https://www.starming.com")).rounded()
// .onSubmit {
// Task.detached(priority: .background, operation: {
//
// })
// }
if info.url.isEmpty == false {
Button {
Task {
Expand Down Expand Up @@ -392,8 +385,7 @@ struct EditInfoView: View {
}

// MARK: 标题
@ViewBuilder
func titleInputView() -> some View {
private var titleInputView: some View {
HStack {
TextField("标题:", text: $info.name).rounded()
Toggle(isOn: $info.star) {
Expand Down
3 changes: 2 additions & 1 deletion SwiftPamphletApp/Resource/Guide/1.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
## 动态
## 版本

* 6.0 使用 WWDC23 技术进行了重构
* 5.0 增加 WWDC22 内容

## Todo

* 设计功能
* 内容增加和更新

## 当前在用开发工具速链

* [SQLite.swift/Index.md](https://github.com/stephencelis/SQLite.swift/blob/master/Documentation/Index.md) 文档
* [GitHub REST API - GitHub Docs](https://docs.github.com/cn/rest)
* 在线工具:[TinyPNG](https://tinypng.com/)[JSON校验](http://www.1json.com/json/)

0 comments on commit be59f85

Please sign in to comment.