parse method

  1. @override
Widget parse(
  1. Map<String, dynamic> map,
  2. BuildContext buildContext,
  3. ClickListener? listener
)
override

parse the json map into a flutter widget.

Implementation

@override
Widget parse(Map<String, dynamic> map, BuildContext buildContext,
    ClickListener? listener) {
  var appBarWidget = AppBar(
    title: map.containsKey("title")
        ? DynamicWidgetBuilder.buildFromMap(
            map["title"], buildContext, listener)
        : null,
    leading: map.containsKey("leading")
        ? DynamicWidgetBuilder.buildFromMap(
            map["leading"], buildContext, listener)
        : null,
    actions: map.containsKey("actions")
        ? DynamicWidgetBuilder.buildWidgets(
            map["actions"], buildContext, listener)
        : null,
    centerTitle:
        map.containsKey("centerTitle") ? map["centerTitle"] as bool? : false,
    backgroundColor: map.containsKey("backgroundColor")
        ? parseHexColor(map["backgroundColor"])
        : null,
  );

  return appBarWidget;
}