textStyle method

  1. @protected
TextStyle textStyle(
  1. BuildContext context
)

Returns the TextStyle associated with size and weight in the active theme.

Implementation

@protected
TextStyle textStyle(BuildContext context) {
  final typography = OudsTheme.of(context).typographyTokens;
  switch (weight) {
    case OudsTextWeight.defaultWeight:
      switch (size) {
        case OudsLabelTextSize.xLarge:
          return typography.typeLabelDefaultXLarge(context);
        case OudsLabelTextSize.large:
          return typography.typeLabelDefaultLarge(context);
        case OudsLabelTextSize.medium:
          return typography.typeLabelDefaultMedium(context);
        case OudsLabelTextSize.small:
          return typography.typeLabelDefaultSmall(context);
      }
    case OudsTextWeight.moderate:
      switch (size) {
        case OudsLabelTextSize.xLarge:
          return typography.typeLabelModerateXLarge(context);
        case OudsLabelTextSize.large:
          return typography.typeLabelModerateLarge(context);
        case OudsLabelTextSize.medium:
          return typography.typeLabelModerateMedium(context);
        case OudsLabelTextSize.small:
          return typography.typeLabelModerateSmall(context);
      }
    case OudsTextWeight.strong:
      switch (size) {
        case OudsLabelTextSize.xLarge:
          return typography.typeLabelStrongXLarge(context);
        case OudsLabelTextSize.large:
          return typography.typeLabelStrongLarge(context);
        case OudsLabelTextSize.medium:
          return typography.typeLabelStrongMedium(context);
        case OudsLabelTextSize.small:
          return typography.typeLabelStrongSmall(context);
      }
  }
}