// ignore: file_names import 'package:flutter/material.dart'; class FontConstants { static String fontFamily = 'Proxima Nova'; // Base screen width for scaling (iPhone standard: 375) static const double _baseWidth = 375.0; // Base font sizes (for baseWidth = 375) static const double _baseExtraSmall = 10.0; static const double _baseSmall = 12.0; static const double _baseMedium = 14.0; static const double _baseRegular = 16.0; static const double _baseLarge = 20.0; static const double _baseXLarge = 21.0; static const double _baseXXLarge = 22.0; static const double _baseXXXLarge = 24.0; static const double _baseHuge = 30.0; /// Get fixed font size (no width scaling) so small & large phones look same. static double getResponsiveFontSize(BuildContext context, double baseSize) { return baseSize; } /// Extra Small Text (10px base) - For labels, captions static double extraSmall(BuildContext context) => getResponsiveFontSize(context, _baseExtraSmall); /// Small Text (12px base) - For small labels, timestamps static double small(BuildContext context) => getResponsiveFontSize(context, _baseSmall); /// Medium Text (14px base) - For body text, descriptions static double medium(BuildContext context) => getResponsiveFontSize(context, _baseMedium); /// Regular Text (16px base) - Standard body text, most common static double regular(BuildContext context) => getResponsiveFontSize(context, _baseRegular); /// Large Text (18px base) - For subheadings, important text static double large(BuildContext context) => getResponsiveFontSize(context, _baseLarge); /// Extra Large Text (20px base) - For headings, titles static double xLarge(BuildContext context) => getResponsiveFontSize(context, _baseXLarge); /// 2X Large Text (22px base) - For main headings static double xxLarge(BuildContext context) => getResponsiveFontSize(context, _baseXXLarge); /// 3X Large Text (24px base) - For prominent headings static double xxxLarge(BuildContext context) => getResponsiveFontSize(context, _baseXXXLarge); /// Huge Text (26px base) - For hero text, very prominent headings static double huge(BuildContext context) => getResponsiveFontSize(context, _baseHuge); } class ReusableTextWidget extends StatelessWidget { final String text; final double? fontSize; final double? textHeight; final String? fontFamily; final FontWeight? fontWeight; final FontStyle? fontStyle; final Color? color; final TextAlign? textAlign; final int? maxLines; final TextDecoration? isUnderText; const ReusableTextWidget({ super.key, required this.text, this.fontSize, this.textHeight, this.fontFamily, this.fontWeight, this.fontStyle, this.color, this.textAlign, this.maxLines, this.isUnderText, }); @override Widget build(BuildContext context) { return Text( text, softWrap: true, style: TextStyle( fontSize: fontSize ?? FontConstants.medium(context), decoration: isUnderText, fontFamily: fontFamily ?? FontConstants.fontFamily, decorationColor: color, fontWeight: fontWeight ?? FontWeight.normal, fontStyle: fontStyle ?? FontStyle.normal, color: color ?? Colors.grey.shade900, overflow: TextOverflow.ellipsis, decorationStyle: TextDecorationStyle.solid, decorationThickness: 1, height: textHeight, ), maxLines: maxLines, textAlign: textAlign ?? TextAlign.start, ); } }