getIconFromName static method

Widget? getIconFromName(
  1. String name, {
  2. Color? color,
  3. Key? key,
  4. String? semanticLabel,
  5. double size = 20,
  6. TextDirection? textDirection,
})

Implementation

static Widget? getIconFromName(String name,
    {Color? color,
      Key? key,
      String? semanticLabel,
      double size = 20,
      TextDirection? textDirection}) {
  sizes = size;
  Widget? icon = iconList[name];

  if (icon.runtimeType == Icon) {
    icon = Icon(
      (icon as Icon).icon,
      color: color,
      key: key,
      semanticLabel: semanticLabel,
      size: size,
      textDirection: textDirection,
    );
  } else {
    icon = faIconList[name];
    if (icon.runtimeType == FaIcon) {
      icon = FaIcon(
        (icon as FaIcon).icon,
        color: color,
        key: key,
        semanticLabel: semanticLabel,
        size: size,
        textDirection: textDirection,
      );
    }
  }

  return icon;
}