From 3cd61a0b9ef22a676ef24f806e15229f75fff2a4 Mon Sep 17 00:00:00 2001 From: Gloria Ngo Date: Thu, 26 Nov 2020 21:16:50 -0500 Subject: [PATCH 1/2] Adds background color to selection dialog --- lib/country_code_picker.dart | 5 +++++ lib/selection_dialog.dart | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/country_code_picker.dart b/lib/country_code_picker.dart index d9ea707d..372573aa 100644 --- a/lib/country_code_picker.dart +++ b/lib/country_code_picker.dart @@ -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 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 { : widget.showFlag, flagWidth: widget.flagWidth, size: widget.dialogSize, + backgroundColor: widget.dialogBackgroundColor, hideSearch: widget.hideSearch, closeIcon: widget.closeIcon, ), diff --git a/lib/selection_dialog.dart b/lib/selection_dialog.dart index ad7c1680..9859e491 100644 --- a/lib/selection_dialog.dart +++ b/lib/selection_dialog.dart @@ -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 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 { 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( From 930b8eb4ba779a96250b133a9cbe897f79830445 Mon Sep 17 00:00:00 2001 From: Gloria Ngo Date: Thu, 26 Nov 2020 22:06:30 -0500 Subject: [PATCH 2/2] Match selection dialog box shadow with barrier color --- lib/country_code_picker.dart | 1 + lib/selection_dialog.dart | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/country_code_picker.dart b/lib/country_code_picker.dart index 372573aa..d444c794 100644 --- a/lib/country_code_picker.dart +++ b/lib/country_code_picker.dart @@ -265,6 +265,7 @@ class CountryCodePickerState extends State { flagWidth: widget.flagWidth, size: widget.dialogSize, backgroundColor: widget.dialogBackgroundColor, + barrierColor: widget.barrierColor, hideSearch: widget.hideSearch, closeIcon: widget.closeIcon, ), diff --git a/lib/selection_dialog.dart b/lib/selection_dialog.dart index 9859e491..1b7f8830 100644 --- a/lib/selection_dialog.dart +++ b/lib/selection_dialog.dart @@ -19,6 +19,9 @@ class SelectionDialog extends StatefulWidget { /// 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 favoriteElements; @@ -36,6 +39,7 @@ class SelectionDialog extends StatefulWidget { this.flagWidth = 32, this.size, this.backgroundColor, + this.barrierColor, this.hideSearch = false, this.closeIcon, }) : assert(searchDecoration != null, 'searchDecoration must not be null!'), @@ -66,7 +70,7 @@ class _SelectionDialogState extends State { 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