【发布时间】:2021-12-01 03:42:54
【问题描述】:
在我的一个动作芯片上,标签上出现了这条灰色下划线。仅供参考,这是 Flutter Web,它似乎只发生在 Chrome Android 上,从不在 iOS Safari 或桌面 Chrome 上。
动作芯片充当过滤器按钮,单击该按钮后,您可以选择不同的值。只有某些值才会显示此下划线。我熟悉颤动的黄色下划线错误,但这种灰色对我来说是新的。
ActionChip(
label: Text(_label(),
style: Theme.of(context).textTheme.bodyText2.copyWith(
color: (_hasSelectedFilters())
? AppTheme.filterText
: AppTheme.highEmphasis)),
backgroundColor: Colors.transparent,
side: BorderSide(
color: (_hasSelectedFilters())
? AppTheme.highEmphasis
: AppTheme.mediumEmphasis,
width: 1.0),
labelPadding: EdgeInsets.only(left: 8.0, right: 8.0),
onPressed: _showFilters,
)
String _label() {
if (!_hasSelectedFilters()) {
return "Material type";
} else if (widget.controller.selectedFilters.length == 1) {
return _filters
.firstWhere((element) =>
element.value.code == widget.controller.selectedFilters.first)
.label;
} else {
return "${widget.controller.selectedFilters.length} materials";
}
}
更新:我能够通过将 Text 小部件更改为 RichText 小部件来解决它。但是,它解决了它很奇怪,因为 Text 小部件是 RichText 的包装器。
【问题讨论】:
标签: flutter google-chrome flutter-web google-chrome-android