@@ -28,6 +28,11 @@ const EdgeInsets _kMenuItemPadding = EdgeInsets.symmetric(horizontal: 16.0);
2828const EdgeInsetsGeometry _kAlignedButtonPadding = EdgeInsetsDirectional .only (start: 16.0 , end: 4.0 );
2929const EdgeInsets _kUnalignedButtonPadding = EdgeInsets .zero;
3030
31+ /// A builder to customize dropdown buttons.
32+ ///
33+ /// Used by [DropdownButton2.selectedItemBuilder] .
34+ typedef DropdownButton2Builder = Iterable <Widget > Function (BuildContext context);
35+
3136/// A builder to customize the selected menu item.
3237typedef SelectedMenuItemBuilder = Widget Function (BuildContext context, Widget child);
3338
@@ -191,7 +196,7 @@ class DropdownButton2<T> extends StatefulWidget {
191196 ///
192197 /// If this callback is null, the [DropdownItem] from [items]
193198 /// that matches the selected [DropdownItem] 's value will be displayed.
194- final DropdownButtonBuilder ? selectedItemBuilder;
199+ final DropdownButton2Builder ? selectedItemBuilder;
195200
196201 /// A [ValueListenable] that represents the value of the currently selected [DropdownItem] .
197202 /// It holds a value of type `T?` , where `T` represents the type of [DropdownItem] 's value.
@@ -213,7 +218,7 @@ class DropdownButton2<T> extends StatefulWidget {
213218 /// If the list is empty and the button is disabled, [disabledHint] will be displayed
214219 /// if it is non-null. If [disabledHint] is null, then [hint] will be displayed
215220 /// if it is non-null.
216- final ValueListenable <List <T >>? multiValueListenable;
221+ final ValueListenable <Iterable <T >>? multiValueListenable;
217222
218223 /// A placeholder widget that is displayed by the dropdown button.
219224 ///
@@ -1021,9 +1026,9 @@ class DropdownButtonFormField2<T> extends FormField<T> {
10211026 DropdownButtonFormField2 ({
10221027 super .key,
10231028 required List <DropdownItem <T >>? items,
1024- DropdownButtonBuilder ? selectedItemBuilder,
1029+ DropdownButton2Builder ? selectedItemBuilder,
10251030 ValueListenable <T ?>? valueListenable,
1026- ValueListenable <List <T >>? multiValueListenable,
1031+ ValueListenable <Iterable <T >>? multiValueListenable,
10271032 Widget ? hint,
10281033 Widget ? disabledHint,
10291034 this .onChanged,
0 commit comments