This commit is contained in:
Salvatore Giordano
2018-04-02 18:07:58 +02:00
parent b2e6e84bc2
commit b952054422
4 changed files with 13 additions and 7 deletions

View File

@@ -5,3 +5,7 @@ Initial release
## 0.0.2 ## 0.0.2
Add favorite countries option. Add favorite countries option.
## 0.1.0
Removed flags in iOS because they show up weirdly.

View File

@@ -1,3 +1,5 @@
import 'package:flutter/foundation.dart';
class CElement { class CElement {
String name; String name;
String flag; String flag;
@@ -8,10 +10,10 @@ class CElement {
@override @override
String toString() { String toString() {
return "$flag $dialCode"; return defaultTargetPlatform == TargetPlatform.android ? "$flag $dialCode" : dialCode;
} }
String toLongString() { String toLongString() {
return "$flag $dialCode $name"; return defaultTargetPlatform == TargetPlatform.android ? "$flag $dialCode $name" : "$dialCode $name";
} }
} }

View File

@@ -8,9 +8,9 @@ import 'package:country_code_picker/celement.dart';
class CountryCodePicker extends StatefulWidget { class CountryCodePicker extends StatefulWidget {
final Function(String) onChanged; final Function(String) onChanged;
final String initialSelection; final String initialSelection;
final List<String> favorites; final List<String> favorite;
CountryCodePicker({this.onChanged, this.initialSelection, this.favorites}); CountryCodePicker({this.onChanged, this.initialSelection, this.favorite});
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@@ -53,7 +53,7 @@ class _CountryCodePickerState extends State<CountryCodePicker> {
favoriteElements = elements favoriteElements = elements
.where((e) => .where((e) =>
widget.favorites.firstWhere((f) => e.code == f.toUpperCase(), widget.favorite.firstWhere((f) => e.code == f.toUpperCase(),
orElse: () => null) != orElse: () => null) !=
null) null)
.toList(); .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. description: A flutter package for showing a country code selector.
version: 0.0.2 version: 0.1.0
author: Salvatore-Giordano <salvatoregiordanoo@gmail.com> author: Salvatore-Giordano <salvatoregiordanoo@gmail.com>
homepage: https://github.com/Salvatore-Giordano/CountryCodePicker homepage: https://github.com/Salvatore-Giordano/CountryCodePicker