如何删除 DropdownButton 中的高程?

问题描述

帮助我删除 DropdownButton 中的此高度,我尝试使用 elevation = 0,但没有任何反应,或者如果您有更好的小部件来显示 DropdownButton 之类的项目,请告诉我。

enter image description here

谢谢

解决方法

要删除下划线,我们应该用 DropdownButton 小部件包裹 DropdownButtonHideUnderline 小部件。

elevation 属性将使下拉层处于打开状态时升高。

示例

DropdownButtonHideUnderline(
          child: DropdownButton(
            style: TextStyle(color: Colors.black),items: <String>[
              'Android','IOS','Flutter','Python',].map<DropdownMenuItem<String>>((String value) {
              return DropdownMenuItem<String>(
                value: value,child: Text(value),);
            }).toList(),hint: Text(
              "Please choose a langauage",style: TextStyle(
                  color: Colors.black,fontSize: 16,fontWeight: FontWeight.w600),),onChanged: (value) {
              print(value);
            },