app_text_span.dart 938 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import 'package:flutter/material.dart';
  2. class AppTextSpan extends StatelessWidget {
  3. final String text1;
  4. final String text2;
  5. final Color? text1Color;
  6. final Color? text2Color;
  7. final double fontSize;
  8. const AppTextSpan({
  9. super.key,
  10. required this.text1,
  11. required this.text2,
  12. required this.fontSize,
  13. this.text1Color,
  14. this.text2Color,
  15. });
  16. @override
  17. Widget build(BuildContext context) {
  18. return RichText(
  19. text: TextSpan(
  20. style: TextStyle(
  21. fontSize: fontSize,
  22. color: Colors.black,
  23. ),
  24. children: [
  25. TextSpan(
  26. text: '$text1: ',
  27. style: TextStyle(
  28. color: text1Color,
  29. fontWeight: FontWeight.bold,
  30. ),
  31. ),
  32. TextSpan(
  33. text: text2,
  34. style: TextStyle(
  35. color: text2Color,
  36. ),
  37. ),
  38. ],
  39. ),
  40. );
  41. }
  42. }