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) {
String? clickEvent =
map.containsKey("click_event") ? map['click_event'] : "";
return TextButton(
onPressed: () {
listener!.onClicked(clickEvent);
},
style: ButtonStyle(
foregroundColor: map.containsKey("foregroundColor")
? MaterialStateProperty.all(parseHexColor(map["foregroundColor"]))
: null,
backgroundColor: map.containsKey("backgroundColor")
? MaterialStateProperty.all(parseHexColor(map["backgroundColor"]))
: null,
overlayColor: map.containsKey("overlayColor")
? MaterialStateProperty.all(parseHexColor(map["overlayColor"]))
: null,
shadowColor: map.containsKey("shadowColor")
? MaterialStateProperty.all(parseHexColor(map["shadowColor"]))
: null,
elevation: map.containsKey("elevation")
? MaterialStateProperty.all(map["elevation"])
: null,
padding: map.containsKey("padding")
? MaterialStateProperty.all(parseEdgeInsetsGeometry(map["padding"]))
: null,
textStyle: map.containsKey("textStyle")
? MaterialStateProperty.all(parseTextStyle(map["textStyle"]))
: null,
alignment: map.containsKey("alignment")
? parseAlignment(map["alignment"])
: null,
),
child: DynamicWidgetBuilder.buildFromMap(
map['child'], buildContext, listener)!,
);
}