fix:(@desktop/Profile): Preview Bio length and scroll area fix #7922

This commit is contained in:
mprakhov 2022-11-11 14:58:23 +02:00 committed by Mykhailo Prakhov
parent da6524b840
commit 36e0277321
2 changed files with 39 additions and 6 deletions

View File

@ -66,6 +66,24 @@ SettingsContentBase {
Layout.fillWidth: true Layout.fillWidth: true
currentIndex: editPreviwTabBar.currentIndex currentIndex: editPreviwTabBar.currentIndex
onImplicitHeightChanged: {
// During opening Profile, StackLayout always set implicitHeight of his biggest
// child implicitHeight and it reflecting on a scroll area.
// Use implicitHeight of current child
if (currentIndex === 0 && implicitHeight !== settingsView.implicitHeight) {
implicitHeight = settingsView.implicitHeight
} else if (currentIndex === 1 && implicitHeight !== profilePreview.implicitHeight) {
implicitHeight = profilePreview.implicitHeight
}
}
onCurrentIndexChanged: {
switch(currentIndex) {
case 0: implicitHeight = settingsView.implicitHeight; break
case 1: implicitHeight = profilePreview.implicitHeight; break
}
}
MyProfileSettingsView { MyProfileSettingsView {
id: settingsView id: settingsView
Layout.fillWidth: true Layout.fillWidth: true

View File

@ -6,6 +6,7 @@ import QtQml.Models 2.14
import utils 1.0 import utils 1.0
import StatusQ.Core 0.1 import StatusQ.Core 0.1
import StatusQ.Controls 0.1
import "../controls" import "../controls"
@ -84,13 +85,27 @@ Control {
contentItem: ColumnLayout { contentItem: ColumnLayout {
spacing: 20 spacing: 20
StatusBaseText { StatusScrollView {
id: scrollView
visible: root.bio !== ""
padding: 0
rightPadding: scrollBar.visible ? 16 : 0
Layout.maximumHeight: 108
Layout.fillWidth: true Layout.fillWidth: true
visible: text !== "" TextArea.flickable: bioText
text: root.bio ScrollBar.vertical: StatusScrollBar {
wrapMode: Text.Wrap id: scrollBar
font.weight: Font.Medium policy: scrollView.contentHeight > scrollView.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
lineHeight: 1.2 }
StatusBaseText {
id: bioText
text: root.bio
wrapMode: Text.Wrap
font.weight: Font.Medium
lineHeight: 1.2
width: scrollView.availableWidth
}
} }
StatusCenteredFlow { StatusCenteredFlow {