addFontWeight static method
Implementation
static TextStyle addFontWeight(TextStyle textStyle, String value) {
final List<String> supportedNumValues = [
"100",
"200",
"300",
"400",
"500",
"600",
"700",
"800",
"900"
];
if (supportedNumValues.contains(value)) {
return textStyle.copyWith(
fontWeight: FontWeight.values[supportedNumValues.indexOf(value)]);
}
switch (value) {
case "normal":
textStyle = textStyle.copyWith(fontWeight: FontWeight.normal);
break;
case "bold":
textStyle = textStyle.copyWith(fontWeight: FontWeight.bold);
break;
default:
textStyle = textStyle;
}
return textStyle;
}