expressionToFontWeight static method

FontWeight expressionToFontWeight(
  1. Expression value
)

Implementation

static FontWeight expressionToFontWeight(css.Expression value) {
  if (value is css.NumberTerm) {
    switch (value.text) {
      case "100":
        return FontWeight.w100;
      case "200":
        return FontWeight.w200;
      case "300":
        return FontWeight.w300;
      case "400":
        return FontWeight.w400;
      case "500":
        return FontWeight.w500;
      case "600":
        return FontWeight.w600;
      case "700":
        return FontWeight.w700;
      case "800":
        return FontWeight.w800;
      case "900":
        return FontWeight.w900;
    }
  } else if (value is css.LiteralTerm) {
    switch(value.text) {
      case "bold":
        return FontWeight.bold;
      case "bolder":
        return FontWeight.w900;
      case "lighter":
        return FontWeight.w200;
    }
    return FontWeight.normal;
  }
  return FontWeight.normal;
}