calseeDisplayStyle function
TextStyle
calseeDisplayStyle(
- BuildContext context,
- double size, {
- Color? color,
- FontWeight weight = FontWeight.w400,
The theme's display text style at size: its display font and weight,
tabular figures and the family's display treatment (Retro's LCD glow).
color defaults to CalseeTextColors.primary for where context sits.
Implementation
TextStyle calseeDisplayStyle(
BuildContext context,
double size, {
Color? color,
FontWeight weight = FontWeight.w400,
}) {
final theme = CalcTheme.of(context);
final family =
theme.displayFontFamily ?? DefaultTextStyle.of(context).style.fontFamily;
final font = BundledFont.fromFamily(theme.displayFontFamily);
final themed = theme.displayFace == null ? theme.displayWeight : null;
final css = themed != null && font.isBundled
? (themed + weight.value - 400).clamp(100, 1000).toDouble()
: null;
final style = TextStyle(
color: color ?? CalseeTextColors.of(context).primary,
fontSize: size,
fontWeight: css == null ? weight : nearestFontWeight(css),
fontVariations: css == null
? null
: font.variations(weight: css, fontSize: size),
fontFamily: family,
fontFamilyFallback: scriptFallbackFonts,
fontFeatures: const [FontFeature.tabularFigures()],
height: 1.1,
);
return theme.displayFace?.textStyle(style) ?? style;
}