change naming
This commit is contained in:
@@ -31,7 +31,7 @@ class _MyAppState extends State<MyApp> {
|
|||||||
initialSelection: 'IT',
|
initialSelection: 'IT',
|
||||||
favorite: ['+39', 'FR'],
|
favorite: ['+39', 'FR'],
|
||||||
//Get the country information relevant to the initial selection
|
//Get the country information relevant to the initial selection
|
||||||
getInitialData: (code) => print("${code.name} ${code.dialCode}"),
|
onInit: (code) => print("${code.name} ${code.dialCode}"),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 400,
|
width: 400,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export 'country_code.dart';
|
|||||||
class CountryCodePicker extends StatefulWidget {
|
class CountryCodePicker extends StatefulWidget {
|
||||||
final ValueChanged<CountryCode> onChanged;
|
final ValueChanged<CountryCode> onChanged;
|
||||||
//Exposed new method to get the initial information of the country
|
//Exposed new method to get the initial information of the country
|
||||||
final ValueChanged<CountryCode> getInitialData;
|
final ValueChanged<CountryCode> onInit;
|
||||||
final String initialSelection;
|
final String initialSelection;
|
||||||
final List<String> favorite;
|
final List<String> favorite;
|
||||||
final TextStyle textStyle;
|
final TextStyle textStyle;
|
||||||
@@ -38,7 +38,7 @@ class CountryCodePicker extends StatefulWidget {
|
|||||||
|
|
||||||
CountryCodePicker({
|
CountryCodePicker({
|
||||||
this.onChanged,
|
this.onChanged,
|
||||||
this.getInitialData,
|
this.onInit,
|
||||||
this.initialSelection,
|
this.initialSelection,
|
||||||
this.favorite = const [],
|
this.favorite = const [],
|
||||||
this.countryFilter = const [],
|
this.countryFilter = const [],
|
||||||
@@ -131,7 +131,7 @@ class _CountryCodePickerState extends State<CountryCodePicker> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Change added: get the initial entered country information
|
//Change added: get the initial entered country information
|
||||||
_getInitialSelectedData(selectedItem);
|
_onInit(selectedItem);
|
||||||
|
|
||||||
favoriteElements = elements
|
favoriteElements = elements
|
||||||
.where((e) =>
|
.where((e) =>
|
||||||
@@ -173,9 +173,9 @@ class _CountryCodePickerState extends State<CountryCodePicker> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _getInitialSelectedData(CountryCode initialData){
|
void _onInit(CountryCode initialData){
|
||||||
if(widget.getInitialData != null){
|
if(widget.onInit != null){
|
||||||
widget.getInitialData(initialData);
|
widget.onInit(initialData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user