【问题标题】:Flutter drop down arrow position颤振下拉箭头位置
【发布时间】:2021-09-05 17:41:12
【问题描述】:

我能够正确显示下拉菜单,但问题是箭头出现在最后,并且下拉菜单包含一些小字和大字,箭头会根据大字进行调整。 我试图隐藏箭头并在文本行中显示一个虚拟箭头,但这也将在下拉列表中可见 如何显示带有文本结尾的箭头

【问题讨论】:

  • 我认为您可以将下拉列表或文本包装在具有固定宽度的容器内,然后它将在所有文本中保持不变。

标签: android ios flutter flutter-layout flutter-dependencies


【解决方案1】:

你可以试试这个

  1. 在您的DropdownButton 中使用此属性isExpanded: true,

像这样:

 DrowpdownButton(
   //other attributes..
   isExpanded: true,
 )
  1. 如果这不起作用,请将您的 DropdownButton 包裹在 Row 中并使用 Expanded

像这样:

根据您的代码或排列的小部件,这可能会产生错误

Row(
  mainAxisSize: MainAxisSize.max
  children:[
    Expanded(
      flex:1.
      child: DrowdownButton(
             //Other attr
             isExpanded: true,
           )
       )
   ]
)

先尝试第一个,然后再尝试第二个。

【讨论】:

    猜你喜欢
    • 2020-05-27
    • 2019-05-25
    • 1970-01-01
    • 1970-01-01
    • 2021-04-21
    • 2021-11-25
    • 2021-07-22
    • 1970-01-01
    • 2020-12-08
    相关资源
    最近更新 更多