flutter-textstyle-extensions icon indicating copy to clipboard operation
flutter-textstyle-extensions copied to clipboard

Google fonts Font weight not working

Open Devbrail opened this issue 3 years ago • 1 comments

Devbrail avatar Jul 26 '22 12:07 Devbrail

@Devbrail You can do it like this:

class Fonts {
  static TextStyle interNormal({
    FontWeight? weight = FontWeight.normal
  }) {
    return GoogleFonts.inter(
      fontSize: 12,
      fontStyle: FontStyle.normal,
      fontWeight: weight,
    );
  }

  static TextStyle get inter {
    return interNormal();
  }

  static TextStyle get interMedium {
    return interNormal(weight: FontWeight.w500);
  }

  static TextStyle get interBold {
    return interNormal(weight: FontWeight.bold);
  }
}

Usage:

style: Fonts.interBold.size(24)

olegkrutskih avatar Aug 15 '24 09:08 olegkrutskih