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,提问作者Слава Ткаченко
相关产品推荐
相关产品推荐

