under_line_text.dart 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import 'package:flutter/material.dart';
  2. /// @author: bo.zeng
  3. /// @email: cnhbwds@gmail.com
  4. /// @date: 2025 2025/4/9 16:00
  5. /// @description:
  6. class UnderlineText extends StatelessWidget {
  7. final String text;
  8. final double fontSize;
  9. final Color color;
  10. final FontWeight fontWeight;
  11. final TextDecorationStyle decorationStyle;
  12. final double decorationThickness;
  13. final Color? decorationColor;
  14. final TextAlign textAlign;
  15. const UnderlineText({
  16. super.key,
  17. required this.text,
  18. this.fontSize = 16,
  19. this.color = Colors.black,
  20. this.fontWeight = FontWeight.normal,
  21. this.decorationStyle = TextDecorationStyle.solid,
  22. this.decorationThickness = 1.0,
  23. this.decorationColor,
  24. this.textAlign = TextAlign.start,
  25. });
  26. @override
  27. Widget build(BuildContext context) {
  28. return Text(
  29. text,
  30. textAlign: textAlign,
  31. style: TextStyle(
  32. fontSize: fontSize,
  33. fontWeight: fontWeight,
  34. color: color,
  35. decoration: TextDecoration.underline,
  36. decorationStyle: decorationStyle,
  37. decorationThickness: decorationThickness,
  38. decorationColor: decorationColor ?? color,
  39. ),
  40. );
  41. }
  42. }