search ESC

Searching…

No results for "".

Type at least 2 characters to search.

Docs
You are viewing an older version (0.0.5). Go to the latest.

Customizing Font Weight

Manage font weights through WindTheme: pre-defined keys mapped to Flutter FontWeight values, customizable at runtime.

WindTheme.setFontWeight('ultrabold', FontWeight.w800);
FontWeight weight = WindTheme.getFontWeight('medium'); // FontWeight.w500

Default Font Weights

WindTheme ships pre-defined font weights mapped to intuitive keys. Each key corresponds to a Flutter FontWeight value.

Key FontWeight Description
thin w100 Thinnest weight
extralight w200 Extra light weight
light w300 Light weight
normal w400 Regular weight
medium w500 Medium weight
semibold w600 Semi-bold weight
bold w700 Bold weight
extrabold w800 Extra bold weight
black w900 Heaviest weight

For example:

  • font-thin applies the thinnest weight (w100).
  • font-bold applies a bold weight (w700).

Managing Font Weights

WindTheme provides methods to check, retrieve, customize, and remove font weights at runtime.

// Check whether a font weight exists
bool exists = WindTheme.hasFontWeight('bold');
print(exists); // Output: true
// Retrieve a font weight value
FontWeight weight = WindTheme.getFontWeight('medium');
print(weight); // Output: FontWeight.w500
// Add a custom font weight
WindTheme.setFontWeight('ultrabold', FontWeight.w800);

// Update an existing font weight
WindTheme.setFontWeight('bold', FontWeight.w600);
// Remove a font weight
WindTheme.removeFontWeight('extralight');