Hide edit account header when page too small

This commit is contained in:
miruka 2019-07-15 18:10:11 -04:00
parent 503252f1c7
commit 18c9ff30cb

View File

@ -11,6 +11,7 @@ Page {
id: editAccount id: editAccount
property bool wide: width > 414 + padding * 2 property bool wide: width > 414 + padding * 2
property int avatarPreferredSize: theme.minimumSupportedWidth
property int normalSpacing: 8 property int normalSpacing: 8
property int currentSpacing: property int currentSpacing:
Math.min(normalSpacing * width / 400, normalSpacing * 2) Math.min(normalSpacing * width / 400, normalSpacing * 2)
@ -20,9 +21,17 @@ Page {
header: HRectangle { header: HRectangle {
width: parent.width width: parent.width
height: theme.bottomElementsHeight
color: theme.pageHeadersBackground color: theme.pageHeadersBackground
height: window.height <
avatarPreferredSize +
theme.bottomElementsHeight +
currentSpacing * 2 ?
0 : theme.bottomElementsHeight
Behavior on height { HNumberAnimation {} }
visible: height > 0
HRowLayout { HRowLayout {
width: parent.width width: parent.width
@ -34,6 +43,7 @@ Page {
font.pixelSize: theme.fontSize.big font.pixelSize: theme.fontSize.big
elide: Text.ElideRight elide: Text.ElideRight
maximumLineCount: 1 maximumLineCount: 1
horizontalAlignment: Text.AlignHCenter
Layout.leftMargin: currentSpacing Layout.leftMargin: currentSpacing
Layout.rightMargin: Layout.leftMargin Layout.rightMargin: Layout.leftMargin
@ -44,8 +54,9 @@ Page {
background: null background: null
padding: currentSpacing < 8 ? 0 : currentSpacing leftPadding: currentSpacing < 8 ? 0 : currentSpacing
Behavior on padding { HNumberAnimation {} } rightPadding: leftPadding
Behavior on leftPadding { HNumberAnimation {} }
Flickable { Flickable {
id: flickable id: flickable
@ -68,7 +79,7 @@ Page {
Layout.maximumWidth: Math.min(parent.width, 640) Layout.maximumWidth: Math.min(parent.width, 640)
Layout.preferredWidth: Layout.preferredWidth:
wide ? parent.width : theme.minimumSupportedWidth wide ? parent.width : avatarPreferredSize
Layout.preferredHeight: childrenRect.height Layout.preferredHeight: childrenRect.height