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

View File

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