Merge branch 'master' into master

This commit is contained in:
Salvatore Giordano
2020-12-11 23:24:49 +01:00
committed by GitHub
4 changed files with 37 additions and 24 deletions

View File

@@ -37,6 +37,9 @@ class CountryCodePicker extends StatefulWidget {
/// the size of the selection dialog /// the size of the selection dialog
final Size dialogSize; final Size dialogSize;
/// Background color of selection dialog
final Color dialogBackgroundColor;
/// used to customize the country list /// used to customize the country list
final List<String> countryFilter; final List<String> countryFilter;
@@ -101,6 +104,7 @@ class CountryCodePicker extends StatefulWidget {
this.hideSearch = false, this.hideSearch = false,
this.showDropDownButton = false, this.showDropDownButton = false,
this.dialogSize, this.dialogSize,
this.dialogBackgroundColor,
this.closeIcon = const Icon(Icons.close), this.closeIcon = const Icon(Icons.close),
Key key, Key key,
}) : super(key: key); }) : super(key: key);
@@ -266,26 +270,27 @@ class CountryCodePickerState extends State<CountryCodePicker> {
barrierColor: widget.barrierColor ?? Colors.grey.withOpacity(0.5), barrierColor: widget.barrierColor ?? Colors.grey.withOpacity(0.5),
backgroundColor: widget.backgroundColor ?? Colors.transparent, backgroundColor: widget.backgroundColor ?? Colors.transparent,
context: context, context: context,
builder: (context) => builder: (context) => Center(
Center( child: SelectionDialog(
child: SelectionDialog( elements,
elements, favoriteElements,
favoriteElements, showCountryOnly: widget.showCountryOnly,
showCountryOnly: widget.showCountryOnly, emptySearchBuilder: widget.emptySearchBuilder,
emptySearchBuilder: widget.emptySearchBuilder, searchDecoration: widget.searchDecoration,
searchDecoration: widget.searchDecoration, searchStyle: widget.searchStyle,
searchStyle: widget.searchStyle, textStyle: widget.dialogTextStyle,
textStyle: widget.dialogTextStyle, boxDecoration: widget.boxDecoration,
boxDecoration: widget.boxDecoration, showFlag: widget.showFlagDialog != null
showFlag: widget.showFlagDialog != null ? widget.showFlagDialog
? widget.showFlagDialog : widget.showFlag,
: widget.showFlag, flagWidth: widget.flagWidth,
flagWidth: widget.flagWidth, size: widget.dialogSize,
size: widget.dialogSize, backgroundColor: widget.dialogBackgroundColor,
hideSearch: widget.hideSearch, barrierColor: widget.barrierColor,
closeIcon: widget.closeIcon, hideSearch: widget.hideSearch,
), closeIcon: widget.closeIcon,
), ),
),
).then((e) { ).then((e) {
if (e != null) { if (e != null) {
setState(() { setState(() {

View File

@@ -226,7 +226,7 @@
"TR": "土耳其", "TR": "土耳其",
"TT": "特立尼达和多巴哥", "TT": "特立尼达和多巴哥",
"TV": "图瓦卢", "TV": "图瓦卢",
"TW": "中国台湾", "TW": "台湾",
"TZ": "坦桑尼亚", "TZ": "坦桑尼亚",
"UA": "乌克兰", "UA": "乌克兰",
"UG": "乌干达", "UG": "乌干达",

View File

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

View File

@@ -10,7 +10,7 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
modal_bottom_sheet: ^1.0.1-dev modal_bottom_sheet: ^1.0.0+1
flutter: flutter:
assets: assets: