ThemeModal.qml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. import QtQuick 2.0
  2. import Felgo 4.0
  3. import "../common"
  4. AppModal {
  5. id: themeModal
  6. fullscreen: false
  7. modalHeight: dp(380) + nativeUtils.safeAreaInsets.bottom
  8. NavigationStack {
  9. AppPage {
  10. title: "Customize this app"
  11. rightBarItem: TextButtonBarItem {
  12. text: "Close"
  13. textItem.font.pixelSize: sp(16)
  14. onClicked: themeModal.close()
  15. }
  16. Column {
  17. id: themeColumn
  18. width: parent.width
  19. Section {
  20. title: "Select theme"
  21. SimpleRow {
  22. text: "iOS Theme"
  23. showDisclosure: false
  24. onSelected: {
  25. Theme.platform = "ios"
  26. Theme.colors.statusBarStyle = Theme.colors.statusBarStyleBlack
  27. }
  28. AppIcon {
  29. iconType: IconType.check
  30. visible: Theme.isIos
  31. anchors.right: parent.right
  32. anchors.rightMargin: dp(Theme.contentPadding)
  33. anchors.verticalCenter: parent.verticalCenter
  34. }
  35. }
  36. SimpleRow {
  37. text: system.isPlatform(System.IOS) ? "Materal Theme" : "Android Theme"
  38. showDisclosure: false
  39. onSelected: {
  40. Theme.platform = "android"
  41. Theme.colors.statusBarStyle = Theme.colors.statusBarStyleWhite
  42. }
  43. AppIcon {
  44. iconType: IconType.check
  45. visible: Theme.isAndroid
  46. anchors.right: parent.right
  47. anchors.rightMargin: dp(Theme.contentPadding)
  48. anchors.verticalCenter: parent.verticalCenter
  49. }
  50. }
  51. SimpleRow {
  52. text: "Desktop Theme"
  53. showDisclosure: false
  54. onSelected: {
  55. Theme.platform = "windows"
  56. Theme.colors.statusBarStyle = Theme.colors.statusBarStyleWhite
  57. }
  58. AppIcon {
  59. iconType: IconType.check
  60. visible: Theme.isDesktop
  61. anchors.right: parent.right
  62. anchors.rightMargin: dp(Theme.contentPadding)
  63. anchors.verticalCenter: parent.verticalCenter
  64. }
  65. }
  66. } // theme selection section
  67. Section {
  68. title: "Select tint color"
  69. bottomPadding: dp(50)
  70. Row {
  71. anchors.horizontalCenter: parent.horizontalCenter
  72. // columns: 2
  73. spacing: dp(20)
  74. Rectangle {
  75. id: blueCircle
  76. width: dp(30)
  77. height: width
  78. color: Theme.isIos ? "#007aff" : (Theme.isAndroid ? "#3f51b5" : "#01a9e2") // felgo blue
  79. opacity: Theme.colors.tintColor == blueCircle.color ? 1 : 0.5
  80. radius: height / 2
  81. MouseArea {
  82. anchors.fill: parent
  83. onClicked: Theme.colors.tintColor = blueCircle.color
  84. }
  85. }
  86. Rectangle {
  87. id: greenCircle
  88. width: dp(30)
  89. height: width
  90. color: "green"
  91. opacity: Theme.colors.tintColor == greenCircle.color ? 1 : 0.5
  92. radius: height / 2
  93. MouseArea {
  94. anchors.fill: parent
  95. onClicked: Theme.colors.tintColor = greenCircle.color
  96. }
  97. }
  98. Rectangle {
  99. id: redCircle
  100. width: dp(30)
  101. height: width
  102. color: "red"
  103. opacity: Theme.colors.tintColor == redCircle.color ? 1 : 0.5
  104. radius: height / 2
  105. MouseArea {
  106. anchors.fill: parent
  107. onClicked: Theme.colors.tintColor = redCircle.color
  108. }
  109. }
  110. Rectangle {
  111. id: blackCircle
  112. width: dp(30)
  113. height: width
  114. color: "black"
  115. opacity: Theme.colors.tintColor == blackCircle.color ? 1 : 0.5
  116. radius: height / 2
  117. MouseArea {
  118. anchors.fill: parent
  119. onClicked: Theme.colors.tintColor = blackCircle.color
  120. }
  121. }
  122. }
  123. }
  124. }
  125. }
  126. }
  127. }