pub struct FontWeight {
pub value: i32,
}Expand description
The thickness of the glyphs used to draw the text.
Values must be in the range 1..1000.
Fonts are typically weighted on a 9-point scale, which, for historical
reasons, uses the names 100 to 900. In Flutter, these are named w100 to
w900 and have the following conventional meanings:
-
w100: Thin, the thinnest font weight. -
w200: Extra light. -
w300: Light. -
w400: Normal. The constantNORMALis an alias for this value. -
w500: Medium. -
w600: Semi-bold. -
w800: Extra-bold. -
w900: Black, the thickest font weight.
For example, the font named “Roboto Medium” is typically exposed as a font
with the name “Roboto” and the weight W500.
Some modern fonts allow the weight to be adjusted in arbitrary increments.
When using these fonts, applications can specify FontWeight instances
constructed using values other than the predefined values.
Fields§
§value: i32The thickness value of this font weight.
Implementations§
Source§impl FontWeight
impl FontWeight
Sourcepub const W100: FontWeight
pub const W100: FontWeight
Thin, the least thick.
Sourcepub const W200: FontWeight
pub const W200: FontWeight
Extra-light.
Sourcepub const W300: FontWeight
pub const W300: FontWeight
Light.
Sourcepub const W400: FontWeight
pub const W400: FontWeight
Normal / regular / plain.
Sourcepub const W500: FontWeight
pub const W500: FontWeight
Medium.
Sourcepub const W600: FontWeight
pub const W600: FontWeight
Semi-bold.
Sourcepub const W700: FontWeight
pub const W700: FontWeight
Bold.
Sourcepub const W800: FontWeight
pub const W800: FontWeight
Extra-bold.
Sourcepub const W900: FontWeight
pub const W900: FontWeight
Black, the most thick.
Sourcepub const NORMAL: FontWeight = FontWeight::W400
pub const NORMAL: FontWeight = FontWeight::W400
The default font weight.
Sourcepub const BOLD: FontWeight = FontWeight::W700
pub const BOLD: FontWeight = FontWeight::W700
A commonly used font weight that is heavier than normal.
Sourcepub const VALUES: [FontWeight; 9]
pub const VALUES: [FontWeight; 9]
A list of all the named font weights.
Sourcepub fn new(value: i32) -> FontWeight
pub fn new(value: i32) -> FontWeight
Creates a FontWeight object, which can be added to a text style to
select the thickness of a font’s glyphs.
Sourcepub fn index(self) -> i32
pub fn index(self) -> i32
The encoded integer value of this font weight.
Deprecated in Dart in favor of value.
Sourcepub fn lerp(
a: Option<FontWeight>,
b: Option<FontWeight>,
t: f64,
) -> Option<FontWeight>
pub fn lerp( a: Option<FontWeight>, b: Option<FontWeight>, t: f64, ) -> Option<FontWeight>
Linearly interpolates between two font weights.
If both a and b are null, then this method will return null. Otherwise,
any null values for a or b are interpreted as equivalent to NORMAL
(also known as W400).
The t argument represents position on the timeline, with 0.0 meaning
that the interpolation has not started, returning a (or something
equivalent to a), 1.0 meaning that the interpolation has finished,
returning b (or something equivalent to b), and values in between
meaning that the interpolation is at the relevant point on the timeline
between a and b. The interpolation can be extrapolated beyond 0.0 and
1.0, so negative values and values greater than 1.0 are valid. The result
is clamped to the range W100–W900.
Trait Implementations§
Source§impl Clone for FontWeight
impl Clone for FontWeight
Source§fn clone(&self) -> FontWeight
fn clone(&self) -> FontWeight
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for FontWeight
Source§impl Debug for FontWeight
impl Debug for FontWeight
Source§impl Display for FontWeight
impl Display for FontWeight
impl Eq for FontWeight
Source§impl Hash for FontWeight
impl Hash for FontWeight
Source§impl PartialEq for FontWeight
impl PartialEq for FontWeight
impl StructuralPartialEq for FontWeight
Auto Trait Implementations§
impl Freeze for FontWeight
impl RefUnwindSafe for FontWeight
impl Send for FontWeight
impl Sync for FontWeight
impl Unpin for FontWeight
impl UnsafeUnpin for FontWeight
impl UnwindSafe for FontWeight
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.