TODO RiderList line 92

This commit is contained in:
2025-12-08 21:47:19 +01:00
parent fbd94c52c0
commit d0ab28556b
5 changed files with 48 additions and 7 deletions
+19 -5
View File
@@ -1,5 +1,8 @@
package view;
import com.adobe.cairngorm.control.CairngormEventDispatcher;
import control.AppController;
import com.adobe.cairngorm.control.CairngormEvent;
import components.RidersListRendererAccessory;
import components.RoundAvatar;
import feathers.controls.ListView;
@@ -23,6 +26,7 @@ class RidersList extends ListView {
public function new() {
super();
addEventListener(FeathersEvent.CREATION_COMPLETE, onCreationComplete);
addEventListener(Event.CHANGE, onRiderSelect);
}
override private function initialize():Void {
@@ -30,7 +34,6 @@ class RidersList extends ListView {
// set common properties for all renderers in the same container here
var recycler = DisplayObjectRecycler.withFunction(() -> {
final fnt1:Font = Assets.getFont(Constants.MONTSERRAT_MEDIUM_500);
final fnt2:Font = Assets.getFont(Constants.MONTSERRAT_BOLD_700);
@@ -43,7 +46,6 @@ class RidersList extends ListView {
itemRenderer.secondaryTextFormat = new TextFormat(fnt2.fontName, Std.int(rowHeight * 0.2), Constants.MAIN_COLOR2);
return itemRenderer;
});
itemRendererRecycler = recycler;
@@ -59,7 +61,6 @@ class RidersList extends ListView {
// TODO change this to real iamge path
// loader.source = "https://lepetittrot.com/path/to/pp_pictures" + state.data.id + ".jpg";
// loader.source = "https://testingbot.com/free-online-tools/random-avatar/50?u=" + Uuid.nanoId();
};
recycler.reset = (itemRenderer:ItemRenderer, state:ListViewItemState) -> {
@@ -69,14 +70,14 @@ class RidersList extends ListView {
loader.source = null; */
};
model.addEventListener(AppModelLocator.RIDERS_LIST_DP_CHANGE, onRideListDpChange);
model.addEventListener(AppModelLocator.RIDERS_LIST_DP_CHANGE, onRiderListDpChange);
}
private function onCreationComplete(event:FeathersEvent):Void {
traceBlue(this + " --> onCreationComplete() - w: " + width + " h: " + height);
}
private function onRideListDpChange(e:Event):Void {
private function onRiderListDpChange(e:Event):Void {
dataProvider = model.ridersListDP;
/*itemToText = function(item:Dynamic):String {
@@ -84,4 +85,17 @@ class RidersList extends ListView {
};*/
traceGreen(this + " --> onRideListDpChange() - w: " + width + " h: " + height);
}
function onRiderSelect(e:Event):Void {
var riderVO:RiderVO = cast(selectedItem, RiderVO);
var ce:CairngormEvent = new CairngormEvent(AppController.RIDER_SELECT_EVENT);
CairngormEventDispatcher.getInstance().dispatchEvent(ce); //TODO how to pass the selected user to AppModelLocator ?
//trace(riderVO.firstName);
//clearSelectedRider();
}
// de-select any selected List items
private function clearSelectedRider():Void {
selectedIndex = -1;
}
}