fromString method

FontWeight fromString(
  1. String metrics
)

Implementation

FontWeight fromString(String metrics) {
  if (metrics == "thin") {
    return FontWeight.w100;
  } else if (metrics == "extralight") {
    return FontWeight.w200;
  } else if (metrics == "light") {
    return FontWeight.w300;
  } else if (metrics == "normal") {
    return FontWeight.w400;
  } else if (metrics == "medium") {
    return FontWeight.w500;
  } else if (metrics == "semibold") {
    return FontWeight.w600;
  } else if (metrics == "bold") {
    return FontWeight.w700;
  } else if (metrics == "extrabold") {
    return FontWeight.w800;
  } else if (metrics == "black") {
    return FontWeight.w900;
  }

  return FontWeight.normal;
}