buildText method

Widget buildText(
  1. BuildContext context, {
  2. TextAlign? alignment,
})

Implementation

Widget buildText(BuildContext context, {TextAlign? alignment}) {
  TextStyle style = styleGetter(Theme.of(context).textTheme)!;
  style = style.copyWith(color: color);
  switch (fontType) {
    case FontType.light:
      // Is there ever a bold or medium in the light color?
      style = style.copyWith(fontWeight: FontWeight.normal, color: _lightColor);
      break;
    case FontType.normal:
      style = style.copyWith(fontWeight: FontWeight.w400);
      break;
    case FontType.medium:
      style = style.copyWith(fontWeight: FontWeight.w500);
      break;
    case FontType.bold:
      style = style.copyWith(fontWeight: FontWeight.w900);
      break;
  }

  return Text(
    text ?? '',
    style: style,
    overflow: overflow,
    maxLines: maxLines,
    softWrap: softWrap,
    textAlign: alignment,
  );
}