如何在提示文本中以及扑朔迷离中的dropdownbutton中具有不同的文本溢出样式?
我想将dropdownbutton的提示文本的溢出设置为省略号,但是当我打开下拉列表时,我想在下拉列表中显示整个选择,因此我将其设置为可见 但是,尽管我将其设置在省略号上,但会发生什么提示文本会获得“可见”的效果,该如何解决?
我想发生的事情:
发生了什么:
这是代码
Expanded(
child: DropdownButton(
hint: Text(
widget.choices[0],
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Colors.black,
),
),
iconSize: 40,
isExpanded: true,
style: TextStyle(
color: Colors.black,
),
onChanged: changeValueFunction,
items: widget.choices
.map(
(value) => DropdownMenuItem(
value: value,
child: Text(
value,
overflow: TextOverflow.visible,
style: TextStyle(
),
),
),
)
.toList(),
),
),
I want to set the overflow of hint text of DropdownButton to ellipsis, but I want to show the whole choice in the DropdownMenuItem when I open the dropdown list, so I set it to visible
But what happens is that the hint text gets the "visible" effect despite that I set it to ellipsis, How can I fix this?
What I want to happen:
What happens:
Here is the code
Expanded(
child: DropdownButton(
hint: Text(
widget.choices[0],
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Colors.black,
),
),
iconSize: 40,
isExpanded: true,
style: TextStyle(
color: Colors.black,
),
onChanged: changeValueFunction,
items: widget.choices
.map(
(value) => DropdownMenuItem(
value: value,
child: Text(
value,
overflow: TextOverflow.visible,
style: TextStyle(
),
),
),
)
.toList(),
),
),
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
绘制自定义项目的
use
to draw custom item