Added an AnchorLayout to the MainPanel and set the layout data poroperty of the StackNavigator to AnchorLayoutData.fill()

This commit is contained in:
2025-11-24 22:11:07 +01:00
parent a42a468070
commit fd5eaac4c6
3 changed files with 23 additions and 15 deletions
+2 -2
View File
@@ -49,7 +49,7 @@ class MainHeader extends LayoutGroup {
var l:HorizontalLayout = new HorizontalLayout(); var l:HorizontalLayout = new HorizontalLayout();
l.paddingLeft = l.paddingRight = Std.int(headerHeight * .1); l.paddingLeft = l.paddingRight = Std.int(headerHeight * .1);
l.paddingTop = l.paddingBottom = Std.int(headerHeight * .1); l.paddingTop = l.paddingBottom = Std.int(headerHeight * .1);
//l.verticalAlign = MIDDLE; l.verticalAlign = MIDDLE;
layout = l; layout = l;
} }
@@ -67,7 +67,7 @@ class MainHeader extends LayoutGroup {
lbl1.text = Constants.MENU_ITEM_0_STRING; lbl1.text = Constants.MENU_ITEM_0_STRING;
lbl1.embedFonts = true; lbl1.embedFonts = true;
var fnt:Font = Assets.getFont(Constants.MONTSERRAT_MEDIUM_500); var fnt:Font = Assets.getFont(Constants.MONTSERRAT_MEDIUM_500);
lbl1.textFormat = new TextFormat(fnt.fontName, Std.int(headerHeight * .4), Constants.MAIN_COLOR3); lbl1.textFormat = new TextFormat(fnt.fontName, Std.int(headerHeight * .3), Constants.MAIN_COLOR3);
addChild(lbl1); addChild(lbl1);
} }
+9 -4
View File
@@ -1,5 +1,7 @@
package view; package view;
import feathers.layout.AnchorLayoutData;
import feathers.layout.AnchorLayout;
import feathers.controls.navigators.StackItem; import feathers.controls.navigators.StackItem;
import feathers.controls.navigators.StackNavigator; import feathers.controls.navigators.StackNavigator;
import feathers.controls.Button; import feathers.controls.Button;
@@ -28,10 +30,7 @@ class MainPanel extends Panel {
autoSizeMode = STAGE; autoSizeMode = STAGE;
backgroundSkin = new RectangleSkin(SolidColor(Constants.MAIN_COLOR2, 1)); backgroundSkin = new RectangleSkin(SolidColor(Constants.MAIN_COLOR2, 1));
} layout = new AnchorLayout();
private function onCreationComplete(event:FeathersEvent):Void {
traceBlue(this + " --> onCreationComplete() - w: " + width + " h: " + height );
mh = new MainHeader(); mh = new MainHeader();
header = mh; header = mh;
@@ -41,8 +40,14 @@ class MainPanel extends Panel {
sn = new StackNavigator(); sn = new StackNavigator();
sn.autoSizeMode = STAGE; sn.autoSizeMode = STAGE;
sn.layoutData = AnchorLayoutData.fill();
sn.addItem(StackItem.withClass("ridersScreen", RidersScreen)); sn.addItem(StackItem.withClass("ridersScreen", RidersScreen));
sn.rootItemID = "ridersScreen"; sn.rootItemID = "ridersScreen";
addChild(sn); addChild(sn);
}
private function onCreationComplete(event:FeathersEvent):Void {
traceBlue(this + " --> onCreationComplete() - w: " + width + " h: " + height );
} }
} }
+12 -9
View File
@@ -1,5 +1,7 @@
package view; package view;
import feathers.layout.AnchorLayoutData;
import feathers.layout.AnchorLayout;
import feathers.events.FeathersEvent; import feathers.events.FeathersEvent;
import feathers.layout.VerticalLayout; import feathers.layout.VerticalLayout;
import feathers.controls.ScrollContainer; import feathers.controls.ScrollContainer;
@@ -18,19 +20,20 @@ class RidersScreen extends ScrollContainer {
override private function initialize():Void { override private function initialize():Void {
super.initialize(); super.initialize();
var vl:VerticalLayout = new VerticalLayout(); layout = new AnchorLayout();
vl.verticalAlign = TOP;
layout = vl; tb = new ToolBar();
tb.layoutData = AnchorLayoutData.fillHorizontal();
addChild(tb);
rl = new RidersList();
rl.layoutData = AnchorLayoutData.fillHorizontal();
rl.y = 80;
addChild(rl);
} }
private function onCreationComplete(event:FeathersEvent):Void { private function onCreationComplete(event:FeathersEvent):Void {
traceBlue(this + " --> onCreationComplete() - w: " + width + " h: " + height ); traceBlue(this + " --> onCreationComplete() - w: " + width + " h: " + height );
tb = new ToolBar();
addChild(tb);
rl = new RidersList();
addChild(rl);
} }
} }