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

bg-color_search-icon-color_cancel-icon-color #111

Closed
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
65 changes: 37 additions & 28 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 Color bgColor;

/// the size of the selection dialog
final Size dialogSize;
Expand Down Expand Up @@ -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<StatefulWidget> createState() {
Expand Down Expand Up @@ -245,6 +253,7 @@ class CountryCodePickerState extends State<CountryCodePicker> {
flagWidth: widget.flagWidth,
size: widget.dialogSize,
hideSearch: widget.hideSearch,
bgColor: widget.bgColor,
),
).then((e) {
if (e != null) {
Expand Down
16 changes: 13 additions & 3 deletions lib/selection_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<CountryCode> favoriteElements;
Expand All @@ -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
Expand All @@ -51,7 +60,7 @@ class _SelectionDialogState extends State<SelectionDialog> {
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(
Expand All @@ -74,6 +83,7 @@ class _SelectionDialogState extends State<SelectionDialog> {
iconSize: 20,
icon: Icon(
Icons.close,
color: widget.cancelIconColor,
),
onPressed: () => Navigator.pop(context),
),
Expand Down