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-thinapplies the thinnest weight (w100).font-boldapplies 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');
Related Documentation
- Font Weight Utilities — apply weights with
font-* - Font Family — customize the body and display fonts
- Font Size — customize the typographic scale