// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint

import 'package:flutter/material.dart';
import 'package:my_app/gen/colors.gen.dart';
import 'package:my_app/gen/fonts.gen.dart';

enum AppTypographyStyle {
  titleRobotoRegular,
  titleRobotoBold,
  bodyRoboto,
  headingRobotoSlab,
  captionRobotoSlab,
}

extension CustomTextTheme on TextTheme {
  TextStyle get titleRobotoRegular => const TextStyle(
    fontFamily: FontFamily.roboto,
    fontSize: 72,
    height: 88 / 72,
    fontWeight: FontWeight.w400,
    letterSpacing: -0.8,
  );

  TextStyle get titleRobotoBold => const TextStyle(
    fontFamily: FontFamily.roboto,
    fontSize: 72,
    height: 88 / 72,
    fontWeight: FontWeight.w700,
    letterSpacing: -0.8,
  );

  TextStyle get bodyRoboto => const TextStyle(
    fontFamily: FontFamily.roboto,
    fontSize: 16,
    height: 24 / 16,
  );

  TextStyle get headingRobotoSlab => const TextStyle(
    fontFamily: FontFamily.robotoSlab,
    fontSize: 56,
    height: 68 / 56,
    fontWeight: FontWeight.w600,
    letterSpacing: -0.5,
  );

  TextStyle get captionRobotoSlab => const TextStyle(
    fontFamily: FontFamily.robotoSlab,
    fontSize: 10,
    fontWeight: FontWeight.w500,
  );
}

class AppTypography extends StatelessWidget {
  AppTypography._({
    required this.text,
    required AppTypographyStyle style,
    this.textAlign = TextAlign.start,
    this.color,
    this.maxLines,
    this.overflow,
    this.decoration,
    this.fontStyle,
    this.fontWeight,
    this.height,
    super.key,
  }) : _style = style;

  factory AppTypography.titleRobotoRegular(
    String text, {
    TextAlign textAlign = TextAlign.start,
    Color? color,
    int? maxLines,
    TextOverflow? overflow,
    TextDecoration? decoration,
    FontWeight? fontWeight,
    FontStyle? fontStyle,
    double? height,
    Key? key,
  }) => AppTypography._(
    text: text,
    style: AppTypographyStyle.titleRobotoRegular,
    textAlign: textAlign,
    color: color,
    maxLines: maxLines,
    overflow: overflow,
    decoration: decoration,
    fontWeight: fontWeight,
    fontStyle: fontStyle,
    height: height,
    key: key,
  );

  factory AppTypography.titleRobotoBold(
    String text, {
    TextAlign textAlign = TextAlign.start,
    Color? color,
    int? maxLines,
    TextOverflow? overflow,
    TextDecoration? decoration,
    FontWeight? fontWeight,
    FontStyle? fontStyle,
    double? height,
    Key? key,
  }) => AppTypography._(
    text: text,
    style: AppTypographyStyle.titleRobotoBold,
    textAlign: textAlign,
    color: color,
    maxLines: maxLines,
    overflow: overflow,
    decoration: decoration,
    fontWeight: fontWeight,
    fontStyle: fontStyle,
    height: height,
    key: key,
  );

  factory AppTypography.bodyRoboto(
    String text, {
    TextAlign textAlign = TextAlign.start,
    Color? color,
    int? maxLines,
    TextOverflow? overflow,
    TextDecoration? decoration,
    FontWeight? fontWeight,
    FontStyle? fontStyle,
    double? height,
    Key? key,
  }) => AppTypography._(
    text: text,
    style: AppTypographyStyle.bodyRoboto,
    textAlign: textAlign,
    color: color,
    maxLines: maxLines,
    overflow: overflow,
    decoration: decoration,
    fontWeight: fontWeight,
    fontStyle: fontStyle,
    height: height,
    key: key,
  );

  factory AppTypography.headingRobotoSlab(
    String text, {
    TextAlign textAlign = TextAlign.start,
    Color? color,
    int? maxLines,
    TextOverflow? overflow,
    TextDecoration? decoration,
    FontWeight? fontWeight,
    FontStyle? fontStyle,
    double? height,
    Key? key,
  }) => AppTypography._(
    text: text,
    style: AppTypographyStyle.headingRobotoSlab,
    textAlign: textAlign,
    color: color,
    maxLines: maxLines,
    overflow: overflow,
    decoration: decoration,
    fontWeight: fontWeight,
    fontStyle: fontStyle,
    height: height,
    key: key,
  );

  factory AppTypography.captionRobotoSlab(
    String text, {
    TextAlign textAlign = TextAlign.start,
    Color? color,
    int? maxLines,
    TextOverflow? overflow,
    TextDecoration? decoration,
    FontWeight? fontWeight,
    FontStyle? fontStyle,
    double? height,
    Key? key,
  }) => AppTypography._(
    text: text,
    style: AppTypographyStyle.captionRobotoSlab,
    textAlign: textAlign,
    color: color,
    maxLines: maxLines,
    overflow: overflow,
    decoration: decoration,
    fontWeight: fontWeight,
    fontStyle: fontStyle,
    height: height,
    key: key,
  );

  final String text;
  final AppTypographyStyle _style;
  final Color? color;
  final TextAlign textAlign;
  final int? maxLines;
  final TextOverflow? overflow;
  final TextDecoration? decoration;
  final FontStyle? fontStyle;
  final FontWeight? fontWeight;
  final double? height;

  static Color get defaultColor => ColorName.gray900;

  @override
  Widget build(BuildContext context) {
    final textTheme = Theme.of(context).textTheme;
    final textStyle = switch (_style) {
      AppTypographyStyle.titleRobotoRegular => textTheme.titleRobotoRegular,
      AppTypographyStyle.titleRobotoBold => textTheme.titleRobotoBold,
      AppTypographyStyle.bodyRoboto => textTheme.bodyRoboto,
      AppTypographyStyle.headingRobotoSlab => textTheme.headingRobotoSlab,
      AppTypographyStyle.captionRobotoSlab => textTheme.captionRobotoSlab,
    };
    return Text(
      text,
      style: textStyle.copyWith(
        color: color ?? defaultColor,
        decoration: decoration,
        decorationColor: color ?? defaultColor,
        fontStyle: fontStyle,
        fontWeight: fontWeight ?? textStyle.fontWeight,
        height: height,
      ),
      textScaler: TextScaler.noScaling,
      textAlign: textAlign,
      maxLines: maxLines,
      overflow: overflow,
    );
  }
}
