Flutter DROPDOWN INPUT
A simple dropdown input widget.
Installation
Add dropdown_input
as a dependency in your pubspec.yaml file (what?).
dropdown_input: ^0.0.1
Import Dropdown Input:
import 'package:dropdown_input/dropdown_input.dart';
Basic usage
Given a List<Map<String, dynamic> optionsList
and String filterField
as parameters:
List<Map<String, dynamic>> optionsList = [
{
"name": "grey",
"id": "1"
},
{
"name": "green",
"id": "2"
},
{
"name": "red",
"id": "3"
},
{
"name": "orange",
"id": "4"
}
];
@override
Widget build(BuildContext context) {
return DropdownInput(
optionsList: optionsList,
filterField: "name",
onItemSelected: (item) {
print(item);
},
);
}
Result
| | | | | |