UseServiceAndPrivacyModal.swift 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //
  2. // UseServiceAndPrivacyModal.swift
  3. // fiveConstant
  4. //
  5. // Created by 李建 on 2023/1/16.
  6. //
  7. import SwiftUI
  8. struct UseServiceAndPrivacyModal: View {
  9. @Binding var show:Bool
  10. var onOk: () ->()
  11. var body: some View {
  12. ZStack {
  13. MaskView(bgColor: .gray)
  14. VStack {
  15. Text("用户协议和隐私政策")
  16. .font(.title3)
  17. ScrollView {
  18. Text("欢迎使用永续绿建五恒 APP,我们非常重视您的隐私保护和个人信息保护,使用本软件的过程中我们会严格按照法律规定收集存储和使用您的个人信息,未经您的同意我们不会向第三方提供您的任何信息,您可以阅读《用户协议》 和《隐私协议》 全文了解详细信息。如您同意,请点击“同意”开始接受我们的服务。")
  19. }
  20. .frame(height: 200)
  21. Button {
  22. self.onOk()
  23. } label: {
  24. Text("同意")
  25. .foregroundColor(.white)
  26. .padding(9)
  27. .frame(maxWidth: .infinity)
  28. .background(
  29. Color("MainColor")
  30. .cornerRadius(8)
  31. )
  32. .border(Color("MainColor"), width: 0)
  33. }
  34. Button {
  35. show.toggle()
  36. } label: {
  37. Text("不同意退出")
  38. .foregroundColor(Color.gray)
  39. }
  40. .padding()
  41. }
  42. .padding(.bottom, 40)
  43. .frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: 400)
  44. .cornerRadius(8)
  45. .padding(.horizontal, 48)
  46. .background(Color.white)
  47. }
  48. }
  49. }
  50. struct MaskView: View {
  51. var bgColor: Color
  52. var body: some View {
  53. VStack {
  54. Spacer()
  55. }
  56. .frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
  57. .background(bgColor)
  58. .edgesIgnoringSafeArea(.all)
  59. .opacity(0.5)
  60. }
  61. }
  62. struct UseServiceAndPrivacyModal_Previews: PreviewProvider {
  63. @State static var show:Bool = true
  64. static var previews: some View {
  65. UseServiceAndPrivacyModal(show: $show) {
  66. }
  67. }
  68. }