tik_theme.dart 2.32 KB
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';

class TikTheme {
  static const Color primaryColor = Colors.grey;
  static const Color secondaryColor = Colors.grey;
  static const Color tertiaryColor = Colors.grey;

  String primaryFontFamily = 'Poppins';
  String secondaryFontFamily = 'Roboto';

  static TextStyle get title1 => GoogleFonts.getFont(
        'Poppins',
        color: const Color(0xFF303030),
        fontWeight: FontWeight.w600,
        fontSize: 24,
      );

  static TextStyle get title2 => GoogleFonts.getFont(
        'Poppins',
        color: const Color(0xFF303030),
        fontWeight: FontWeight.w500,
        fontSize: 22,
      );

  static TextStyle get title3 => GoogleFonts.getFont(
        'Poppins',
        color: const Color(0xFF303030),
        fontWeight: FontWeight.w500,
        fontSize: 20,
      );

  static TextStyle get subtitle1 => GoogleFonts.getFont(
        'Poppins',
        color: const Color(0xFF757575),
        fontWeight: FontWeight.w500,
        fontSize: 18,
      );

  static TextStyle get subtitle2 => GoogleFonts.getFont(
        'Poppins',
        color: const Color(0xFF616161),
        fontWeight: FontWeight.normal,
        fontSize: 16,
      );

  static TextStyle get bodyText1 => GoogleFonts.getFont(
        'Poppins',
        color: const Color(0xFF303030),
        fontWeight: FontWeight.normal,
        fontSize: 14,
      );

  static TextStyle get bodyText2 => GoogleFonts.getFont(
        'Poppins',
        color: const Color(0xFF424242),
        fontWeight: FontWeight.normal,
        fontSize: 14,
      );
}

extension TextStyleHelper on TextStyle {
  TextStyle override({
    required String fontFamily,
    required Color color,
    double? fontSize,
    FontWeight? fontWeight,
    FontStyle? fontStyle,
    bool useGoogleFonts = true,
  }) =>
      useGoogleFonts
          ? GoogleFonts.getFont(
              fontFamily,
              color: this.color,
              fontSize: fontSize ?? this.fontSize,
              fontWeight: fontWeight ?? this.fontWeight,
              fontStyle: fontStyle ?? this.fontStyle,
            )
          : copyWith(
              fontFamily: fontFamily,
              color: color,
              fontSize: fontSize,
              fontWeight: fontWeight,
              fontStyle: fontStyle,
            );
}