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
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 {
id: settingsView
Layout.fillWidth: true

View File

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