list
mList = new List();
mList.layout = new VerticalLayoutBuilder().setHorizontalAlign(HorizontalAlign.JUSTIFY).setHorizontalPadding(12).setTypicalItemHeight((DeviceManager.shared.stageWidth - 24) / 2 + 90).setVariableItemDimensions(true).setGap(20).setPaddingBottom(ApplicationExtension.shared.safeInsetBottom).build();
mList.layoutData = new AnchorLayoutDataBuilder(0, 0, 0, 0).build();
mList.decelerationRate = Config.shared.decelerationRate;
mList.horizontalScrollPolicy = ScrollPolicy.OFF;
mList.hasElasticEdges = false;
dataProvider.setFactories(mList);
this.addChild(mList);
dataProvider.setFactories
public function setFactories($list:List):void {
$list.factoryIDFunction = function($item:Object):String { return $item.type }
$list.setItemRendererFactoryWithID(CELLID_date, function():IListItemRenderer { return new PlacesDateRenderer() });
$list.setItemRendererFactoryWithID(CELLID_place, function():IListItemRenderer { return new PlacesRenderer() });
$list.setItemRendererFactoryWithID(CELLID_title, function():IListItemRenderer { return new PlacesTitleRenderer() });
}
renderers
public class PlacesTitleRenderer extends LayoutGroupListItemRenderer {
public function PlacesTitleRenderer() {
super();
this.height = 40;
}
override protected function initialize():void {
super.initialize();
setupChilds();
}
}
public class PlacesDateRenderer extends LayoutGroupListItemRenderer {
public function PlacesDateRenderer() {
super();
this.height = 60;
}
override protected function initialize():void {
super.initialize();
setupChilds();
}
}
public class PlacesRenderer extends LayoutGroupListItemRenderer {
public function PlacesRenderer() {
super();
this.height = 260;
}
override protected function initialize():void {
super.initialize();
setupChilds();
}
}
collection
public function update($list:List):void {
var _vsp:Number = $list.verticalScrollPosition || 0;
var _collection:ListCollection = new ListCollection();
_collection.push({type:CELLID_title});
_collection.push({type:CELLID_date});
_collection.push({type:CELLID_title});
var i:int;
for (i = 0; i < 10; i++) {
_collection.push({ type: CELLID_place });
}
$list.dataProvider = _collection;
$list.verticalScrollPosition = _vsp;
}