Merge pull request #105 from vlfr1997/master

Added option to change close icon and search icon
This commit is contained in:
Salvatore Giordano
2020-10-11 11:56:31 +02:00
committed by GitHub
2 changed files with 9 additions and 3 deletions

View File

@@ -23,6 +23,7 @@ class CountryCodePicker extends StatefulWidget {
final Function(CountryCode) builder;
final bool enabled;
final TextOverflow textOverflow;
final Icon closeIcon;
/// Barrier color of ModalBottomSheet
final Color barrierColor;
@@ -96,6 +97,7 @@ class CountryCodePicker extends StatefulWidget {
this.countryFilter,
this.hideSearch = false,
this.dialogSize,
this.closeIcon = const Icon(Icons.close),
Key key,
}) : super(key: key);
@@ -258,6 +260,7 @@ class CountryCodePickerState extends State<CountryCodePicker> {
flagWidth: widget.flagWidth,
size: widget.dialogSize,
hideSearch: widget.hideSearch,
closeIcon: widget.closeIcon,
),
).then((e) {
if (e != null) {

View File

@@ -14,6 +14,7 @@ class SelectionDialog extends StatefulWidget {
final double flagWidth;
final Size size;
final bool hideSearch;
final Icon closeIcon;
/// elements passed as favorite
final List<CountryCode> favoriteElements;
@@ -32,9 +33,11 @@ class SelectionDialog extends StatefulWidget {
this.flagWidth = 32,
this.size,
this.hideSearch = false,
this.closeIcon,
}) : assert(searchDecoration != null, 'searchDecoration must not be null!'),
this.searchDecoration =
searchDecoration.copyWith(prefixIcon: Icon(Icons.search)),
this.searchDecoration = searchDecoration.prefixIcon == null
? searchDecoration.copyWith(prefixIcon: Icon(Icons.search))
: searchDecoration,
super(key: key);
@override
@@ -75,7 +78,7 @@ class _SelectionDialogState extends State<SelectionDialog> {
IconButton(
padding: const EdgeInsets.all(0),
iconSize: 20,
icon: const Icon(Icons.close),
icon: widget.closeIcon,
onPressed: () => Navigator.pop(context),
),
if (!widget.hideSearch)