Merge pull request #17 from juanmartin8a/optional-close-icon

Hide dialog close icon
This commit is contained in:
Chandra Abdul Fattah
2023-10-20 10:08:10 +07:00
committed by GitHub
2 changed files with 8 additions and 0 deletions

View File

@@ -75,6 +75,9 @@ class CountryCodePicker extends StatefulWidget {
/// Set to true if you want to hide the search part /// Set to true if you want to hide the search part
final bool hideSearch; final bool hideSearch;
/// Set to true if you want to hide the close icon dialog
final bool hideCloseIcon;
/// Set to true if you want to show drop down button /// Set to true if you want to show drop down button
final bool showDropDownButton; final bool showDropDownButton;
@@ -114,6 +117,7 @@ class CountryCodePicker extends StatefulWidget {
this.comparator, this.comparator,
this.countryFilter, this.countryFilter,
this.hideSearch = false, this.hideSearch = false,
this.hideCloseIcon = false,
this.showDropDownButton = false, this.showDropDownButton = false,
this.dialogSize, this.dialogSize,
this.dialogBackgroundColor, this.dialogBackgroundColor,
@@ -305,6 +309,7 @@ class CountryCodePickerState extends State<CountryCodePicker> {
backgroundColor: widget.dialogBackgroundColor, backgroundColor: widget.dialogBackgroundColor,
barrierColor: widget.barrierColor, barrierColor: widget.barrierColor,
hideSearch: widget.hideSearch, hideSearch: widget.hideSearch,
hideCloseIcon: widget.hideCloseIcon,
closeIcon: widget.closeIcon, closeIcon: widget.closeIcon,
flagDecoration: widget.flagDecoration, flagDecoration: widget.flagDecoration,
), ),

View File

@@ -17,6 +17,7 @@ class SelectionDialog extends StatefulWidget {
final Decoration? flagDecoration; final Decoration? flagDecoration;
final Size? size; final Size? size;
final bool hideSearch; final bool hideSearch;
final bool hideCloseIcon;
final Icon? closeIcon; final Icon? closeIcon;
/// Background color of SelectionDialog /// Background color of SelectionDialog
@@ -45,6 +46,7 @@ class SelectionDialog extends StatefulWidget {
this.backgroundColor, this.backgroundColor,
this.barrierColor, this.barrierColor,
this.hideSearch = false, this.hideSearch = false,
this.hideCloseIcon = false,
this.closeIcon, this.closeIcon,
}) : searchDecoration = searchDecoration.prefixIcon == null }) : searchDecoration = searchDecoration.prefixIcon == null
? searchDecoration.copyWith(prefixIcon: const Icon(Icons.search)) ? searchDecoration.copyWith(prefixIcon: const Icon(Icons.search))
@@ -84,6 +86,7 @@ class _SelectionDialogState extends State<SelectionDialog> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
if (!widget.hideCloseIcon)
IconButton( IconButton(
padding: const EdgeInsets.all(0), padding: const EdgeInsets.all(0),
iconSize: 20, iconSize: 20,