Skip to content
This repository has been archived by the owner on Jul 20, 2022. It is now read-only.

Commit

Permalink
Merge pull request #105 from vlfr1997/master
Browse files Browse the repository at this point in the history
Added option to change close icon and search icon
  • Loading branch information
imtoori authored Oct 11, 2020
2 parents cb84307 + 912d121 commit 3c33192
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions lib/country_code_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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) {
Expand Down
9 changes: 6 additions & 3 deletions lib/selection_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 3c33192

Please sign in to comment.