| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import 'package:flutter/material.dart';
- /// @author: bo.zeng
- /// @email: cnhbwds@gmail.com
- /// @date: 2025 2025/4/9 16:00
- /// @description:
- class UnderlineText extends StatelessWidget {
- final String text;
- final double fontSize;
- final Color color;
- final FontWeight fontWeight;
- final TextDecorationStyle decorationStyle;
- final double decorationThickness;
- final Color? decorationColor;
- final TextAlign textAlign;
- const UnderlineText({
- super.key,
- required this.text,
- this.fontSize = 16,
- this.color = Colors.black,
- this.fontWeight = FontWeight.normal,
- this.decorationStyle = TextDecorationStyle.solid,
- this.decorationThickness = 1.0,
- this.decorationColor,
- this.textAlign = TextAlign.start,
- });
- @override
- Widget build(BuildContext context) {
- return Text(
- text,
- textAlign: textAlign,
- style: TextStyle(
- fontSize: fontSize,
- fontWeight: fontWeight,
- color: color,
- decoration: TextDecoration.underline,
- decorationStyle: decorationStyle,
- decorationThickness: decorationThickness,
- decorationColor: decorationColor ?? color,
- ),
- );
- }
- }
|