From feaa8325caa55eba518d26e4ac689aa363b132bc Mon Sep 17 00:00:00 2001 From: Mohammad Hadi Date: Mon, 6 Dec 2021 09:03:46 +0330 Subject: [PATCH 1/3] try to fix --- lib/country_code_picker.dart | 47 +++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/lib/country_code_picker.dart b/lib/country_code_picker.dart index c979e12b..0661abf8 100644 --- a/lib/country_code_picker.dart +++ b/lib/country_code_picker.dart @@ -288,28 +288,31 @@ class CountryCodePickerState extends State { // backgroundColor: widget.backgroundColor ?? Colors.transparent, context: context, builder: (context) => Center( - child: Container( - constraints: BoxConstraints(maxHeight: 500, maxWidth: 400), - child: Dialog( - child: SelectionDialog( - elements, - favoriteElements, - showCountryOnly: widget.showCountryOnly, - emptySearchBuilder: widget.emptySearchBuilder, - searchDecoration: widget.searchDecoration, - searchStyle: widget.searchStyle, - textStyle: widget.dialogTextStyle, - boxDecoration: widget.boxDecoration, - showFlag: widget.showFlagDialog != null - ? widget.showFlagDialog - : widget.showFlag, - flagWidth: widget.flagWidth, - size: widget.dialogSize, - backgroundColor: widget.dialogBackgroundColor, - barrierColor: widget.barrierColor, - hideSearch: widget.hideSearch, - closeIcon: widget.closeIcon, - flagDecoration: widget.flagDecoration, + child: Directionality( + textDirection: TextDirection.ltr, + child: Container( + constraints: BoxConstraints(maxHeight: 500, maxWidth: 400), + child: Dialog( + child: SelectionDialog( + elements, + favoriteElements, + showCountryOnly: widget.showCountryOnly, + emptySearchBuilder: widget.emptySearchBuilder, + searchDecoration: widget.searchDecoration, + searchStyle: widget.searchStyle, + textStyle: widget.dialogTextStyle, + boxDecoration: widget.boxDecoration, + showFlag: widget.showFlagDialog != null + ? widget.showFlagDialog + : widget.showFlag, + flagWidth: widget.flagWidth, + size: widget.dialogSize, + backgroundColor: widget.dialogBackgroundColor, + barrierColor: widget.barrierColor, + hideSearch: widget.hideSearch, + closeIcon: widget.closeIcon, + flagDecoration: widget.flagDecoration, + ), ), ), ), From a847c54cd7b03b4c3d448e983ed9273c0710baf0 Mon Sep 17 00:00:00 2001 From: Mohammad Hadi Date: Mon, 6 Dec 2021 09:21:22 +0330 Subject: [PATCH 2/3] fix right to left languages ui problem --- example/lib/main.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/example/lib/main.dart b/example/lib/main.dart index d0c2b136..f372d2e0 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -84,6 +84,7 @@ class _MyAppState extends State { Locale("ur"), Locale("uz"), Locale("vi"), + Locale("fa"), Locale("zh") ], localizationsDelegates: [ From 02455dcfe58dd3513ea8e29e0ca7c8b34e6524e4 Mon Sep 17 00:00:00 2001 From: Mohammad Hadi Date: Mon, 6 Dec 2021 09:22:37 +0330 Subject: [PATCH 3/3] fix right to left languages ui problem --- lib/country_code_picker.dart | 47 +++++++++++++++++------------------- lib/selection_dialog.dart | 17 +++++++------ 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lib/country_code_picker.dart b/lib/country_code_picker.dart index 0661abf8..c979e12b 100644 --- a/lib/country_code_picker.dart +++ b/lib/country_code_picker.dart @@ -288,31 +288,28 @@ class CountryCodePickerState extends State { // backgroundColor: widget.backgroundColor ?? Colors.transparent, context: context, builder: (context) => Center( - child: Directionality( - textDirection: TextDirection.ltr, - child: Container( - constraints: BoxConstraints(maxHeight: 500, maxWidth: 400), - child: Dialog( - child: SelectionDialog( - elements, - favoriteElements, - showCountryOnly: widget.showCountryOnly, - emptySearchBuilder: widget.emptySearchBuilder, - searchDecoration: widget.searchDecoration, - searchStyle: widget.searchStyle, - textStyle: widget.dialogTextStyle, - boxDecoration: widget.boxDecoration, - showFlag: widget.showFlagDialog != null - ? widget.showFlagDialog - : widget.showFlag, - flagWidth: widget.flagWidth, - size: widget.dialogSize, - backgroundColor: widget.dialogBackgroundColor, - barrierColor: widget.barrierColor, - hideSearch: widget.hideSearch, - closeIcon: widget.closeIcon, - flagDecoration: widget.flagDecoration, - ), + child: Container( + constraints: BoxConstraints(maxHeight: 500, maxWidth: 400), + child: Dialog( + child: SelectionDialog( + elements, + favoriteElements, + showCountryOnly: widget.showCountryOnly, + emptySearchBuilder: widget.emptySearchBuilder, + searchDecoration: widget.searchDecoration, + searchStyle: widget.searchStyle, + textStyle: widget.dialogTextStyle, + boxDecoration: widget.boxDecoration, + showFlag: widget.showFlagDialog != null + ? widget.showFlagDialog + : widget.showFlag, + flagWidth: widget.flagWidth, + size: widget.dialogSize, + backgroundColor: widget.dialogBackgroundColor, + barrierColor: widget.barrierColor, + hideSearch: widget.hideSearch, + closeIcon: widget.closeIcon, + flagDecoration: widget.flagDecoration, ), ), ), diff --git a/lib/selection_dialog.dart b/lib/selection_dialog.dart index 176d0ee2..0c5984d3 100644 --- a/lib/selection_dialog.dart +++ b/lib/selection_dialog.dart @@ -145,7 +145,7 @@ class _SelectionDialogState extends State { if (widget.showFlag!) Flexible( child: Container( - margin: const EdgeInsets.only(right: 16.0), + margin: const EdgeInsetsDirectional.only(end: 16.0), decoration: widget.flagDecoration, clipBehavior: widget.flagDecoration == null ? Clip.none : Clip.hardEdge, @@ -158,12 +158,15 @@ class _SelectionDialogState extends State { ), Expanded( flex: 4, - child: Text( - widget.showCountryOnly! - ? e.toCountryStringOnly() - : e.toLongString(), - overflow: TextOverflow.fade, - style: widget.textStyle, + child: Directionality( + textDirection: TextDirection.ltr, + child: Text( + widget.showCountryOnly! + ? e.toCountryStringOnly() + : e.toLongString(), + overflow: TextOverflow.fade, + style: widget.textStyle, + ), ), ), ],