Dropdown
A DropdownButtonFormField wrapper — items is the same List<DropdownMenuItem<T>> you'd pass to Flutter's own dropdown.
CLI
Install this component into your project:
dropdown
$
flutter_beautify add dropdownVariants
FBDropdown.outlined() · FBDropdown.filled() — the plain constructor forwards to .outlined().
Key parameters
| Parameter | Type | Default |
|---|---|---|
value | T? | — |
items | List<DropdownMenuItem<T>> | required |
onChanged | ValueChanged<T?>? | — |
hintText / labelText | String | 'Select an option' / '' |
isExpanded | bool | true |
Usage
dart
import 'package:your_app/widgets/dropdown.dart';
FBDropdown<String>.outlined(
value: selected,
items: options.map((o) => DropdownMenuItem(value: o, child: Text(o))).toList(),
onChanged: (v) => setState(() => selected = v),
);