From d26ca0baf94f2758b7b99e41007970b6792add38 Mon Sep 17 00:00:00 2001 From: mprakhov Date: Fri, 11 Nov 2022 18:46:35 +0200 Subject: [PATCH] refactoring after review --- .../Profile/views/MyProfileView.qml | 29 +++++-------------- .../shared/panels/ProfileBioSocialsPanel.qml | 6 ++-- 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/ui/app/AppLayouts/Profile/views/MyProfileView.qml b/ui/app/AppLayouts/Profile/views/MyProfileView.qml index 9f2f72bb17..e87305be7c 100644 --- a/ui/app/AppLayouts/Profile/views/MyProfileView.qml +++ b/ui/app/AppLayouts/Profile/views/MyProfileView.qml @@ -63,42 +63,29 @@ SettingsContentBase { width: root.contentWidth StackLayout { - Layout.fillWidth: true + id: stackLayout 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 + profileStore: root.profileStore privacyStore: root.privacyStore walletStore: root.walletStore + + onVisibleChanged: if (visible) stackLayout.Layout.preferredHeight = settingsView.implicitHeight + Component.onCompleted: stackLayout.Layout.preferredHeight = Qt.binding(() => settingsView.implicitHeight) } MyProfilePreview { id: profilePreview - Layout.fillWidth: true + profileStore: root.profileStore contactsStore: root.contactsStore dirtyValues: settingsView.dirtyValues dirty: settingsView.dirty + + onVisibleChanged: if (visible) stackLayout.Layout.preferredHeight = Qt.binding(() => profilePreview.implicitHeight) } } diff --git a/ui/imports/shared/panels/ProfileBioSocialsPanel.qml b/ui/imports/shared/panels/ProfileBioSocialsPanel.qml index 957d5d76b1..9a4e8b95a5 100644 --- a/ui/imports/shared/panels/ProfileBioSocialsPanel.qml +++ b/ui/imports/shared/panels/ProfileBioSocialsPanel.qml @@ -87,15 +87,15 @@ Control { StatusScrollView { id: scrollView - visible: root.bio !== "" + visible: root.bio padding: 0 rightPadding: scrollBar.visible ? 16 : 0 Layout.maximumHeight: 108 Layout.fillWidth: true - TextArea.flickable: bioText + contentHeight: bioText.height ScrollBar.vertical: StatusScrollBar { id: scrollBar - policy: scrollView.contentHeight > scrollView.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff + policy: bioText.height > scrollView.availableHeight ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff } StatusBaseText {