buildBadge method

  1. @protected
Widget buildBadge(
  1. BuildParameters params
)

Implementation

@protected
Widget buildBadge(BuildParameters params) {
  final props = params.props;

  Widget? label = builder.tryBuildWidget(params.context,
      params.widgets["label"], params.state, params.parentContext);
  label ??= Text("${props["label"] ?? ""}");

  return Badge(
    key: properties.getKey(params.id),
    alignment: params.buildProp("alignment"),
    padding: params.buildProp("padding"),
    textStyle: params.buildProp("textStyle"),
    textColor: tryParseColor(props["textColor"]),
    backgroundColor: tryParseColor(props["backgroundColor"]),
    isLabelVisible: props["isLabelVisible"] != null
        ? properties.evaluateCondition(props["isLabelVisible"])
        : true,
    label: label,
    child: builder.tryBuildWidget(params.context, params.widgets["child"],
        params.state, params.parentContext),
  );
}