Adds background color to selection dialog

This commit is contained in:
Gloria Ngo
2020-11-26 21:16:50 -05:00
parent c283da595f
commit 3cd61a0b9e
2 changed files with 10 additions and 1 deletions

View File

@@ -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;
@@ -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);
@@ -260,6 +264,7 @@ class CountryCodePickerState extends State<CountryCodePicker> {
: widget.showFlag,
flagWidth: widget.flagWidth,
size: widget.dialogSize,
backgroundColor: widget.dialogBackgroundColor,
hideSearch: widget.hideSearch,
closeIcon: widget.closeIcon,
),

View File

@@ -16,6 +16,9 @@ class SelectionDialog extends StatefulWidget {
final bool hideSearch;
final Icon closeIcon;
/// Background color of SelectionDialog
final Color backgroundColor;
/// elements passed as favorite
final List<CountryCode> favoriteElements;
@@ -32,6 +35,7 @@ class SelectionDialog extends StatefulWidget {
this.showFlag,
this.flagWidth = 32,
this.size,
this.backgroundColor,
this.hideSearch = false,
this.closeIcon,
}) : assert(searchDecoration != null, 'searchDecoration must not be null!'),
@@ -58,7 +62,7 @@ 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(