Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

dropdown

final List<String> items = [   'Item1',   'Item2',   'Item3',   'Item4', ]; String? selectedValue;  @override Widget build(BuildContext context) {   return Scaffold(     body: Center(       child: DropdownButtonHideUnderline(         child: DropdownButton2(           hint: Text(             'Select Item',             style: TextStyle(               fontSize: 14,               color: Theme                       .of(context)                       .hintColor,             ),           ),           items: items                   .map((item) =>                   DropdownMenuItem<String>(                     value: item,                     child: Text(                       item,                       style: const TextStyle(                         fontSize: 14,                       ),                     ),                   ))                   .toList(),           value: selectedValue,           onChanged: (value) {             setState(() {               selectedValue = value as String;             });           },           buttonHeight: 40,           buttonWidth: 140,           itemHeight: 40,         ),       ),     ),   ); }
Source by fontenele.github.io #
 
PREVIOUS NEXT
Tagged: #dropdown
ADD COMMENT
Topic
Name
6+2 =