Browse Source

添加用户协议显示以及复选框

main
sunyufeng 1 year ago
parent
commit
d6348892e8
1 changed files with 24 additions and 2 deletions
  1. 24
    2
      iOSFirst/login/LoginView.swift

+ 24
- 2
iOSFirst/login/LoginView.swift View File

15
     var bag = DisposeBag()
15
     var bag = DisposeBag()
16
     @State private var inputAccountMessage:String = ""
16
     @State private var inputAccountMessage:String = ""
17
     @State private var isPresent:Bool = false
17
     @State private var isPresent:Bool = false
18
+    @State private var checked:Bool = true
18
     @State private var inputPasswordMessage:String = ""
19
     @State private var inputPasswordMessage:String = ""
19
     
20
     
20
     var body: some View {
21
     var body: some View {
90
             
91
             
91
             VStack(alignment: .trailing, spacing: 400) {
92
             VStack(alignment: .trailing, spacing: 400) {
92
                 
93
                 
93
-                VStack(alignment: .center, spacing: 15) {
94
-                    
94
+                VStack(alignment: .trailing, spacing: 15) {
95
+                    HStack {
96
+                        CheckBoxView(checked: $checked)
97
+                        Text("我已阅读并同意")
98
+                            .foregroundColor(.black)
99
+                            .font(.system(size: 15))
100
+                        Text("《星火云鸽用户协议》")
101
+                            .foregroundColor(.blue)
102
+                            .font(.system(size: 15))
103
+                        Spacer()
104
+                    }
95
                     Button(action: {
105
                     Button(action: {
96
                         if(inputAccountMessage.isEmpty){
106
                         if(inputAccountMessage.isEmpty){
97
                             SUIToast.show(messageItem: .init(
107
                             SUIToast.show(messageItem: .init(
165
     }
175
     }
166
 }
176
 }
167
 
177
 
178
+struct CheckBoxView: View {
179
+    @Binding var checked: Bool
180
+
181
+    var body: some View {
182
+        Image(systemName: checked ? "checkmark.square.fill" : "square")
183
+            .foregroundColor(checked ? Color(UIColor.systemBlue) : Color.secondary)
184
+            .onTapGesture {
185
+                self.checked.toggle()
186
+            }
187
+    }
188
+}
189
+
168
 
190
 
169
 
191
 

Loading…
Cancel
Save