@@ -785,7 +785,7 @@ class _DropdownButton2State<T> extends State<DropdownButton2<T>>
785
785
? _textStyle!
786
786
: _textStyle! .copyWith (color: Theme .of (context).disabledColor),
787
787
child: widget.customButton ??
788
- Container (
788
+ _ConditionalDecoratedBox (
789
789
decoration: _buttonStyle? .decoration? .copyWith (
790
790
boxShadow: _buttonStyle! .decoration! .boxShadow ??
791
791
kElevationToShadow[_buttonStyle! .elevation ?? 0 ],
@@ -794,45 +794,47 @@ class _DropdownButton2State<T> extends State<DropdownButton2<T>>
794
794
boxShadow: _buttonStyle! .foregroundDecoration! .boxShadow ??
795
795
kElevationToShadow[_buttonStyle! .elevation ?? 0 ],
796
796
),
797
- padding: (_buttonStyle? .padding ??
798
- padding.resolve (Directionality .of (context)))
799
- .add (
800
- // When buttonWidth & dropdownWidth is null, their width will be calculated
801
- // from the maximum width of menu items or the hint text (width of IndexedStack).
802
- // We need to add MenuHorizontalPadding so menu width adapts to max items width with padding properly
803
- _buttonStyle? .width == null && _dropdownStyle.width == null
804
- ? _getMenuPadding ()
805
- .resolve (Directionality .of (context))
806
- .copyWith (top: 0 , bottom: 0 )
807
- : EdgeInsets .zero,
808
- ),
809
797
height: buttonHeight,
810
798
width: _buttonStyle? .width,
811
- child: Row (
812
- mainAxisAlignment: MainAxisAlignment .spaceBetween,
813
- mainAxisSize: MainAxisSize .min,
814
- children: < Widget > [
815
- if (widget.isExpanded)
816
- Expanded (child: innerItemsWidget)
817
- else
818
- innerItemsWidget,
819
- IconTheme (
820
- data: IconThemeData (
821
- color: _iconColor,
822
- size: _iconStyle.iconSize,
823
- ),
824
- child: ValueListenableBuilder <bool >(
825
- valueListenable: _isMenuOpen,
826
- builder: (BuildContext context, bool isOpen, _) {
827
- return _iconStyle.openMenuIcon != null
828
- ? isOpen
829
- ? _iconStyle.openMenuIcon!
830
- : _iconStyle.icon
831
- : _iconStyle.icon;
832
- },
799
+ child: Padding (
800
+ padding: (_buttonStyle? .padding ??
801
+ padding.resolve (Directionality .of (context)))
802
+ .add (
803
+ // When buttonWidth & dropdownWidth is null, their width will be calculated
804
+ // from the maximum width of menu items or the hint text (width of IndexedStack).
805
+ // We need to add MenuHorizontalPadding so menu width adapts to max items width with padding properly
806
+ _buttonStyle? .width == null && _dropdownStyle.width == null
807
+ ? _getMenuPadding ()
808
+ .resolve (Directionality .of (context))
809
+ .copyWith (top: 0 , bottom: 0 )
810
+ : EdgeInsets .zero,
811
+ ),
812
+ child: Row (
813
+ mainAxisAlignment: MainAxisAlignment .spaceBetween,
814
+ mainAxisSize: MainAxisSize .min,
815
+ children: < Widget > [
816
+ if (widget.isExpanded)
817
+ Expanded (child: innerItemsWidget)
818
+ else
819
+ innerItemsWidget,
820
+ IconTheme (
821
+ data: IconThemeData (
822
+ color: _iconColor,
823
+ size: _iconStyle.iconSize,
824
+ ),
825
+ child: ValueListenableBuilder <bool >(
826
+ valueListenable: _isMenuOpen,
827
+ builder: (BuildContext context, bool isOpen, _) {
828
+ return _iconStyle.openMenuIcon != null
829
+ ? isOpen
830
+ ? _iconStyle.openMenuIcon!
831
+ : _iconStyle.icon
832
+ : _iconStyle.icon;
833
+ },
834
+ ),
833
835
),
834
- ) ,
835
- ] ,
836
+ ] ,
837
+ ) ,
836
838
),
837
839
),
838
840
);
0 commit comments