getTextStyle function
TextStyle
getTextStyle(
- Typographies typography,
- bool emphasis, {
- SeniorThemeData? theme,
- Color? color,
- Color? darkColor,
- TextStyle? style,
Implementation
TextStyle getTextStyle(
Typographies typography,
bool emphasis, {
SeniorThemeData? theme,
Color? color,
Color? darkColor,
TextStyle? style,
}) {
Color? _customColor = theme?.themeType == ThemeType.light ? color : darkColor;
switch (typography) {
case Typographies.h1:
_customColor ??= emphasis
? theme?.textTheme?.h1Style?.emphasisColor
: theme?.textTheme?.h1Style?.color;
return SeniorTypography.h1(
color: _customColor,
).merge(style);
case Typographies.h2:
_customColor ??= emphasis
? theme?.textTheme?.h2Style?.emphasisColor
: theme?.textTheme?.h2Style?.color;
return SeniorTypography.h2(
color: _customColor,
).merge(style);
case Typographies.h3:
_customColor ??= emphasis
? theme?.textTheme?.h3Style?.emphasisColor
: theme?.textTheme?.h3Style?.color;
return SeniorTypography.h3(
color: _customColor,
).merge(style);
case Typographies.h4:
_customColor ??= emphasis
? theme?.textTheme?.h4Style?.emphasisColor
: theme?.textTheme?.h4Style?.color;
return SeniorTypography.h4(
color: _customColor,
).merge(style);
case Typographies.cta:
_customColor ??= emphasis
? theme?.textTheme?.ctaStyle?.emphasisColor
: theme?.textTheme?.ctaStyle?.color;
return SeniorTypography.cta(
color: _customColor,
).merge(style);
case Typographies.label:
_customColor ??= emphasis
? theme?.textTheme?.labelStyle?.emphasisColor
: theme?.textTheme?.labelStyle?.color;
return SeniorTypography.label(
color: _customColor,
).merge(style);
case Typographies.labelBold:
_customColor ??= emphasis
? theme?.textTheme?.labelBoldStyle?.emphasisColor
: theme?.textTheme?.bodyBoldStyle?.color;
return SeniorTypography.labelBold(
color: _customColor,
).merge(style);
case Typographies.body:
_customColor ??= emphasis
? theme?.textTheme?.bodyStyle?.emphasisColor
: theme?.textTheme?.bodyStyle?.color;
return SeniorTypography.body(
color: _customColor,
).merge(style);
case Typographies.bodyBold:
_customColor ??= emphasis
? theme?.textTheme?.bodyBoldStyle?.emphasisColor
: theme?.textTheme?.bodyBoldStyle?.color;
return SeniorTypography.bodyBold(
color: _customColor,
).merge(style);
case Typographies.small:
_customColor ??= emphasis
? theme?.textTheme?.smallStyle?.emphasisColor
: theme?.textTheme?.smallStyle?.color;
return SeniorTypography.small(
color: _customColor,
).merge(style);
case Typographies.smallBold:
_customColor ??= emphasis
? theme?.textTheme?.smallBoldStyle?.emphasisColor
: theme?.textTheme?.smallBoldStyle?.color;
return SeniorTypography.smallBold(
color: _customColor,
).merge(style);
case Typographies.smallLink:
_customColor ??= emphasis
? theme?.textTheme?.smallLinkStyle?.emphasisColor
: theme?.textTheme?.smallLinkStyle?.color;
return SeniorTypography.smallLink(
color: _customColor,
).merge(style);
}
}