buildList method
Implementation
@override
Widget buildList(BuildContext context) {
var count = mutable.lastState.fullData.length;
if (mutable.lastState.hasMore) count++;
Function? selectFunction;
if (!EditorBloc.editMode) {
selectFunction = Lowder.actions.getValueFunction(
context, actions["onSelect"], state, evaluatorContext);
}
return GridView.count(
key: Key("${id}_list"),
controller: controller,
crossAxisCount: spec.buildProp("crossAxisCount") ?? 1,
mainAxisSpacing: parseDouble(props["mainAxisSpacing"]),
crossAxisSpacing: parseDouble(props["crossAxisSpacing"]),
childAspectRatio:
parseDouble(props["childAspectRatio"], defaultValue: 1.0),
scrollDirection: spec.buildProp("scrollDirection") ?? Axis.vertical,
reverse: parseBool(props["reverse"]),
shrinkWrap: parseBool(props["shrinkWrap"]),
padding: Lowder.properties.getInsets(spec.props["padding"]),
primary: tryParseBool(props["primary"]),
keyboardDismissBehavior: spec.buildProp("keyboardDismissBehavior") ??
ScrollViewKeyboardDismissBehavior.manual,
semanticChildCount: count,
children: List.generate(count, (i) {
if (mutable.lastState.hasMore && i == count - 1) {
return getLoadingIndicator();
}
var itemWidget = buildWidget(context, childSpec!, i);
if (selectFunction != null) {
itemWidget = InkWell(
child: itemWidget,
onTap: () => selectFunction!(mutable.lastState.fullData[i]),
);
}
return itemWidget;
}),
);
}