diff --git a/example/lib/main.dart b/example/lib/main.dart index 5f4f581..19d96a7 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -31,7 +31,7 @@ class _MyAppState extends State { initialSelection: 'IT', favorite: ['+39', 'FR'], //Get the country information relevant to the initial selection - getInitialData: (code) => print("${code.name} ${code.dialCode}"), + onInit: (code) => print("${code.name} ${code.dialCode}"), ), SizedBox( width: 400, diff --git a/lib/country_code_picker.dart b/lib/country_code_picker.dart index 24c560f..1dad346 100644 --- a/lib/country_code_picker.dart +++ b/lib/country_code_picker.dart @@ -10,7 +10,7 @@ export 'country_code.dart'; class CountryCodePicker extends StatefulWidget { final ValueChanged onChanged; //Exposed new method to get the initial information of the country - final ValueChanged getInitialData; + final ValueChanged onInit; final String initialSelection; final List favorite; final TextStyle textStyle; @@ -38,7 +38,7 @@ class CountryCodePicker extends StatefulWidget { CountryCodePicker({ this.onChanged, - this.getInitialData, + this.onInit, this.initialSelection, this.favorite = const [], this.countryFilter = const [], @@ -131,7 +131,7 @@ class _CountryCodePickerState extends State { } //Change added: get the initial entered country information - _getInitialSelectedData(selectedItem); + _onInit(selectedItem); favoriteElements = elements .where((e) => @@ -173,9 +173,9 @@ class _CountryCodePickerState extends State { } } - void _getInitialSelectedData(CountryCode initialData){ - if(widget.getInitialData != null){ - widget.getInitialData(initialData); + void _onInit(CountryCode initialData){ + if(widget.onInit != null){ + widget.onInit(initialData); } } }