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 #129 from xrgloria/add_dialog_background_color
Browse files Browse the repository at this point in the history
Adds background color to selection dialog
  • Loading branch information
imtoori authored Dec 11, 2020
2 parents 74c64a7 + 930b8eb commit 3b3ca7b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions lib/country_code_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class CountryCodePicker extends StatefulWidget {
/// the size of the selection dialog
final Size dialogSize;

/// Background color of selection dialog
final Color dialogBackgroundColor;

/// used to customize the country list
final List<String> countryFilter;

Expand Down Expand Up @@ -97,6 +100,7 @@ class CountryCodePicker extends StatefulWidget {
this.countryFilter,
this.hideSearch = false,
this.dialogSize,
this.dialogBackgroundColor,
this.closeIcon = const Icon(Icons.close),
Key key,
}) : super(key: key);
Expand Down Expand Up @@ -260,6 +264,8 @@ class CountryCodePickerState extends State<CountryCodePicker> {
: widget.showFlag,
flagWidth: widget.flagWidth,
size: widget.dialogSize,
backgroundColor: widget.dialogBackgroundColor,
barrierColor: widget.barrierColor,
hideSearch: widget.hideSearch,
closeIcon: widget.closeIcon,
),
Expand Down
12 changes: 10 additions & 2 deletions lib/selection_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ class SelectionDialog extends StatefulWidget {
final bool hideSearch;
final Icon closeIcon;

/// Background color of SelectionDialog
final Color backgroundColor;

/// Boxshaow color of SelectionDialog that matches CountryCodePicker barrier color
final Color barrierColor;

/// elements passed as favorite
final List<CountryCode> favoriteElements;

Expand All @@ -32,6 +38,8 @@ class SelectionDialog extends StatefulWidget {
this.showFlag,
this.flagWidth = 32,
this.size,
this.backgroundColor,
this.barrierColor,
this.hideSearch = false,
this.closeIcon,
}) : assert(searchDecoration != null, 'searchDecoration must not be null!'),
Expand All @@ -58,11 +66,11 @@ class _SelectionDialogState extends State<SelectionDialog> {
widget.size?.height ?? MediaQuery.of(context).size.height * 0.85,
decoration: widget.boxDecoration ??
BoxDecoration(
color: Colors.white,
color: widget.backgroundColor ?? Colors.white,
borderRadius: BorderRadius.all(Radius.circular(25.0)),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(1),
color: widget.barrierColor ?? Colors.grey.withOpacity(1),
spreadRadius: 5,
blurRadius: 7,
offset: Offset(0, 3), // changes position of shadow
Expand Down

0 comments on commit 3b3ca7b

Please sign in to comment.