getTextFontWeight static method

FontWeight? getTextFontWeight(
  1. BuildContext context, {
  2. UpStyle? override,
  3. UpStyle? style,
  4. UpColorType? colorType,
  5. UpTextType? textType,
})

Implementation

static FontWeight? getTextFontWeight(
  BuildContext context, {
  UpStyle? override,
  UpStyle? style,
  UpColorType? colorType,
  UpTextType? textType,
}) {
  switch (textType) {
    case UpTextType.heading1:
      return override?.heading1Weight ??
          style?.heading1Weight ??
          getStyleByType(UpConfig.of(context).theme, colorType)
              .heading1Weight ??
          UpConstants.kDefaultStyleHeading1Weight;
    case UpTextType.heading2:
      return override?.heading2Weight ??
          style?.heading2Weight ??
          getStyleByType(UpConfig.of(context).theme, colorType)
              .heading2Weight ??
          UpConstants.kDefaultStyleHeading2Weight;
    case UpTextType.heading3:
      return override?.heading3Weight ??
          style?.heading3Weight ??
          getStyleByType(UpConfig.of(context).theme, colorType)
              .heading3Weight ??
          UpConstants.kDefaultStyleHeading3Weight;
    case UpTextType.heading4:
      return override?.heading4Weight ??
          style?.heading4Weight ??
          getStyleByType(UpConfig.of(context).theme, colorType)
              .heading4Weight ??
          UpConstants.kDefaultStyleHeading4Weight;
    case UpTextType.heading5:
      return override?.heading5Weight ??
          style?.heading5Weight ??
          getStyleByType(UpConfig.of(context).theme, colorType)
              .heading5Weight ??
          UpConstants.kDefaultStyleHeading5Weight;
    case UpTextType.heading6:
      return override?.heading6Weight ??
          style?.heading6Weight ??
          getStyleByType(UpConfig.of(context).theme, colorType)
              .heading6Weight ??
          UpConstants.kDefaultStyleHeading6Weight;
    case UpTextType.paragraph:
      return override?.paragraphWeight ??
          style?.paragraphWeight ??
          getStyleByType(UpConfig.of(context).theme, colorType)
              .paragraphWeight ??
          UpConstants.kDefaultStyleParagraphWeight;

    default:
      return override?.textWeight ??
          style?.textWeight ??
          getStyleByType(UpConfig.of(context).theme, colorType).textWeight ??
          UpConstants.kDefaultStyleDefaultTextWeight;
  }
}