Merge pull request #124 from sherifhasan/master
Update country_code_picker.dart
This commit is contained in:
@@ -71,6 +71,9 @@ class CountryCodePicker extends StatefulWidget {
|
||||
/// Set to true if you want to hide the search part
|
||||
final bool hideSearch;
|
||||
|
||||
/// Set to true if you want to show drop down button
|
||||
final bool showDropDownButton;
|
||||
|
||||
CountryCodePicker({
|
||||
this.onChanged,
|
||||
this.onInit,
|
||||
@@ -99,6 +102,7 @@ class CountryCodePicker extends StatefulWidget {
|
||||
this.comparator,
|
||||
this.countryFilter,
|
||||
this.hideSearch = false,
|
||||
this.showDropDownButton = false,
|
||||
this.dialogSize,
|
||||
this.dialogBackgroundColor,
|
||||
this.closeIcon = const Icon(Icons.close),
|
||||
@@ -154,6 +158,7 @@ class CountryCodePickerState extends State<CountryCodePicker> {
|
||||
direction: Axis.horizontal,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
|
||||
if (widget.showFlagMain != null
|
||||
? widget.showFlagMain
|
||||
: widget.showFlag)
|
||||
@@ -171,6 +176,7 @@ class CountryCodePickerState extends State<CountryCodePicker> {
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
if (!widget.hideMainText)
|
||||
Flexible(
|
||||
fit: widget.alignLeft ? FlexFit.tight : FlexFit.loose,
|
||||
@@ -178,10 +184,25 @@ class CountryCodePickerState extends State<CountryCodePicker> {
|
||||
widget.showOnlyCountryWhenClosed
|
||||
? selectedItem.toCountryStringOnly()
|
||||
: selectedItem.toString(),
|
||||
style: widget.textStyle ?? Theme.of(context).textTheme.button,
|
||||
style: widget.textStyle ?? Theme
|
||||
.of(context)
|
||||
.textTheme
|
||||
.button,
|
||||
overflow: widget.textOverflow,
|
||||
),
|
||||
),
|
||||
if(widget.showDropDownButton)
|
||||
Flexible(
|
||||
flex: widget.alignLeft ? 0 : 1,
|
||||
fit: widget.alignLeft ? FlexFit.tight : FlexFit.loose,
|
||||
child: Padding(
|
||||
padding: widget.alignLeft
|
||||
? const EdgeInsets.only(right: 16.0, left: 8.0)
|
||||
: const EdgeInsets.only(right: 16.0),
|
||||
child: Icon(Icons.arrow_drop_down, color: Colors.grey,
|
||||
size: widget.flagWidth,)
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user