v0.1.3: Favorite can be one of code or dial code
This commit is contained in:
@@ -44,19 +44,18 @@ class _CountryCodePickerState extends State<CountryCodePicker> {
|
||||
@override
|
||||
initState() {
|
||||
if (widget.initialSelection != null) {
|
||||
selectedItem = elements.firstWhere(
|
||||
(e) {
|
||||
e.code.toUpperCase() == widget.initialSelection.toUpperCase() ||
|
||||
e.dialCode == widget.initialSelection.toString();
|
||||
},
|
||||
orElse: () => elements[0]);
|
||||
selectedItem = elements.firstWhere((e) {
|
||||
e.code.toUpperCase() == widget.initialSelection.toUpperCase() ||
|
||||
e.dialCode == widget.initialSelection.toString();
|
||||
}, orElse: () => elements[0]);
|
||||
} else {
|
||||
selectedItem = elements[0];
|
||||
}
|
||||
|
||||
favoriteElements = elements
|
||||
.where((e) =>
|
||||
widget.favorite.firstWhere((f) => e.code == f.toUpperCase(),
|
||||
widget.favorite.firstWhere(
|
||||
(f) => e.code == f.toUpperCase() || e.dialCode == f.toString(),
|
||||
orElse: () => null) !=
|
||||
null)
|
||||
.toList();
|
||||
|
||||
Reference in New Issue
Block a user