parse method
Widget
parse(
- Map<
String, dynamic> map, - BuildContext buildContext,
- ClickListener? listener
override
parse the json map into a flutter widget.
Implementation
@override
Widget parse(Map<String, dynamic> map, BuildContext buildContext,
ClickListener? listener) {
var scrollDirection = Axis.vertical;
if (map.containsKey("scrollDirection") &&
"horizontal" == map["scrollDirection"]) {
scrollDirection = Axis.horizontal;
}
var reverse = map.containsKey("reverse") ? map['reverse'] : false;
var shrinkWrap = map.containsKey("shrinkWrap") ? map["shrinkWrap"] : false;
var cacheExtent =
map.containsKey("cacheExtent") ? map["cacheExtent"]?.toDouble() : 0.0;
var padding = map.containsKey('padding')
? parseEdgeInsetsGeometry(map['padding'])
: null;
var itemExtent =
map.containsKey("itemExtent") ? map["itemExtent"]?.toDouble() : null;
var children = DynamicWidgetBuilder.buildWidgets(
map['children'], buildContext, listener);
var pageSize = map.containsKey("pageSize") ? map["pageSize"] : 10;
var loadMoreUrl =
map.containsKey("loadMoreUrl") ? map["loadMoreUrl"] : null;
var isDemo = map.containsKey("isDemo") ? map["isDemo"] : false;
var params = new ListViewParams(
scrollDirection: scrollDirection,
reverse: reverse,
shrinkWrap: shrinkWrap,
cacheExtent: cacheExtent,
padding: padding,
itemExtent: itemExtent,
children: children,
pageSize: pageSize,
loadMoreUrl: loadMoreUrl,
isDemo: isDemo);
return new ListViewWidget(params, buildContext);
}