diff --git a/CHANGELOG.md b/CHANGELOG.md index 36be446b..3823e506 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.3 + +- [DSPhoneInput] Add support to select current country code. + ## 0.2.2 - [DSButton] Removed border color when `borderColor` property is not informed. diff --git a/lib/blip_ds.dart b/lib/blip_ds.dart index 624125b6..c7f25ac5 100644 --- a/lib/blip_ds.dart +++ b/lib/blip_ds.dart @@ -18,6 +18,7 @@ export 'src/extensions/ds_delivery_report_status.extension.dart' show DSDeliveryReportStatusExtension; export 'src/extensions/ds_string.extension.dart' show DSStringExtension; export 'src/models/ds_calls_media_message.model.dart' show DSCallsMediaMessage; +export 'src/models/ds_country.model.dart' show DSCountry; export 'src/models/ds_message_bubble_avatar_config.model.dart' show DSMessageBubbleAvatarConfig; export 'src/models/ds_message_bubble_style.model.dart' diff --git a/lib/src/widgets/fields/ds_phone_input.widget.dart b/lib/src/widgets/fields/ds_phone_input.widget.dart index bc72bbbb..a1f774c9 100644 --- a/lib/src/widgets/fields/ds_phone_input.widget.dart +++ b/lib/src/widgets/fields/ds_phone_input.widget.dart @@ -27,6 +27,7 @@ class DSPhoneInput extends StatefulWidget { this.errorText, this.onChanged, this.shouldFocus = false, + this.initialCountry, }); final TextEditingController controller; @@ -36,6 +37,7 @@ class DSPhoneInput extends StatefulWidget { final ValueChanged? onChanged; final bool shouldFocus; final void Function(DSCountry)? onChangeCountry; + final DSCountry? initialCountry; @override State createState() => _DSPhoneInputState(); @@ -65,7 +67,10 @@ class _DSPhoneInputState extends State { _borderColor.value = _color(); }); - DSBottomSheetCountries.selectedCountry.value = null; + _dropdownValue.value = + widget.initialCountry ?? (DSUtils.countriesList.first); + + DSBottomSheetCountries.selectedCountry.value = widget.initialCountry; widget.onChangeCountry?.call(_dropdownValue.value); } diff --git a/lib/src/widgets/utils/ds_bottomsheet_countries.widget.dart b/lib/src/widgets/utils/ds_bottomsheet_countries.widget.dart index d038983e..af5679ac 100644 --- a/lib/src/widgets/utils/ds_bottomsheet_countries.widget.dart +++ b/lib/src/widgets/utils/ds_bottomsheet_countries.widget.dart @@ -45,12 +45,12 @@ abstract class DSBottomSheetCountries { ), DSIconButton( onPressed: () { - Get.back( - result: selectedCountry.value, - ); + Get.back(); }, - icon: const Icon(DSIcons.close_outline, - color: DSColors.neutralDarkRooftop), + icon: const Icon( + DSIcons.close_outline, + color: DSColors.neutralDarkRooftop, + ), ), ], ), diff --git a/pubspec.yaml b/pubspec.yaml index 8eb35b17..6d433e07 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: blip_ds description: Blip Design System for Flutter. -version: 0.2.2 +version: 0.2.3 homepage: https://github.com/takenet/blip-ds-flutter#readme repository: https://github.com/takenet/blip-ds-flutter