diff --git a/lib/country_code_picker.dart b/lib/country_code_picker.dart index 1fa96723..58e7f99e 100644 --- a/lib/country_code_picker.dart +++ b/lib/country_code_picker.dart @@ -23,6 +23,7 @@ class CountryCodePicker extends StatefulWidget { final Function(CountryCode) builder; final bool enabled; final TextOverflow textOverflow; + final Color bgColor; /// the size of the selection dialog final Size dialogSize; @@ -58,34 +59,41 @@ class CountryCodePicker extends StatefulWidget { /// Set to true if you want to hide the search part final bool hideSearch; - CountryCodePicker({ - this.onChanged, - this.onInit, - this.initialSelection, - this.favorite = const [], - this.textStyle, - this.padding = const EdgeInsets.all(0.0), - this.showCountryOnly = false, - this.searchDecoration = const InputDecoration(), - this.searchStyle, - this.dialogTextStyle, - this.emptySearchBuilder, - this.showOnlyCountryWhenClosed = false, - this.alignLeft = false, - this.showFlag = true, - this.showFlagDialog, - this.hideMainText = false, - this.showFlagMain, - this.builder, - this.flagWidth = 32.0, - this.enabled = true, - this.textOverflow = TextOverflow.ellipsis, - this.comparator, - this.countryFilter, - this.hideSearch = false, - this.dialogSize, - Key key, - }) : super(key: key); + final Color searchIconColor; + + final Color cancelIconColor; + + CountryCodePicker( + {this.onChanged, + this.onInit, + this.initialSelection, + this.favorite = const [], + this.textStyle, + this.padding = const EdgeInsets.all(0.0), + this.showCountryOnly = false, + this.searchDecoration = const InputDecoration(), + this.searchStyle, + this.dialogTextStyle, + this.emptySearchBuilder, + this.showOnlyCountryWhenClosed = false, + this.alignLeft = false, + this.showFlag = true, + this.showFlagDialog, + this.hideMainText = false, + this.showFlagMain, + this.builder, + this.flagWidth = 32.0, + this.enabled = true, + this.textOverflow = TextOverflow.ellipsis, + this.comparator, + this.countryFilter, + this.hideSearch = false, + this.dialogSize, + Key key, + this.bgColor = Colors.white, + this.searchIconColor = Colors.black, + this.cancelIconColor = Colors.black}) + : super(key: key); @override State createState() { @@ -245,6 +253,7 @@ class CountryCodePickerState extends State { flagWidth: widget.flagWidth, size: widget.dialogSize, hideSearch: widget.hideSearch, + bgColor: widget.bgColor, ), ).then((e) { if (e != null) { diff --git a/lib/selection_dialog.dart b/lib/selection_dialog.dart index e7d8e681..de80f63e 100644 --- a/lib/selection_dialog.dart +++ b/lib/selection_dialog.dart @@ -13,6 +13,9 @@ class SelectionDialog extends StatefulWidget { final double flagWidth; final Size size; final bool hideSearch; + final Color bgColor; + final Color searchIconColor; + final Color cancelIconColor; /// elements passed as favorite final List favoriteElements; @@ -30,9 +33,15 @@ class SelectionDialog extends StatefulWidget { this.flagWidth = 32, this.size, this.hideSearch = false, + this.bgColor, + this.searchIconColor, + this.cancelIconColor, }) : assert(searchDecoration != null, 'searchDecoration must not be null!'), - this.searchDecoration = - searchDecoration.copyWith(prefixIcon: Icon(Icons.search)), + this.searchDecoration = searchDecoration.copyWith( + prefixIcon: Icon( + Icons.search, + color: searchIconColor, + )), super(key: key); @override @@ -51,7 +60,7 @@ class _SelectionDialogState extends State { height: widget.size?.height ?? MediaQuery.of(context).size.height * 0.85, decoration: BoxDecoration( - color: Colors.white, + color: widget.bgColor, borderRadius: BorderRadius.all(Radius.circular(25.0)), boxShadow: [ BoxShadow( @@ -74,6 +83,7 @@ class _SelectionDialogState extends State { iconSize: 20, icon: Icon( Icons.close, + color: widget.cancelIconColor, ), onPressed: () => Navigator.pop(context), ),