flutter 隐藏中间省略号

narakuyang
2023-02-09 / 0 评论 / 177 阅读 / 正在检测是否收录...

class systemOverflowTextCenter extends StatelessWidget {
  final String text;
  final Color? color;
  const systemOverflowTextCenter({Key? key, required this.text, this.color})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    String? overText;

    overText = text.replaceRange(
        text.length - (text.length - 4), text.length - 4, '......');
    return Text(
      overText,
      style: GoogleFonts.notoSans(
          color: color != null ? color : appColor.white,
          fontWeight: FontWeight.bold),
    );
  }
}
0

评论

博主关闭了所有页面的评论