MenuPage.qml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import QtQuick
  2. import Felgo
  3. import "common"
  4. AppPage {
  5. title: "主界面"
  6. AppFlickable {
  7. id: scroll
  8. anchors.fill: parent
  9. contentHeight: content.height
  10. MouseArea {
  11. anchors.fill: parent
  12. onClicked: {
  13. scroll.forceActiveFocus()
  14. }
  15. }
  16. Column {
  17. id: content
  18. width: parent.width
  19. Section {
  20. title: "Convenience Controls"
  21. SectionItem {
  22. title: "AppCard"
  23. anchors.horizontalCenter: parent.horizontalCenter
  24. AppCard {
  25. id: card
  26. width: dp(300)
  27. property real resetX: parent.width/2 - width/2
  28. x: resetX
  29. margin: dp(15)
  30. swipeEnabled: true
  31. cardSwipeArea.rotationFactor: 0.02
  32. cardSwipeArea.swipeOutThreshold: dp(180)
  33. cardSwipeArea.swipeOutDuration: 500
  34. paper.radius: dp(5)
  35. header: SimpleRow {
  36. imageSource: Qt.resolvedUrl("../../assets/architecture-1477041_960_720.jpg")
  37. text: "Title"
  38. detailText: "AppCard detailed text"
  39. image.radius: image.width / 2
  40. image.fillMode: Image.PreserveAspectCrop
  41. style: StyleSimpleRow {
  42. showDisclosure: false
  43. backgroundColor: "transparent"
  44. }
  45. }
  46. media: AppImage {
  47. width: parent.width
  48. fillMode: Image.PreserveAspectFit
  49. source: Qt.resolvedUrl("../../assets/architecture-1477041_960_720.jpg")
  50. }
  51. content: AppText{
  52. width: parent.width
  53. padding: dp(15)
  54. text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
  55. }
  56. actions: Row {
  57. IconButton {
  58. iconType: IconType.thumbsup
  59. }
  60. IconButton {
  61. iconType: IconType.sharealt
  62. }
  63. AppButton {
  64. text: "Follow"
  65. flat: true
  66. }
  67. }
  68. cardSwipeArea.onSwipeOutCompleted: {
  69. card.x = card.resetX
  70. card.y = 0
  71. card.rotation = 0
  72. }
  73. }
  74. } // AppCard section
  75. // SwipeView section
  76. } // convenience controls section
  77. }
  78. }
  79. }