diff --git a/lib/src/utils/selector_config.dart b/lib/src/utils/selector_config.dart index 7db965673c..d520ef24d1 100644 --- a/lib/src/utils/selector_config.dart +++ b/lib/src/utils/selector_config.dart @@ -33,6 +33,12 @@ class SelectorConfig { /// Add white space for short dial code final bool trailingSpace; + /// Add arrow down for select box + final Widget? arrowDownIcon; + + /// Customize the box-decoration for selector + final BoxDecoration? selectorDecoration; + const SelectorConfig({ this.selectorType = PhoneInputSelectorType.DROPDOWN, this.showFlags = true, @@ -41,5 +47,7 @@ class SelectorConfig { this.setSelectorButtonAsPrefixIcon = false, this.leadingPadding, this.trailingSpace = true, + this.arrowDownIcon, + this.selectorDecoration, }); } diff --git a/lib/src/widgets/item.dart b/lib/src/widgets/item.dart index c0b2ab9f51..e60cf264ae 100644 --- a/lib/src/widgets/item.dart +++ b/lib/src/widgets/item.dart @@ -11,6 +11,8 @@ class Item extends StatelessWidget { final bool withCountryNames; final double? leadingPadding; final bool trailingSpace; + final Widget? arrowDownIcon; + final BoxDecoration? selectorDecoration; const Item({ Key? key, @@ -21,6 +23,8 @@ class Item extends StatelessWidget { this.withCountryNames = false, this.leadingPadding = 12, this.trailingSpace = true, + this.arrowDownIcon, + this.selectorDecoration, }) : super(key: key); @override @@ -30,6 +34,7 @@ class Item extends StatelessWidget { dialCode = dialCode.padRight(5, " "); } return Container( + decoration: selectorDecoration, child: Row( mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.min, @@ -46,6 +51,14 @@ class Item extends StatelessWidget { textDirection: TextDirection.ltr, style: textStyle, ), + ...[ + arrowDownIcon ?? + Icon( + Icons.arrow_drop_down, + color: Colors.black, + size: 20, + ), + ] ], ), ); diff --git a/lib/src/widgets/selector_button.dart b/lib/src/widgets/selector_button.dart index 31cc77b1c8..c129cdd362 100644 --- a/lib/src/widgets/selector_button.dart +++ b/lib/src/widgets/selector_button.dart @@ -48,6 +48,8 @@ class SelectorButton extends StatelessWidget { leadingPadding: selectorConfig.leadingPadding, trailingSpace: selectorConfig.trailingSpace, textStyle: selectorTextStyle, + arrowDownIcon: selectorConfig.arrowDownIcon, + selectorDecoration: selectorConfig.selectorDecoration, ), value: country, items: mapCountryToDropdownItem(countries), @@ -61,6 +63,8 @@ class SelectorButton extends StatelessWidget { leadingPadding: selectorConfig.leadingPadding, trailingSpace: selectorConfig.trailingSpace, textStyle: selectorTextStyle, + arrowDownIcon: selectorConfig.arrowDownIcon, + selectorDecoration: selectorConfig.selectorDecoration, ) : MaterialButton( key: Key(TestHelper.DropdownButtonKeyValue), @@ -92,6 +96,8 @@ class SelectorButton extends StatelessWidget { leadingPadding: selectorConfig.leadingPadding, trailingSpace: selectorConfig.trailingSpace, textStyle: selectorTextStyle, + arrowDownIcon: selectorConfig.arrowDownIcon, + selectorDecoration: selectorConfig.selectorDecoration, ), ), ); @@ -111,6 +117,8 @@ class SelectorButton extends StatelessWidget { textStyle: selectorTextStyle, withCountryNames: false, trailingSpace: selectorConfig.trailingSpace, + arrowDownIcon: selectorConfig.arrowDownIcon, + selectorDecoration: selectorConfig.selectorDecoration, ), ); }).toList();