setFontWeight method

void setFontWeight(
  1. String fontWeightStr
)

Implementation

void setFontWeight(String fontWeightStr) {
  var tempFontWeight = FontWeight.normal;
  if ("bold" == fontWeightStr) {
    tempFontWeight = FontWeight.bold;
  } else if ("normal" == fontWeightStr) {
    tempFontWeight = FontWeight.normal;
  } else {
    var fontWeightNumeric = _parseArgument(fontWeightStr);
    if (fontWeightNumeric != -1) {
      if (fontWeightNumeric <= 100) {
        tempFontWeight = FontWeight.w100;
      } else if (fontWeightNumeric <= 200) {
        tempFontWeight = FontWeight.w200;
      } else if (fontWeightNumeric <= 300) {
        tempFontWeight = FontWeight.w300;
      } else if (fontWeightNumeric <= 400) {
        tempFontWeight = FontWeight.w400;
      } else if (fontWeightNumeric <= 500) {
        tempFontWeight = FontWeight.w500;
      } else if (fontWeightNumeric <= 600) {
        tempFontWeight = FontWeight.w600;
      } else if (fontWeightNumeric <= 700) {
        tempFontWeight = FontWeight.w700;
      } else if (fontWeightNumeric <= 800) {
        tempFontWeight = FontWeight.w800;
      } else {
        tempFontWeight = FontWeight.w900;
      }
    }
  }
  fontWeight = tempFontWeight;
}