You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter弹窗列表文本双黄色下划线的去除方法

去除弹窗列表文本黄色双下划线的解决方案

造成这种双下划线的核心原因是你使用的StyleTextUtils.textCode文本样式里,大概率设置了TextDecoration.underline且decorationStyle为TextDecorationStyle.double。以下是几种解决办法:

  • 修改全局样式(推荐)
    找到StyleTextUtils里textCode的定义,添加或修改decoration属性为TextDecoration.none:

    static TextStyle get textCode => TextStyle(
          // 保留你原本的字体大小、颜色等属性
          decoration: TextDecoration.none,
        );
    
  • 局部覆盖样式
    如果不想改动全局的textCode样式,在使用Text组件时单独覆盖下划线属性:

    Text(codeCountryList[index].country,
        style: StyleTextUtils.textCode.copyWith(decoration: TextDecoration.none)),
    // 另一个Text组件同理
    Text(codeCountryList[index].prefix,
        style: StyleTextUtils.textCode.copyWith(decoration: TextDecoration.none)),
    
  • 排查主题影响
    极少数情况是App主题的textTheme设置了默认下划线样式,可检查MaterialApp的theme配置,确保没有给文本默认添加下划线装饰。

内容的提问来源于stack exchange,提问作者Слава Ткаченко

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.01 08:12:48