Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85f3ab6cf8 | ||
|
|
9b71ba2931 | ||
|
|
1344c6064e | ||
|
|
44945e23a5 | ||
|
|
e7896adbd8 | ||
|
|
84064c236d | ||
|
|
fbc4d9ea28 | ||
|
|
2078ad5506 | ||
|
|
4c64b01183 | ||
|
|
49143d8c97 | ||
|
|
9faf5a79cf | ||
|
|
282ed6e0be | ||
|
|
3bbd4e7e62 |
25
.github/workflows/dart.yml
vendored
25
.github/workflows/dart.yml
vendored
@@ -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:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
- '[0-9]+.[0-9]+.[0-9]+*'
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: Publish
|
||||
uses: sakebook/actions-flutter-pub-publisher@v1.2.1
|
||||
with:
|
||||
credential: ${{ secrets.CREDENTIALS }}
|
||||
skip_test: true
|
||||
permissions:
|
||||
id-token: write # Required for authentication using OIDC
|
||||
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
|
||||
# with:
|
||||
# working-directory: path/to/package/within/repository
|
||||
@@ -1,3 +1,12 @@
|
||||
## 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
|
||||
- Fix localization, typo, and flag issue #51 thanks to @MrRoy121
|
||||
|
||||
## 3.2.0 - January 31 2025
|
||||
- Add country code picker style #6
|
||||
- Remove Special Character #37
|
||||
|
||||
16
README.md
16
README.md
@@ -59,6 +59,7 @@ void _onCountryChange(CountryCode countryCode) {
|
||||
|
||||
Just add the `CountryLocalizations.delegate` in the list of your app delegates
|
||||
|
||||
### Default Usage (Localization Enabled)
|
||||
```dart
|
||||
return new MaterialApp(
|
||||
supportedLocales: [
|
||||
@@ -140,9 +141,19 @@ Just add the `CountryLocalizations.delegate` in the list of your app delegates
|
||||
],
|
||||
```
|
||||
|
||||
### Force English (Localization Disabled)
|
||||
```dart
|
||||
return new MaterialApp(
|
||||
localizationsDelegates: [
|
||||
CountryLocalizations.delegate(enableLocalization: false),
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
],
|
||||
```
|
||||
|
||||
## Customization
|
||||
|
||||
Here is a list of properties available to customize your widget:
|
||||
Here is a list of properties available to customizeccc your widget:
|
||||
|
||||
| Name | Type | Description |
|
||||
|-----|-----|------|
|
||||
@@ -198,7 +209,8 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
||||
<tr>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/chandra-abdul-fattah"><img src="https://avatars.githubusercontent.com/u/16184998?v=4?s=100" width="100px;" alt="Chandra Abdul Fattah"/><br /><sub><b>Chandra Abdul Fattah</b></sub></a><br /><a href="#infra-chandrabezzo" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/chandrabezzo/CountryCodePicker/commits?author=chandrabezzo" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/imtoori"><img src="https://avatars.githubusercontent.com/u/20601437?v=4?s=100" width="100px;" alt="Salvatore Giordano"/><br /><sub><b>Salvatore Giordano</b></sub></a><br /><a href="#infra-imtoori" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/chandrabezzo/CountryCodePicker/commits?author=imtoori" title="Code">💻</a></td>
|
||||
</tr>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/nilashish-roy-b8a4a0171/"><img src="https://avatars.githubusercontent.com/u/96123041?v=4?s=100" width="100px;" alt="Nilashish Roy"/><br /><sub><b>Nilashish Roy</b></sub></a><br /><a href="#infra-mrroy121" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/chandrabezzo/CountryCodePicker/commits?author=mrroy121" title="Code">💻</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -89,6 +89,7 @@ class MyAppState extends State<MyApp> {
|
||||
],
|
||||
localizationsDelegates: const [
|
||||
CountryLocalizations.delegate,
|
||||
/// CountryLocalizations.getDelegate(enableLocalization: false), // For no localization only english just declare delegate this way.
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
],
|
||||
|
||||
BIN
flags/sy.png
BIN
flags/sy.png
Binary file not shown.
|
Before Width: | Height: | Size: 494 B After Width: | Height: | Size: 2.4 KiB |
@@ -152,16 +152,13 @@ class CountryCodePicker extends StatefulWidget {
|
||||
this.closeIcon = const Icon(Icons.close),
|
||||
this.countryList = codes,
|
||||
this.pickerStyle = PickerStyle.dialog,
|
||||
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.headerAlignment = MainAxisAlignment.spaceBetween,
|
||||
this.headerText = "Select County",
|
||||
this.headerTextStyle =
|
||||
const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
this.headerText = "Select Country",
|
||||
this.headerTextStyle = const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
this.hideHeaderText = false,
|
||||
this.topBarPadding =
|
||||
const EdgeInsets.symmetric(vertical: 5.0, horizontal: 20),
|
||||
this.topBarPadding = const EdgeInsets.symmetric(vertical: 5.0, horizontal: 20),
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
@@ -170,16 +167,14 @@ class CountryCodePicker extends StatefulWidget {
|
||||
State<StatefulWidget> createState() {
|
||||
List<Map<String, String>> jsonList = countryList;
|
||||
|
||||
List<CountryCode> elements =
|
||||
jsonList.map((json) => CountryCode.fromJson(json)).toList();
|
||||
List<CountryCode> elements = jsonList.map((json) => CountryCode.fromJson(json)).toList();
|
||||
|
||||
if (comparator != null) {
|
||||
elements.sort(comparator);
|
||||
}
|
||||
|
||||
if (countryFilter != null && countryFilter!.isNotEmpty) {
|
||||
final uppercaseCustomList =
|
||||
countryFilter!.map((criteria) => criteria.toUpperCase()).toList();
|
||||
final uppercaseCustomList = countryFilter!.map((criteria) => criteria.toUpperCase()).toList();
|
||||
elements = elements
|
||||
.where((criteria) =>
|
||||
uppercaseCustomList.contains(criteria.code) ||
|
||||
@@ -205,9 +200,7 @@ class CountryCodePickerState extends State<CountryCodePicker> {
|
||||
Widget internalWidget;
|
||||
if (widget.builder != null) {
|
||||
internalWidget = InkWell(
|
||||
onTap: pickerStyle == PickerStyle.dialog
|
||||
? showCountryCodePickerDialog
|
||||
: showCountryCodePickerBottomSheet,
|
||||
onTap: pickerStyle == PickerStyle.dialog ? showCountryCodePickerDialog : showCountryCodePickerBottomSheet,
|
||||
child: widget.builder!(selectedItem),
|
||||
);
|
||||
} else {
|
||||
@@ -223,16 +216,12 @@ class CountryCodePickerState extends State<CountryCodePicker> {
|
||||
direction: Axis.horizontal,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
if (widget.showFlagMain != null
|
||||
? widget.showFlagMain!
|
||||
: widget.showFlag)
|
||||
if (widget.showFlagMain != null ? widget.showFlagMain! : widget.showFlag)
|
||||
Flexible(
|
||||
flex: widget.alignLeft ? 0 : 1,
|
||||
fit: widget.alignLeft ? FlexFit.tight : FlexFit.loose,
|
||||
child: Container(
|
||||
clipBehavior: widget.flagDecoration == null
|
||||
? Clip.none
|
||||
: Clip.hardEdge,
|
||||
clipBehavior: widget.flagDecoration == null ? Clip.none : Clip.hardEdge,
|
||||
decoration: widget.flagDecoration,
|
||||
margin: widget.margin ??
|
||||
(widget.alignLeft
|
||||
@@ -249,11 +238,8 @@ class CountryCodePickerState extends State<CountryCodePicker> {
|
||||
Flexible(
|
||||
fit: widget.alignLeft ? FlexFit.tight : FlexFit.loose,
|
||||
child: Text(
|
||||
widget.showOnlyCountryWhenClosed
|
||||
? selectedItem!.toCountryStringOnly()
|
||||
: selectedItem.toString(),
|
||||
style: widget.textStyle ??
|
||||
Theme.of(context).textTheme.labelLarge,
|
||||
widget.showOnlyCountryWhenClosed ? selectedItem!.toCountryStringOnly() : selectedItem.toString(),
|
||||
style: widget.textStyle ?? Theme.of(context).textTheme.labelLarge,
|
||||
overflow: widget.textOverflow,
|
||||
),
|
||||
),
|
||||
@@ -295,11 +281,9 @@ class CountryCodePickerState extends State<CountryCodePicker> {
|
||||
if (widget.initialSelection != null) {
|
||||
selectedItem = elements.firstWhere(
|
||||
(criteria) =>
|
||||
(criteria.code!.toUpperCase() ==
|
||||
widget.initialSelection!.toUpperCase()) ||
|
||||
(criteria.code!.toUpperCase() == widget.initialSelection!.toUpperCase()) ||
|
||||
(criteria.dialCode == widget.initialSelection) ||
|
||||
(criteria.name!.toUpperCase() ==
|
||||
widget.initialSelection!.toUpperCase()),
|
||||
(criteria.name!.toUpperCase() == widget.initialSelection!.toUpperCase()),
|
||||
orElse: () => elements[0]);
|
||||
} else {
|
||||
selectedItem = elements[0];
|
||||
@@ -315,11 +299,9 @@ class CountryCodePickerState extends State<CountryCodePicker> {
|
||||
if (widget.initialSelection != null) {
|
||||
selectedItem = elements.firstWhere(
|
||||
(item) =>
|
||||
(item.code!.toUpperCase() ==
|
||||
widget.initialSelection!.toUpperCase()) ||
|
||||
(item.code!.toUpperCase() == widget.initialSelection!.toUpperCase()) ||
|
||||
(item.dialCode == widget.initialSelection) ||
|
||||
(item.name!.toUpperCase() ==
|
||||
widget.initialSelection!.toUpperCase()),
|
||||
(item.name!.toUpperCase() == widget.initialSelection!.toUpperCase()),
|
||||
orElse: () => elements[0]);
|
||||
} else {
|
||||
selectedItem = elements[0];
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:collection/collection.dart' show IterableExtension;
|
||||
import 'package:diacritic/diacritic.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
|
||||
@@ -45,7 +44,9 @@ class CountryCode {
|
||||
try {
|
||||
return CountryCode.fromCountryCode(countryCode);
|
||||
} catch (e) {
|
||||
if (kDebugMode) print('Failed to recognize country from countryCode: $countryCode');
|
||||
if (kDebugMode) {
|
||||
print('Failed to recognize country from countryCode: $countryCode');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -61,20 +62,21 @@ class CountryCode {
|
||||
try {
|
||||
return CountryCode.fromDialCode(dialCode);
|
||||
} catch (e) {
|
||||
if (kDebugMode) print('Failed to recognize country from dialCode: $dialCode');
|
||||
if (kDebugMode) {
|
||||
print('Failed to recognize country from dialCode: $dialCode');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
CountryCode localize(BuildContext context) {
|
||||
final nam = CountryLocalizations.of(context)?.translate(code) ?? name;
|
||||
return this
|
||||
..name = nam == null? name : removeDiacritics(nam);
|
||||
return this..name = nam ?? name;
|
||||
}
|
||||
|
||||
factory CountryCode.fromJson(Map<String, dynamic> json) {
|
||||
return CountryCode(
|
||||
name: removeDiacritics(json['name']),
|
||||
name: json['name'],
|
||||
code: json['code'],
|
||||
dialCode: json['dial_code'],
|
||||
flagUri: 'flags/${json['code'].toLowerCase()}.png',
|
||||
|
||||
@@ -15,14 +15,17 @@ class CountryLocalizations {
|
||||
);
|
||||
}
|
||||
|
||||
static const LocalizationsDelegate<CountryLocalizations> delegate =
|
||||
_CountryLocalizationsDelegate();
|
||||
static const LocalizationsDelegate<CountryLocalizations> delegate = _CountryLocalizationsDelegate();
|
||||
|
||||
static LocalizationsDelegate<CountryLocalizations> getDelegate({bool enableLocalization = true}) {
|
||||
return _CountryLocalizationsDelegate(enableLocalization: enableLocalization);
|
||||
}
|
||||
|
||||
late Map<String, String> _localizedStrings;
|
||||
|
||||
Future<bool> load() async {
|
||||
String jsonString = await rootBundle.loadString(
|
||||
'packages/country_code_picker/src/i18n/${locale.languageCode}.json');
|
||||
String jsonString =
|
||||
await rootBundle.loadString('packages/country_code_picker/src/i18n/${locale.languageCode}.json');
|
||||
Map<String, dynamic> jsonMap = json.decode(jsonString);
|
||||
|
||||
_localizedStrings = jsonMap.map((key, value) {
|
||||
@@ -37,9 +40,10 @@ class CountryLocalizations {
|
||||
}
|
||||
}
|
||||
|
||||
class _CountryLocalizationsDelegate
|
||||
extends LocalizationsDelegate<CountryLocalizations> {
|
||||
const _CountryLocalizationsDelegate();
|
||||
class _CountryLocalizationsDelegate extends LocalizationsDelegate<CountryLocalizations> {
|
||||
final bool enableLocalization;
|
||||
|
||||
const _CountryLocalizationsDelegate({this.enableLocalization = true});
|
||||
|
||||
@override
|
||||
bool isSupported(Locale locale) {
|
||||
@@ -119,7 +123,10 @@ class _CountryLocalizationsDelegate
|
||||
|
||||
@override
|
||||
Future<CountryLocalizations> load(Locale locale) async {
|
||||
CountryLocalizations localizations = CountryLocalizations(const Locale('en'));//locale);
|
||||
// Use the provided locale if localization is enabled; otherwise, use English.
|
||||
Locale effectiveLocale = enableLocalization ? locale : const Locale('en');
|
||||
|
||||
CountryLocalizations localizations = CountryLocalizations(effectiveLocale);
|
||||
await localizations.load();
|
||||
return localizations;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"BH": "Bahrein",
|
||||
"BD": "Bangladesh",
|
||||
"BB": "Barbade",
|
||||
"BY": "Bielorussie",
|
||||
"BY": "Biélorussie",
|
||||
"BE": "Belgique",
|
||||
"BZ": "Belize",
|
||||
"BJ": "Bénin",
|
||||
@@ -38,7 +38,7 @@
|
||||
"CM": "Cameroun",
|
||||
"CA": "Canada",
|
||||
"CV": "Cap-Vert",
|
||||
"KY": "Caïmanes",
|
||||
"KY": "Îles Caïmans",
|
||||
"CF": "Centrafricaine, République",
|
||||
"TD": "Tchad",
|
||||
"CL": "Chili",
|
||||
@@ -83,7 +83,7 @@
|
||||
"GI": "Gibraltar",
|
||||
"GR": "Grèce",
|
||||
"GL": "Groenland",
|
||||
"GD": "Grenada",
|
||||
"GD": "Grenade",
|
||||
"GP": "Guadeloupe",
|
||||
"GU": "Guam",
|
||||
"GT": "Guatemala",
|
||||
@@ -110,9 +110,9 @@
|
||||
"KZ": "Kazakhstan",
|
||||
"KE": "Kenya",
|
||||
"KI": "Kiribati",
|
||||
"KP": "Corée du Nord, République populaire démocratique",
|
||||
"KR": "Corée du Sud, République",
|
||||
"KW": "Koweit",
|
||||
"KP": "Corée du Nord",
|
||||
"KR": "Corée du Sud",
|
||||
"KW": "Koweït",
|
||||
"KG": "Kirghistan",
|
||||
"LA": "Laos",
|
||||
"LV": "Lettonie",
|
||||
@@ -179,7 +179,7 @@
|
||||
"SH": "Sainte-Hélène",
|
||||
"KN": "Saint-Christophe-et-Niévès",
|
||||
"LC": "Sainte-Lucie",
|
||||
"PM": "Saint Pierre and Miquelon",
|
||||
"PM": "Saint-Pierre-et-Miquelon",
|
||||
"VC": "Saint-Vincent et les Grenadines",
|
||||
"WS": "Samoa",
|
||||
"SM": "Saint-Marin",
|
||||
@@ -200,15 +200,15 @@
|
||||
"SD": "Soudan",
|
||||
"SR": "Suriname",
|
||||
"SJ": "Svalbard et Île Jan Mayen",
|
||||
"SZ": "Ngwane, Royaume d'Eswatini",
|
||||
"SZ": "Eswatini",
|
||||
"SE": "Suède",
|
||||
"CH": "Suisse",
|
||||
"SY": "Syrie",
|
||||
"TW": "Taïwan",
|
||||
"TJ": "Tadjikistan",
|
||||
"TZ": "Tanzanie, République unie",
|
||||
"TZ": "Tanzanie",
|
||||
"TH": "Thaïlande",
|
||||
"TL": "Timor Leste",
|
||||
"TL": "Timor-Leste",
|
||||
"TG": "Togo",
|
||||
"TK": "Tokelau",
|
||||
"TO": "Tonga",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:diacritic/diacritic.dart';
|
||||
|
||||
import 'country_code.dart';
|
||||
import 'country_localizations.dart';
|
||||
@@ -50,7 +51,7 @@ class SelectionDialog extends StatefulWidget {
|
||||
InputDecoration searchDecoration = const InputDecoration(),
|
||||
this.searchStyle,
|
||||
this.textStyle,
|
||||
required this.topBarPadding,
|
||||
required this.topBarPadding,
|
||||
this.headerText,
|
||||
this.boxDecoration,
|
||||
this.showFlag,
|
||||
@@ -62,9 +63,12 @@ class SelectionDialog extends StatefulWidget {
|
||||
this.hideSearch = false,
|
||||
this.hideCloseIcon = false,
|
||||
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),
|
||||
}) : 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);
|
||||
|
||||
@override
|
||||
@@ -81,7 +85,8 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
||||
child: Container(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
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 ??
|
||||
BoxDecoration(
|
||||
color: widget.backgroundColor ?? Colors.white,
|
||||
@@ -100,7 +105,9 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Padding(
|
||||
padding:!widget.hideHeaderText? widget.topBarPadding: EdgeInsets.zero,
|
||||
padding: !widget.hideHeaderText
|
||||
? widget.topBarPadding
|
||||
: EdgeInsets.zero,
|
||||
child: Row(
|
||||
mainAxisAlignment: widget.headerAlignment,
|
||||
children: [
|
||||
@@ -177,11 +184,14 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
||||
if (widget.showFlag!)
|
||||
Flexible(
|
||||
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(left: 16.0),
|
||||
decoration: widget.flagDecoration,
|
||||
clipBehavior: widget.flagDecoration == null ? Clip.none : Clip.hardEdge,
|
||||
clipBehavior:
|
||||
widget.flagDecoration == null ? Clip.none : Clip.hardEdge,
|
||||
child: Image.asset(
|
||||
e.flagUri!,
|
||||
package: 'country_code_picker',
|
||||
@@ -192,7 +202,9 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Text(
|
||||
widget.showCountryOnly! ? e.toCountryStringOnly() : e.toLongString(),
|
||||
widget.showCountryOnly!
|
||||
? e.toCountryStringOnly()
|
||||
: e.toLongString(),
|
||||
overflow: TextOverflow.fade,
|
||||
style: widget.textStyle,
|
||||
),
|
||||
@@ -208,7 +220,8 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
||||
}
|
||||
|
||||
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) {
|
||||
s = s.toUpperCase();
|
||||
final normalizedSearch = removeDiacritics(s.toUpperCase());
|
||||
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();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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
|
||||
version: 3.2.0
|
||||
version: 3.3.1
|
||||
homepage: https://github.com/chandrabezzo/CountryCodePicker
|
||||
repository: https://github.com/chandrabezzo/CountryCodePicker
|
||||
issue_tracker: https://github.com/imtoori/CountryCodePicker/issues
|
||||
|
||||
Reference in New Issue
Block a user