7 Commits

Author SHA1 Message Date
Chandra Abdul Fattah
85f3ab6cf8 Merge pull request #63 from DomFiume/fix/dfi/french_translation
Some checks failed
Publish to pub.dev / publish (push) Has been cancelled
fix/dfi/french_translation
2025-08-19 19:37:34 +07:00
Dominique FIUME
9b71ba2931 update version number 2025-08-19 14:33:05 +02:00
Chandra Abdul Fattah
1344c6064e Merge pull request #64 from chandrabezzo/chandrabezzo-patch-1
Update dart.yml
2025-08-19 19:32:37 +07:00
Chandra Abdul Fattah
44945e23a5 Update dart.yml 2025-08-19 19:32:23 +07:00
Dominique FIUME
e7896adbd8 fixing accent removal 2025-08-19 13:53:36 +02:00
Dominique FIUME
84064c236d fix french translations 2025-08-19 11:19:10 +02:00
Chandra Abdul Fattah
fbc4d9ea28 Merge pull request #55 from chandrabezzo/fix/version/3.3.0
Update Version 3.3.0
2025-03-26 09:05:47 +07:00
6 changed files with 68 additions and 42 deletions

View File

@@ -1,20 +1,19 @@
name: Publish plugin # This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Publish to pub.dev
on: on:
push: push:
tags: tags:
- v* - '[0-9]+.[0-9]+.[0-9]+*'
jobs: jobs:
publish: publish:
permissions:
runs-on: ubuntu-latest id-token: write # Required for authentication using OIDC
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
steps: # with:
- name: Checkout # working-directory: path/to/package/within/repository
uses: actions/checkout@v1
- name: Publish
uses: sakebook/actions-flutter-pub-publisher@v1.2.1
with:
credential: ${{ secrets.CREDENTIALS }}
skip_test: true

View File

@@ -1,3 +1,9 @@
## 3.3.1 - August 19 2025
- Fix French translation accent display issue
- Correct French country name translations (Biélorussie, Koweït, Grenade, etc.)
- Preserve accents in displayed names while maintaining search functionality
- Update search logic to handle both accented and non-accented input
## 3.3.0 - March 26 2025 ## 3.3.0 - March 26 2025
- Fix localization, typo, and flag issue #51 thanks to @MrRoy121 - Fix localization, typo, and flag issue #51 thanks to @MrRoy121

View File

@@ -1,5 +1,4 @@
import 'package:collection/collection.dart' show IterableExtension; import 'package:collection/collection.dart' show IterableExtension;
import 'package:diacritic/diacritic.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart' show kDebugMode; import 'package:flutter/foundation.dart' show kDebugMode;
@@ -45,7 +44,9 @@ class CountryCode {
try { try {
return CountryCode.fromCountryCode(countryCode); return CountryCode.fromCountryCode(countryCode);
} catch (e) { } catch (e) {
if (kDebugMode) print('Failed to recognize country from countryCode: $countryCode'); if (kDebugMode) {
print('Failed to recognize country from countryCode: $countryCode');
}
return null; return null;
} }
} }
@@ -61,20 +62,21 @@ class CountryCode {
try { try {
return CountryCode.fromDialCode(dialCode); return CountryCode.fromDialCode(dialCode);
} catch (e) { } catch (e) {
if (kDebugMode) print('Failed to recognize country from dialCode: $dialCode'); if (kDebugMode) {
print('Failed to recognize country from dialCode: $dialCode');
}
return null; return null;
} }
} }
CountryCode localize(BuildContext context) { CountryCode localize(BuildContext context) {
final nam = CountryLocalizations.of(context)?.translate(code) ?? name; final nam = CountryLocalizations.of(context)?.translate(code) ?? name;
return this return this..name = nam ?? name;
..name = nam == null? name : removeDiacritics(nam);
} }
factory CountryCode.fromJson(Map<String, dynamic> json) { factory CountryCode.fromJson(Map<String, dynamic> json) {
return CountryCode( return CountryCode(
name: removeDiacritics(json['name']), name: json['name'],
code: json['code'], code: json['code'],
dialCode: json['dial_code'], dialCode: json['dial_code'],
flagUri: 'flags/${json['code'].toLowerCase()}.png', flagUri: 'flags/${json['code'].toLowerCase()}.png',

View File

@@ -18,7 +18,7 @@
"BH": "Bahrein", "BH": "Bahrein",
"BD": "Bangladesh", "BD": "Bangladesh",
"BB": "Barbade", "BB": "Barbade",
"BY": "Bielorussie", "BY": "Biélorussie",
"BE": "Belgique", "BE": "Belgique",
"BZ": "Belize", "BZ": "Belize",
"BJ": "Bénin", "BJ": "Bénin",
@@ -38,7 +38,7 @@
"CM": "Cameroun", "CM": "Cameroun",
"CA": "Canada", "CA": "Canada",
"CV": "Cap-Vert", "CV": "Cap-Vert",
"KY": "Caïmanes", "KY": "Îles Caïmans",
"CF": "Centrafricaine, République", "CF": "Centrafricaine, République",
"TD": "Tchad", "TD": "Tchad",
"CL": "Chili", "CL": "Chili",
@@ -83,7 +83,7 @@
"GI": "Gibraltar", "GI": "Gibraltar",
"GR": "Grèce", "GR": "Grèce",
"GL": "Groenland", "GL": "Groenland",
"GD": "Grenada", "GD": "Grenade",
"GP": "Guadeloupe", "GP": "Guadeloupe",
"GU": "Guam", "GU": "Guam",
"GT": "Guatemala", "GT": "Guatemala",
@@ -110,9 +110,9 @@
"KZ": "Kazakhstan", "KZ": "Kazakhstan",
"KE": "Kenya", "KE": "Kenya",
"KI": "Kiribati", "KI": "Kiribati",
"KP": "Corée du Nord, République populaire démocratique", "KP": "Corée du Nord",
"KR": "Corée du Sud, République", "KR": "Corée du Sud",
"KW": "Koweit", "KW": "Koweït",
"KG": "Kirghistan", "KG": "Kirghistan",
"LA": "Laos", "LA": "Laos",
"LV": "Lettonie", "LV": "Lettonie",
@@ -179,7 +179,7 @@
"SH": "Sainte-Hélène", "SH": "Sainte-Hélène",
"KN": "Saint-Christophe-et-Niévès", "KN": "Saint-Christophe-et-Niévès",
"LC": "Sainte-Lucie", "LC": "Sainte-Lucie",
"PM": "Saint Pierre and Miquelon", "PM": "Saint-Pierre-et-Miquelon",
"VC": "Saint-Vincent et les Grenadines", "VC": "Saint-Vincent et les Grenadines",
"WS": "Samoa", "WS": "Samoa",
"SM": "Saint-Marin", "SM": "Saint-Marin",
@@ -200,15 +200,15 @@
"SD": "Soudan", "SD": "Soudan",
"SR": "Suriname", "SR": "Suriname",
"SJ": "Svalbard et Île Jan Mayen", "SJ": "Svalbard et Île Jan Mayen",
"SZ": "Ngwane, Royaume d'Eswatini", "SZ": "Eswatini",
"SE": "Suède", "SE": "Suède",
"CH": "Suisse", "CH": "Suisse",
"SY": "Syrie", "SY": "Syrie",
"TW": "Taïwan", "TW": "Taïwan",
"TJ": "Tadjikistan", "TJ": "Tadjikistan",
"TZ": "Tanzanie, République unie", "TZ": "Tanzanie",
"TH": "Thaïlande", "TH": "Thaïlande",
"TL": "Timor Leste", "TL": "Timor-Leste",
"TG": "Togo", "TG": "Togo",
"TK": "Tokelau", "TK": "Tokelau",
"TO": "Tonga", "TO": "Tonga",

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:diacritic/diacritic.dart';
import 'country_code.dart'; import 'country_code.dart';
import 'country_localizations.dart'; import 'country_localizations.dart';
@@ -62,9 +63,12 @@ class SelectionDialog extends StatefulWidget {
this.hideSearch = false, this.hideSearch = false,
this.hideCloseIcon = false, this.hideCloseIcon = false,
this.closeIcon, this.closeIcon,
this.dialogItemPadding = const EdgeInsets.symmetric(horizontal: 24, vertical: 8), this.dialogItemPadding =
const EdgeInsets.symmetric(horizontal: 24, vertical: 8),
this.searchPadding = const EdgeInsets.symmetric(horizontal: 24), this.searchPadding = const EdgeInsets.symmetric(horizontal: 24),
}) : searchDecoration = searchDecoration.prefixIcon == null ? searchDecoration.copyWith(prefixIcon: const Icon(Icons.search)) : searchDecoration, }) : searchDecoration = searchDecoration.prefixIcon == null
? searchDecoration.copyWith(prefixIcon: const Icon(Icons.search))
: searchDecoration,
super(key: key); super(key: key);
@override @override
@@ -81,7 +85,8 @@ class _SelectionDialogState extends State<SelectionDialog> {
child: Container( child: Container(
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
width: widget.size?.width ?? MediaQuery.of(context).size.width, width: widget.size?.width ?? MediaQuery.of(context).size.width,
height: widget.size?.height ?? MediaQuery.of(context).size.height * 0.85, height:
widget.size?.height ?? MediaQuery.of(context).size.height * 0.85,
decoration: widget.boxDecoration ?? decoration: widget.boxDecoration ??
BoxDecoration( BoxDecoration(
color: widget.backgroundColor ?? Colors.white, color: widget.backgroundColor ?? Colors.white,
@@ -100,7 +105,9 @@ class _SelectionDialogState extends State<SelectionDialog> {
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
Padding( Padding(
padding:!widget.hideHeaderText? widget.topBarPadding: EdgeInsets.zero, padding: !widget.hideHeaderText
? widget.topBarPadding
: EdgeInsets.zero,
child: Row( child: Row(
mainAxisAlignment: widget.headerAlignment, mainAxisAlignment: widget.headerAlignment,
children: [ children: [
@@ -177,11 +184,14 @@ class _SelectionDialogState extends State<SelectionDialog> {
if (widget.showFlag!) if (widget.showFlag!)
Flexible( Flexible(
child: Container( child: Container(
margin: Directionality.of(context) == TextDirection.ltr // Here Adding padding depending on the locale language direction margin: Directionality.of(context) ==
TextDirection
.ltr // Here Adding padding depending on the locale language direction
? const EdgeInsets.only(right: 16.0) ? const EdgeInsets.only(right: 16.0)
: const EdgeInsets.only(left: 16.0), : const EdgeInsets.only(left: 16.0),
decoration: widget.flagDecoration, decoration: widget.flagDecoration,
clipBehavior: widget.flagDecoration == null ? Clip.none : Clip.hardEdge, clipBehavior:
widget.flagDecoration == null ? Clip.none : Clip.hardEdge,
child: Image.asset( child: Image.asset(
e.flagUri!, e.flagUri!,
package: 'country_code_picker', package: 'country_code_picker',
@@ -192,7 +202,9 @@ class _SelectionDialogState extends State<SelectionDialog> {
Expanded( Expanded(
flex: 4, flex: 4,
child: Text( child: Text(
widget.showCountryOnly! ? e.toCountryStringOnly() : e.toLongString(), widget.showCountryOnly!
? e.toCountryStringOnly()
: e.toLongString(),
overflow: TextOverflow.fade, overflow: TextOverflow.fade,
style: widget.textStyle, style: widget.textStyle,
), ),
@@ -208,7 +220,8 @@ class _SelectionDialogState extends State<SelectionDialog> {
} }
return Center( return Center(
child: Text(CountryLocalizations.of(context)?.translate('no_country') ?? 'No country found'), child: Text(CountryLocalizations.of(context)?.translate('no_country') ??
'No country found'),
); );
} }
@@ -219,9 +232,15 @@ class _SelectionDialogState extends State<SelectionDialog> {
} }
void _filterElements(String s) { void _filterElements(String s) {
s = s.toUpperCase(); final normalizedSearch = removeDiacritics(s.toUpperCase());
setState(() { setState(() {
filteredElements = widget.elements.where((e) => e.code!.contains(s) || e.dialCode!.contains(s) || e.name!.toUpperCase().contains(s)).toList(); filteredElements = widget.elements
.where((e) =>
e.code!.contains(normalizedSearch) ||
e.dialCode!.contains(normalizedSearch) ||
removeDiacritics(e.name!.toUpperCase())
.contains(normalizedSearch))
.toList();
}); });
} }

View File

@@ -1,6 +1,6 @@
name: country_code_picker name: country_code_picker
description: A flutter package for showing a country code selector. In addition it gives the possibility to select a list of favorites countries, as well as to search using a simple searchbox description: A flutter package for showing a country code selector. In addition it gives the possibility to select a list of favorites countries, as well as to search using a simple searchbox
version: 3.3.0 version: 3.3.1
homepage: https://github.com/chandrabezzo/CountryCodePicker homepage: https://github.com/chandrabezzo/CountryCodePicker
repository: https://github.com/chandrabezzo/CountryCodePicker repository: https://github.com/chandrabezzo/CountryCodePicker
issue_tracker: https://github.com/imtoori/CountryCodePicker/issues issue_tracker: https://github.com/imtoori/CountryCodePicker/issues