|
| 1 | +## 3.0.0 |
| 2 | + |
| 3 | +A stable release for DropdownButton2 3.0! |
| 4 | + |
| 5 | +### Breaking Changes |
| 6 | + |
| 7 | +- **Replaces DropdownMenuItem with DropdownItem** to provide extra functionality. |
| 8 | + |
| 9 | + Instead of: |
| 10 | + |
| 11 | + ```dart |
| 12 | + items: items.map((String item) => DropdownMenuItem<String>(...)).toList(), |
| 13 | + ``` |
| 14 | + |
| 15 | + do: |
| 16 | + |
| 17 | + ```dart |
| 18 | + items: items.map((String item) => DropdownItem<String>(...)).toList(), |
| 19 | + ``` |
| 20 | + |
| 21 | +- **Support setting different heights for items.** Item height is now set per-item instead of globally. |
| 22 | + |
| 23 | + Instead of: |
| 24 | + |
| 25 | + ```dart |
| 26 | + items: items |
| 27 | + .map((String item) => DropdownItem<String>( |
| 28 | + value: item, |
| 29 | + child: Text(item), |
| 30 | + )) |
| 31 | + .toList(), |
| 32 | + menuItemStyleData: const MenuItemStyleData( |
| 33 | + height: 40, |
| 34 | + ), |
| 35 | + ``` |
| 36 | + |
| 37 | + do: |
| 38 | + |
| 39 | + ```dart |
| 40 | + items: items |
| 41 | + .map((String item) => DropdownItem<String>( |
| 42 | + value: item, |
| 43 | + height: 40, |
| 44 | + child: Text(item), |
| 45 | + )) |
| 46 | + .toList(), |
| 47 | + ``` |
| 48 | + |
| 49 | +- **Add `openDropdownListenable` property** to programmatically open the dropdown menu. |
| 50 | + |
| 51 | + Instead of: |
| 52 | + |
| 53 | + ```dart |
| 54 | + final dropdownKey = GlobalKey<DropdownButton2State>(); |
| 55 | +
|
| 56 | + @override |
| 57 | + Widget build(BuildContext context) { |
| 58 | + return Column( |
| 59 | + children:[ |
| 60 | + DropdownButton2<String>( |
| 61 | + // Other properties... |
| 62 | + key: dropdownKey, |
| 63 | + ); |
| 64 | + // Open the dropdown programmatically: |
| 65 | + ElevatedButton( |
| 66 | + onTap: () => dropdownKey.currentState!.callTap(), |
| 67 | + ), |
| 68 | + ], |
| 69 | + ); |
| 70 | + } |
| 71 | + ``` |
| 72 | + |
| 73 | + do: |
| 74 | + |
| 75 | + ```dart |
| 76 | + final openDropdownListenable = ValueNotifier<Object?>(null); |
| 77 | +
|
| 78 | + @override |
| 79 | + Widget build(BuildContext context) { |
| 80 | + return Column( |
| 81 | + children:[ |
| 82 | + DropdownButton2<String>( |
| 83 | + // Other properties... |
| 84 | + openDropdownListenable: openDropdownListenable, |
| 85 | + ); |
| 86 | + // Open the dropdown programmatically: |
| 87 | + ElevatedButton( |
| 88 | + onTap: () => openDropdownListenable.value = Object(), |
| 89 | + ), |
| 90 | + ], |
| 91 | + ); |
| 92 | + } |
| 93 | + ``` |
| 94 | + |
| 95 | +- Rename searchInnerWidget[Height] to searchBarWidget[Height]. |
| 96 | + |
| 97 | +### New Features |
| 98 | + |
| 99 | +- Add `closeOnTap` property to DropdownItem. It controls whether the dropdown should close when the item is tapped. |
| 100 | +- Add intrinsicHeight property to DropdownItem. This enables setting item's height according to its intrinsic height. |
| 101 | +- Support adding separator widget internally, closes #134. |
| 102 | +- Introduce `valueListenable` and `multiValueListenable`, which replaces SetState with ValueListenable. |
| 103 | +- Support implementing select all option (Check multi-select example), closes #121 and #167. |
| 104 | +- Add the possibility to display a dropdown menu centered through `DropdownDirection.center`. |
| 105 | +- Add `barrierCoversButton` property, used to specify whether the modal barrier should cover the dropdown button or not. |
| 106 | +- Add `foregroundDecoration` property for ButtonStyleData. |
| 107 | +- Add `noResultsWidget` property for DropdownSearchData. It can be used to show some widget when the search results are empty. |
| 108 | +- Add border radius parameter for menu item. |
| 109 | +- Add `dropdownBuilder` property for DropdownStyleData, it can be used to customize the dropdown menu. |
| 110 | +- Add copyWith method for style data classes, closes #314. |
| 111 | +- Support helperStyle/helperMaxLines/errorMaxLines for DropdownButtonFormField2. |
| 112 | +- Add `MenuItemStyleData.useDecorationHorizontalPadding`, used to determine whether to use the horizontal padding from "decoration.contentPadding" for menu items when using `DropdownButtonFormField2`. |
| 113 | +- Add barrierCoversButton to DropdownButtonFormField2. |
| 114 | +- Support BorderRadiusDirectional for dropdown menu. |
| 115 | +- Add semantics to dropdown menu items [Flutter core]. |
| 116 | +- Accept `Iterable` instead of `List` for `selectedItemBuilder` and `multiValueListenable` properties. |
| 117 | + |
| 118 | +### Bug Fixes |
| 119 | + |
| 120 | +- Fix isExpanded and alignment functionality. |
| 121 | +- Fix inkwell covers error message. |
| 122 | +- Fix dropdown menu position when window changes horizontally, closes #243. |
| 123 | +- Temporarily fix ink splash gets displayed over search widget, closes #290. |
| 124 | +- Fix error border not showing for DropdownButtonFormField2, closes #297 & #319. |
| 125 | +- Fix DropdownButtonFormField2 ink response radius for different input borders. |
| 126 | +- Fix menu limits when using searchable dropdown with separators, closes #214. |
| 127 | +- Fix errorStyle has no effect for DropdownButtonFormField2, closes #327. |
| 128 | +- Fix memory leak in CurvedAnimation [Flutter core]. |
| 129 | +- Fix DropdownButtonFormField clips text when large text scale is used [Flutter core]. |
| 130 | +- Fix DropdownButtonFormField padding when ButtonTheme.alignedDropdown is true [Flutter core]. |
| 131 | +- Fix barrier when using TextDirection.rtl while barrierCoversButton set to false. |
| 132 | +- Avoid dropdown internal FocusNode listener leak when replaced by an external FocusNode. |
| 133 | +- Fix incorrect dropdown position when resizing the window rapidly on web, closes #395. |
| 134 | +- Ensure dropdown menu state updated only when mounted. |
| 135 | +- Fix selected index not updating when items list changes, closes #392. |
| 136 | +- Fix dropdown menu width not matching button width with OutlineInputBorder. |
| 137 | + |
| 138 | +### Improvements |
| 139 | + |
| 140 | +- Update highlight behavior, closes #184. |
| 141 | +- Enhance rendering performance when dealing with big items list. |
| 142 | +- Optimize scroll performance when dealing with large items list. |
| 143 | +- Always call `onChanged` when tapping enabled item, closes #275. |
| 144 | +- Enhance scroll position when using searchable dropdown, closes #285. |
| 145 | +- Enhance the display of error/helper elements at DropdownButtonFormField2, closes #199. |
| 146 | +- Avoid Container objects when possible for better performance [Flutter core]. |
| 147 | +- Respect button's borderRadius when barrierCoversButton is false. |
| 148 | +- Respect inputDecoration's borderRadius when barrierCoversButton is false. |
| 149 | +- Take InputDecoration's densityOffset into account when determining the button size. |
| 150 | +- Use decoration hint text as the default value for dropdown button hints [Flutter core]. |
| 151 | +- Replaces textScaleFactor with TextScaler [Flutter core]. |
| 152 | +- Update SDK constraints: ">=3.4.0 <4.0.0" |
| 153 | +- DropdownRoutePage should dispose the created ScrollController [Flutter core]. |
| 154 | +- Remove 'must be non-null' and 'must not be null' comments [Flutter core]. |
| 155 | +- Form fields onChange callback should be called on reset [Flutter core]. |
| 156 | +- Implement switch expressions. |
| 157 | +- Update DropdownItem to respect intrinsicHeight. |
| 158 | +- Update added menu padding to include button icon. |
| 159 | +- Remove temporary fix for list not respecting itemCount when calling itemExtentBuilder. |
| 160 | +- Remove an assert from updateSelectedIndex method. |
| 161 | +- Update examples. |
| 162 | + |
1 | 163 | ## 3.0.0-beta.25 |
2 | 164 |
|
3 | 165 | - Remove temporary fix for list not respecting itemCount when calling itemExtentBuilder. |
|
0 commit comments