Add margin handling

This commit is contained in:
Simon Stürz 2026-02-26 15:48:31 +01:00
parent c1ff089513
commit ed8e26e67e
2 changed files with 19 additions and 3 deletions

View File

@ -43,6 +43,8 @@ Page {
// a deepter layer as we need to include it in the blurring of the header and footer.
// We don't want to paint the background on the entire screen twice (overdraw is costly)
background: null
readonly property bool applyRootItemBottomMarginCompaction: true
readonly property int bottomMargin: footer.shown ? contentContainer.footerSize : 0
function configureViews() {
if (Configuration.hasOwnProperty("mainViewsFilter")) {

View File

@ -37,11 +37,25 @@ import "connection"
Item {
id: root
readonly property var currentPage: swipeView.currentItem ? swipeView.currentItem.pageStack.currentItem : null
readonly property bool currentPageCompactsBottomMargin: currentPage
&& currentPage.hasOwnProperty("applyRootItemBottomMarginCompaction")
&& currentPage.applyRootItemBottomMarginCompaction
readonly property bool currentPageDefinesBottomMargin: currentPage && currentPage.hasOwnProperty("bottomMargin")
readonly property int currentPageBottomMargin: currentPageDefinesBottomMargin ? currentPage.bottomMargin : 0
readonly property int safeAreaBottomMargin: {
if (Qt.platform.os !== "ios") {
return PlatformHelper.bottomPadding
var margin = PlatformHelper.bottomPadding
if (Qt.platform.os === "ios") {
margin = Math.round(PlatformHelper.bottomPadding * Math.max(0, Configuration.iosSafeAreaBottomMarginScale))
if (currentPageCompactsBottomMargin && !app.landscape && currentPageBottomMargin > 0 && margin > 0) {
margin = Math.floor(margin * 0.5)
}
}
return Math.round(PlatformHelper.bottomPadding * Math.max(0, Configuration.iosSafeAreaBottomMarginScale))
return margin
}
function handleAndroidBackButton() {