Skip to content

Dropdown ​

A DropdownButtonFormField wrapper — items is the same List<DropdownMenuItem<T>> you'd pass to Flutter's own dropdown.

View source on GitHub ↗

CLI ​

Install this component into your project:

dropdown
$flutter_beautify add dropdown

Variants ​

FBDropdown.outlined() · FBDropdown.filled() — the plain constructor forwards to .outlined().

Key parameters ​

ParameterTypeDefault
valueT?—
itemsList<DropdownMenuItem<T>>required
onChangedValueChanged<T?>?—
hintText / labelTextString'Select an option' / ''
isExpandedbooltrue

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),
);

Released under the MIT License.