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

Added option to change close icon and search icon #105

Merged
merged 7 commits into from
Oct 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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