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 OudsBodyTextSize.large:
          return typography.typeBodyDefaultLarge(context);
        case OudsBodyTextSize.medium:
          return typography.typeBodyDefaultMedium(context);
        case OudsBodyTextSize.small:
          return typography.typeBodyDefaultSmall(context);
      }
    case OudsTextWeight.moderate:
      switch (size) {
        case OudsBodyTextSize.large:
          return typography.typeBodyModerateLarge(context);
        case OudsBodyTextSize.medium:
          return typography.typeBodyModerateMedium(context);
        case OudsBodyTextSize.small:
          return typography.typeBodyModerateSmall(context);
      }
    case OudsTextWeight.strong:
      switch (size) {
        case OudsBodyTextSize.large:
          return typography.typeBodyStrongLarge(context);
        case OudsBodyTextSize.medium:
          return typography.typeBodyStrongMedium(context);
        case OudsBodyTextSize.small:
          return typography.typeBodyStrongSmall(context);
      }
  }
}