removed Diacritics
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
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 'country_codes.dart';
|
import 'country_codes.dart';
|
||||||
@@ -47,13 +48,14 @@ class CountryCode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CountryCode localize(BuildContext context) {
|
CountryCode localize(BuildContext context) {
|
||||||
|
final nam = CountryLocalizations.of(context)?.translate(code) ?? name;
|
||||||
return this
|
return this
|
||||||
..name = CountryLocalizations.of(context)?.translate(code) ?? 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: json['name'],
|
name: removeDiacritics(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',
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ dependencies:
|
|||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
collection: ^1.15.0
|
collection: ^1.15.0
|
||||||
|
diacritic: ^0.1.5
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
assets:
|
assets:
|
||||||
|
|||||||
Reference in New Issue
Block a user