getTextStyle static method

TextStyle getTextStyle({
  1. double? fontSize,
  2. Color? color,
  3. FontWeight? fontWeight,
  4. double? height,
  5. double? letterSpacing,
})

Creates a TextStyle with the configured font family.

Implementation

static TextStyle getTextStyle({
  double? fontSize,
  Color? color,
  FontWeight? fontWeight,
  double? height,
  double? letterSpacing,
}) {
  // Map font family to GoogleFonts method
  switch (_fontFamily) {
    case 'fredoka':
      return GoogleFonts.fredoka(
        fontSize: fontSize,
        color: color,
        fontWeight: fontWeight,
        height: height,
        letterSpacing: letterSpacing,
      );
    case 'roboto':
      return GoogleFonts.roboto(
        fontSize: fontSize,
        color: color,
        fontWeight: fontWeight,
        height: height,
        letterSpacing: letterSpacing,
      );
    case 'montserrat':
      return GoogleFonts.montserrat(
        fontSize: fontSize,
        color: color,
        fontWeight: fontWeight,
        height: height,
        letterSpacing: letterSpacing,
      );
    case 'opensans':
      return GoogleFonts.openSans(
        fontSize: fontSize,
        color: color,
        fontWeight: fontWeight,
        height: height,
        letterSpacing: letterSpacing,
      );
    case 'lato':
      return GoogleFonts.lato(
        fontSize: fontSize,
        color: color,
        fontWeight: fontWeight,
        height: height,
        letterSpacing: letterSpacing,
      );
    case 'nunito':
      return GoogleFonts.nunito(
        fontSize: fontSize,
        color: color,
        fontWeight: fontWeight,
        height: height,
        letterSpacing: letterSpacing,
      );
    case 'raleway':
      return GoogleFonts.raleway(
        fontSize: fontSize,
        color: color,
        fontWeight: fontWeight,
        height: height,
        letterSpacing: letterSpacing,
      );
    case 'inter':
      return GoogleFonts.inter(
        fontSize: fontSize,
        color: color,
        fontWeight: fontWeight,
        height: height,
        letterSpacing: letterSpacing,
      );
    case 'poppins':
    default:
      return GoogleFonts.poppins(
        fontSize: fontSize,
        color: color,
        fontWeight: fontWeight,
        height: height,
        letterSpacing: letterSpacing,
      );
  }
}