fontWeight method

Text fontWeight(
  1. FontWeight weight
)

Sets the font weight for the text.

This is a convenience method equivalent to calling styled(fontWeight: weight).

Parameters:

  • weight: The font weight to apply.

Returns a new Text widget with the specified font weight.

Example:

Text('Bold text').fontWeight(FontWeight.bold);
Text('Light text').fontWeight(FontWeight.w300);

Implementation

Text fontWeight(FontWeight weight) => styled(fontWeight: weight);