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) {
bool isThreeLine =
map.containsKey("isThreeLine") ? map["isThreeLine"] : false;
EdgeInsetsGeometry? contentPadding = map.containsKey("contentPadding")
? parseEdgeInsetsGeometry(map["contentPadding"])
: null;
bool? dense = map.containsKey("dense") ? map["dense"] : false;
bool enabled = map.containsKey("enabled") ? map["enabled"] : true;
Widget? leading = map.containsKey("leading")
? DynamicWidgetBuilder.buildFromMap(
map["leading"], buildContext, listener)
: null;
bool selected = map.containsKey("selected") ? map["selected"] : false;
Widget? subtitle = map.containsKey("subtitle")
? DynamicWidgetBuilder.buildFromMap(
map["subtitle"], buildContext, listener)
: null;
Widget? title = map.containsKey("title")
? DynamicWidgetBuilder.buildFromMap(
map["title"], buildContext, listener)
: null;
Widget? trailing = map.containsKey("trailing")
? DynamicWidgetBuilder.buildFromMap(
map["trailing"], buildContext, listener)
: null;
String? tapEvent = map.containsKey("tapEvent") ? map["tapEvent"] : null;
return ListTile(
isThreeLine: isThreeLine,
leading: leading,
title: title,
subtitle: subtitle,
trailing: trailing,
dense: dense,
contentPadding: contentPadding,
enabled: enabled,
onTap: () {
if (listener != null && tapEvent != null) {
listener.onClicked(tapEvent);
}
},
selected: selected,
);
}