Skip to content

Commit 8a6a884

Browse files
committed
VPN-7501 improve layout of first screen
1 parent 441bbb4 commit 8a6a884

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

src/ui/screens/initialize/ViewInitialize.qml

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Item {
5555
MZFlickable {
5656
id: onboardingPanel
5757

58-
flickContentHeight: Math.max(window.safeContentHeight / 2 + col.implicitHeight, parent.height)
58+
flickContentHeight: parent.height
5959
height: parent.height
6060
width: parent.width
6161

@@ -100,7 +100,6 @@ Item {
100100
// The extra 40 for iOS below is due to VPN-7497. Qt 6.10 upgrade seems to have changed how the status bar and bottom bar are
101101
// calculated for iOS. We could re-do this entire layout with safeHitArea, but this is the quickest solution and the one needed
102102
// right now.
103-
property int _topMargin: (safeAreaHeight - ((Qt.platform.os === "ios" || Qt.platform.os === "android") ? 40 : 0)) / 2 - currentPanelValues._animationHeight
104103
property bool _isFirstSlide: swipeView.currentIndex === 0
105104

106105
id: swipeView
@@ -133,8 +132,8 @@ Item {
133132
anchors.fill: undefined
134133
anchors.horizontalCenter: parent.horizontalCenter
135134
anchors.top: parent.top
136-
anchors.topMargin: swipeView._isFirstSlide ? 0 : swipeView._topMargin
137-
height: currentPanelValues._animationHeight + (swipeView._isFirstSlide ? swipeView._topMargin : 0)
135+
anchors.topMargin: swipeView._isFirstSlide ? 0 : currentPanelValues._topMargin
136+
height: currentPanelValues._animationHeight + (swipeView._isFirstSlide ? currentPanelValues._topMargin : 0)
138137
loop: loopAnimation
139138
opacity: panelAnimation.imageOpacityValue
140139
source: MZAssetLookup.getAnimationSource(animationSrc)
@@ -264,14 +263,40 @@ Item {
264263
property string _panelTitleText: ""
265264
property string _panelDescriptionText: ""
266265
property real _animationHeight: Math.min(240, safeAreaHeight * .35)
266+
// next line is 2/3 of empty space on the screen
267+
property int _topMargin: ((safeAreaHeight - ((Qt.platform.os === "ios" || Qt.platform.os === "android") ? 40 : 0)) - panelBottomContent.implicitHeight - panelTextMaxHeight - _animationHeight - headerLink.height) * 2 / 3
268+
property real panelTextMaxHeight: 0
269+
}
270+
271+
// This next section isn't visible to the user. It is used to calcuate the largest text size, to use that for layout elsewhere.
272+
Repeater {
273+
model: onboardingModel
274+
delegate: ColumnLayout {
275+
visible: false
276+
width: parent.width
277+
spacing: MZTheme.the5me.windowMargin / 2
278+
279+
MZHeadline {
280+
Layout.fillWidth: true
281+
text: MZI18n[titleStringId]
282+
}
283+
MZSubtitle {
284+
Layout.fillWidth: true
285+
text: MZI18n[subtitleStringId]
286+
}
287+
288+
Component.onCompleted: {
289+
currentPanelValues.panelTextMaxHeight = Math.max(currentPanelValues.panelTextMaxHeight, implicitHeight)
290+
}
291+
}
267292
}
268293

269294
ColumnLayout {
270295
id: col
271296

272297
anchors {
273298
fill: parent
274-
topMargin: onboardingPanel.height / 2
299+
topMargin: currentPanelValues._animationHeight + currentPanelValues._topMargin
275300
leftMargin: MZTheme.theme.windowMargin * 1.5
276301
rightMargin: MZTheme.theme.windowMargin * 1.5
277302
}

0 commit comments

Comments
 (0)