From 18c9ff30cb2e94b9b316b2440bd932cc76fe5c0d Mon Sep 17 00:00:00 2001 From: miruka Date: Mon, 15 Jul 2019 18:10:11 -0400 Subject: [PATCH] Hide edit account header when page too small --- src/qml/Pages/EditAccount/EditAccount.qml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/qml/Pages/EditAccount/EditAccount.qml b/src/qml/Pages/EditAccount/EditAccount.qml index a09d1ddf..591bb58a 100644 --- a/src/qml/Pages/EditAccount/EditAccount.qml +++ b/src/qml/Pages/EditAccount/EditAccount.qml @@ -11,6 +11,7 @@ Page { id: editAccount property bool wide: width > 414 + padding * 2 + property int avatarPreferredSize: theme.minimumSupportedWidth property int normalSpacing: 8 property int currentSpacing: Math.min(normalSpacing * width / 400, normalSpacing * 2) @@ -20,9 +21,17 @@ Page { header: HRectangle { width: parent.width - height: theme.bottomElementsHeight color: theme.pageHeadersBackground + height: window.height < + avatarPreferredSize + + theme.bottomElementsHeight + + currentSpacing * 2 ? + 0 : theme.bottomElementsHeight + + Behavior on height { HNumberAnimation {} } + visible: height > 0 + HRowLayout { width: parent.width @@ -34,6 +43,7 @@ Page { font.pixelSize: theme.fontSize.big elide: Text.ElideRight maximumLineCount: 1 + horizontalAlignment: Text.AlignHCenter Layout.leftMargin: currentSpacing Layout.rightMargin: Layout.leftMargin @@ -44,8 +54,9 @@ Page { background: null - padding: currentSpacing < 8 ? 0 : currentSpacing - Behavior on padding { HNumberAnimation {} } + leftPadding: currentSpacing < 8 ? 0 : currentSpacing + rightPadding: leftPadding + Behavior on leftPadding { HNumberAnimation {} } Flickable { id: flickable @@ -68,7 +79,7 @@ Page { Layout.maximumWidth: Math.min(parent.width, 640) Layout.preferredWidth: - wide ? parent.width : theme.minimumSupportedWidth + wide ? parent.width : avatarPreferredSize Layout.preferredHeight: childrenRect.height