deriveFontFamily function

String deriveFontFamily({
  1. required String family,
  2. required String style,
  3. required FontWeightNumeric? weight,
})

Implementation

String deriveFontFamily({
  required String family,
  required String style,
  required FontWeightNumeric? weight,
}) {
  switch (weight) {
    case FontWeightNumeric.w100:
      family = '$family Thin';
    case FontWeightNumeric.w200:
      family = '$family Extra Light';
    case FontWeightNumeric.w300:
      family = '$family Light';
    case FontWeightNumeric.w400:
      family = '$family Regular';
    case FontWeightNumeric.w500:
      family = '$family Medium';
    case FontWeightNumeric.w600:
      family = '$family Semibold';
    case FontWeightNumeric.w700:
      family = '$family Bold';
    case FontWeightNumeric.w800:
      family = '$family Extra Bold';
    case FontWeightNumeric.w900:
      family = '$family Black';
    default:
      break;
  }

  if (style == 'Italic' || style == 'Oblique') {
    family = '$family $style';
  }

  return family;
}