diff --git a/lib/src/base_dropdown_search.dart b/lib/src/base_dropdown_search.dart index 24cdd926..cbd5ef1b 100644 --- a/lib/src/base_dropdown_search.dart +++ b/lib/src/base_dropdown_search.dart @@ -470,8 +470,14 @@ class DropdownSearchState extends State> { } else if (isMultiSelectionMode) { return defaultSelectedItems(getSelectedItems); } + Widget? buildSelectedItemWidget() { + if (widget.decoratorProps.isFittedBox) { + return FittedBox(child: defaultSelectedItemWidget(getSelectedItem)); + } + return defaultSelectedItemWidget(getSelectedItem); + } - return defaultSelectedItemWidget(getSelectedItem); + return buildSelectedItemWidget(); } TextStyle? _getBaseTextStyle() { diff --git a/lib/src/properties/dropdown_props.dart b/lib/src/properties/dropdown_props.dart index 26f8e4fb..f5869611 100644 --- a/lib/src/properties/dropdown_props.dart +++ b/lib/src/properties/dropdown_props.dart @@ -43,6 +43,7 @@ class DropDownDecoratorProps { final TextAlignVertical? textAlignVertical; final bool expands; final bool isHovering; + final bool isFittedBox; const DropDownDecoratorProps({ this.decoration, @@ -51,5 +52,6 @@ class DropDownDecoratorProps { this.textAlignVertical, this.expands = false, this.isHovering = false, + this.isFittedBox = false, }); }