text_style.dart 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import 'package:flowy_infra/size.dart';
  2. import 'package:flutter/material.dart';
  3. class Fonts {
  4. static String general = "Poppins";
  5. static String monospace = "SF Mono";
  6. static String emoji = "Noto Color Emoji";
  7. }
  8. class TextStyles {
  9. static TextStyle general({
  10. double? fontSize,
  11. FontWeight fontWeight = FontWeight.w500,
  12. Color? color,
  13. }) =>
  14. TextStyle(
  15. fontFamily: Fonts.general,
  16. fontSize: fontSize ?? FontSizes.s12,
  17. color: color,
  18. fontWeight: fontWeight,
  19. fontFamilyFallback: [Fonts.emoji],
  20. letterSpacing: (fontSize ?? FontSizes.s12) * 0.005,
  21. );
  22. static TextStyle monospace({
  23. String? fontFamily,
  24. double? fontSize,
  25. FontWeight fontWeight = FontWeight.w400,
  26. }) =>
  27. TextStyle(
  28. fontFamily: fontFamily ?? Fonts.monospace,
  29. fontSize: fontSize ?? FontSizes.s12,
  30. fontWeight: fontWeight,
  31. fontFamilyFallback: [Fonts.emoji],
  32. );
  33. static TextStyle get title => general(
  34. fontSize: FontSizes.s18,
  35. fontWeight: FontWeight.w600,
  36. );
  37. static TextStyle get subheading => general(
  38. fontSize: FontSizes.s16,
  39. fontWeight: FontWeight.w600,
  40. );
  41. static TextStyle get subtitle => general(
  42. fontSize: FontSizes.s16,
  43. fontWeight: FontWeight.w600,
  44. );
  45. static TextStyle get body1 => general(
  46. fontSize: FontSizes.s12,
  47. fontWeight: FontWeight.w500,
  48. );
  49. static TextStyle get body2 => general(
  50. fontSize: FontSizes.s12,
  51. fontWeight: FontWeight.w400,
  52. );
  53. static TextStyle get callout => general(
  54. fontSize: FontSizes.s11,
  55. fontWeight: FontWeight.w600,
  56. );
  57. static TextStyle get caption => general(
  58. fontSize: FontSizes.s11,
  59. fontWeight: FontWeight.w400,
  60. );
  61. }