Last updated:
0 purchases
flutter dropdown x
Flutter Dropdown X #
Flutter Dropdown X is a dropdown field using a dropdown button inside a form field.
Getting started #
Add dependency #
flutter_dropdown_x: ^0.0.2
copied to clipboard
Import it #
import 'package:flutter_dropdown_x/flutter_dropdown_x.dart';
copied to clipboard
Usage #
JSON implementation #
String _selected = "";
var data = [
{'id': "1", 'value': 'value1'},
{'id': "2", 'value': 'value2'},
{'id': "3", 'value': 'value3'},
{'id': "4", 'value': 'value4'},
{'id': "5", 'value': 'value5'},
{'id': "6", 'value': 'value6'},
];
DropDownField(
value: _selected,
hintText: 'Please choose one',
dataSource: data,
onChanged: (v) {
print(v);
setState(() {
_selected = v;
});
},
valueField: 'id',
textField: 'value',
),
copied to clipboard
Example #
String _selected = "";
DropDownField(
hintText: 'Please choose one',
value: _selected,
onChanged: (v) {
setState(() {
_selected = v;
});
},
dataSource: const [
{
"display": "value 1",
"value": "1",
},
{
"display": "value 2",
"value": "2",
}
],
textField: 'display',
valueField: 'value',
),
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.