Examples/Demos: fix warning about unused padding

This commit is contained in:
Olivier Goffart 2025-07-04 17:48:37 +02:00
parent d49fe14e4a
commit 27f026aeea
8 changed files with 13 additions and 40 deletions

View file

@ -52,8 +52,7 @@ export component Settings inherits Page {
callback close();
padding-left: 0;
padding-right: 0;
horizontal-padding: 0;
VerticalLayout {
padding-left: Theme.spaces.medium;

View file

@ -6,10 +6,9 @@ import { Theme } from "../theme.slint";
export component Page inherits Rectangle {
in property <int> index;
in property <int> current-index;
in property <length> horizontal-padding: 14px;
out property <bool> active: index == current-index;
padding-left: 14px;
padding-right: 14px;
x: (index - current-index) * self.width;
width: 100%;
height: 100%;
@ -17,8 +16,8 @@ export component Page inherits Rectangle {
animate x { duration: Theme.durations.fast; }
GridLayout {
padding-left: root.padding-left;
padding-right: root.padding-right;
padding-left: root.horizontal-padding;
padding-right: root.horizontal-padding;
@children
}

View file

@ -75,7 +75,6 @@ export component AboutBox {
AboutFelgo {
height: 84%;
preferred-width: 200px;
padding-bottom: 10px;
}
}

View file

@ -104,7 +104,6 @@ component CityWeatherList inherits Flickable {
VerticalLayout {
alignment: start;
padding: 0px;
for city-weather-info[index] in CityWeather.city-weather:
CitySlideArea {
@ -171,8 +170,6 @@ export component CityListView inherits PageBase {
property<TileInfo> selected-tile;
CityWeatherList {
padding: 16px;
expand(index, absolute-position, width, height) => {
root.selected-tile = {
index: index,

View file

@ -28,11 +28,7 @@ export component FloatingTextButton inherits Rectangle {
background: AppPalette.background;
border-radius: Math.min(self.width, self.height) / 2;
padding: 12px;
padding-left: self.padding;
padding-right: self.padding;
padding-top: self.padding;
padding-bottom: self.padding;
property<length> margins: 12px;
preferred-width: 48px;
preferred-height: 48px;
@ -41,8 +37,8 @@ export component FloatingTextButton inherits Rectangle {
height: self.preferred-height;
icon := AppIcon {
width: parent.width - parent.padding-left - parent.padding-right;
height: parent.height - parent.padding-top - parent.padding-bottom;
width: parent.width - 2 * parent.margins;
height: parent.height - 2 * parent.margins;
}
TouchArea {
@ -77,24 +73,15 @@ export component TextField inherits Rectangle {
forward-focus: text-input;
padding: 5px;
padding-top: self.padding;
padding-right: self.padding;
padding-bottom: self.padding;
padding-left: self.padding;
preferred-height: text-input.preferred-height + self.padding-top + self.padding-bottom;
property <length> margins: 5px;
preferred-height: text-input.preferred-height + 2 * self.margins;
height: self.preferred-height;
border-radius: 5px;
background: white.with-alpha(15%);
HorizontalLayout {
x: root.padding-left;
width: parent.width - root.padding-left - root.padding-right;
y: root.padding-top;
height: parent.height - root.padding-top - root.padding-bottom;
padding: parent.margins;
spacing: icon.preferred-width > 0 ? 10px : 0px;

View file

@ -67,8 +67,7 @@ export component RainInfo inherits Rectangle {
property<float> max-bar-volume: 10;
padding-top: 2px;
padding-bottom: 2px;
property<length> margin: 2px;
opacity: root.minimal ? (root.precipitation-probability * 30% + 70%) : 100%;
@ -77,7 +76,7 @@ export component RainInfo inherits Rectangle {
y: parent.height - self.height;
width: 3px;
height: (parent.height - parent.padding-top - parent.padding-bottom) *
height: (parent.height - 2 * parent.margin) *
Math.min(root.volume, root.max-bar-volume) / root.max-bar-volume * 100%;
background: root.type-color;

View file

@ -255,16 +255,10 @@ export component ExpandedCityWeatherTile inherits TouchArea {
clip: true;
Flickable {
padding-top: 15px;
padding-bottom: 15px;
y: self.padding-top;
height: parent.height - self.padding-top - self.padding-bottom;
VerticalLayout {
alignment: start;
padding-left: 15px;
padding-right: 15px;
padding: 15px;
ForecastTitleLine {}

View file

@ -17,7 +17,6 @@ export component MainWindow inherits Window {
width: 320px;
height: 240px;
background: Theme.window-background;
padding: Theme.spacing-regular;
forward-focus: carousel;
default-font-family: Theme.font-family;