English 中文(简体)
如何在没有包的小蝶中执行下调列表?
原标题:how to implement a drop down list in Flutter without packages?
  • 时间:2019-11-06 07:36:28
  •  标签:
  • flutter
  • dart
I Need to implement a collapsible menu with pure dart in a flutter app So Any one can help please ?
最佳回答
if you are building a Material app you should take a look at the DropdownButton Widget. Happy coding!
问题回答
Here is the complete widget of DropdownButton. First initialise a variable to maintain the state int? selectedOption; Put this code in the body DropdownButton( items: [1,2,3,4,5,6,7,8] .map((e) => DropdownMenuItem( child: Text(e.toString(),), value: e, )).toList(), // For list this is important isExpanded: true, hint: Text("Hit Text", style: TextStyle( color:Colors.black, fontSize:14), ), value: selectedOption, onChanged: (int? item) { setState(() { selectedOption = item!; }); })




相关问题
Flutter App cannot be installed on Android TV

I m building a Flutter app that should support Android TV and Mobile devices. Despite Google Play shows that it is supported, I cannot install app on my MiBox device. While trying to install it, both ...

Moving the icon button to the right causes rendering issues

I am trying to align the icon button to the right of the Text field, I tried the row which made the icon button not centered vertically and now I am trying out the Stack widget. Here is my code - ...

热门标签