Merge pull request #104 from Pyozer/feature/add-customization
Adding properties for customization
This commit is contained in:
@@ -24,6 +24,15 @@ class CountryCodePicker extends StatefulWidget {
|
|||||||
final bool enabled;
|
final bool enabled;
|
||||||
final TextOverflow textOverflow;
|
final TextOverflow textOverflow;
|
||||||
|
|
||||||
|
/// Barrier color of ModalBottomSheet
|
||||||
|
final Color barrierColor;
|
||||||
|
|
||||||
|
/// Background color of ModalBottomSheet
|
||||||
|
final Color backgroundColor;
|
||||||
|
|
||||||
|
/// BoxDecoration for dialog
|
||||||
|
final BoxDecoration boxDecoration;
|
||||||
|
|
||||||
/// the size of the selection dialog
|
/// the size of the selection dialog
|
||||||
final Size dialogSize;
|
final Size dialogSize;
|
||||||
|
|
||||||
@@ -80,6 +89,9 @@ class CountryCodePicker extends StatefulWidget {
|
|||||||
this.flagWidth = 32.0,
|
this.flagWidth = 32.0,
|
||||||
this.enabled = true,
|
this.enabled = true,
|
||||||
this.textOverflow = TextOverflow.ellipsis,
|
this.textOverflow = TextOverflow.ellipsis,
|
||||||
|
this.barrierColor,
|
||||||
|
this.backgroundColor,
|
||||||
|
this.boxDecoration,
|
||||||
this.comparator,
|
this.comparator,
|
||||||
this.countryFilter,
|
this.countryFilter,
|
||||||
this.hideSearch = false,
|
this.hideSearch = false,
|
||||||
@@ -228,8 +240,8 @@ class CountryCodePickerState extends State<CountryCodePicker> {
|
|||||||
|
|
||||||
void showCountryCodePickerDialog() {
|
void showCountryCodePickerDialog() {
|
||||||
showMaterialModalBottomSheet(
|
showMaterialModalBottomSheet(
|
||||||
barrierColor: Colors.grey.withOpacity(0.5),
|
barrierColor: widget.barrierColor ?? Colors.grey.withOpacity(0.5),
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: widget.backgroundColor ?? Colors.transparent,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context, scrollController) => SelectionDialog(
|
builder: (context, scrollController) => SelectionDialog(
|
||||||
elements,
|
elements,
|
||||||
@@ -239,6 +251,7 @@ class CountryCodePickerState extends State<CountryCodePicker> {
|
|||||||
searchDecoration: widget.searchDecoration,
|
searchDecoration: widget.searchDecoration,
|
||||||
searchStyle: widget.searchStyle,
|
searchStyle: widget.searchStyle,
|
||||||
textStyle: widget.dialogTextStyle,
|
textStyle: widget.dialogTextStyle,
|
||||||
|
boxDecoration: widget.boxDecoration,
|
||||||
showFlag: widget.showFlagDialog != null
|
showFlag: widget.showFlagDialog != null
|
||||||
? widget.showFlagDialog
|
? widget.showFlagDialog
|
||||||
: widget.showFlag,
|
: widget.showFlag,
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ class SelectionDialog extends StatefulWidget {
|
|||||||
final InputDecoration searchDecoration;
|
final InputDecoration searchDecoration;
|
||||||
final TextStyle searchStyle;
|
final TextStyle searchStyle;
|
||||||
final TextStyle textStyle;
|
final TextStyle textStyle;
|
||||||
|
final BoxDecoration boxDecoration;
|
||||||
final WidgetBuilder emptySearchBuilder;
|
final WidgetBuilder emptySearchBuilder;
|
||||||
final bool showFlag;
|
final bool showFlag;
|
||||||
final double flagWidth;
|
final double flagWidth;
|
||||||
@@ -26,6 +27,7 @@ class SelectionDialog extends StatefulWidget {
|
|||||||
InputDecoration searchDecoration = const InputDecoration(),
|
InputDecoration searchDecoration = const InputDecoration(),
|
||||||
this.searchStyle,
|
this.searchStyle,
|
||||||
this.textStyle,
|
this.textStyle,
|
||||||
|
this.boxDecoration,
|
||||||
this.showFlag,
|
this.showFlag,
|
||||||
this.flagWidth = 32,
|
this.flagWidth = 32,
|
||||||
this.size,
|
this.size,
|
||||||
@@ -50,18 +52,19 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
|||||||
width: widget.size?.width ?? MediaQuery.of(context).size.width,
|
width: widget.size?.width ?? MediaQuery.of(context).size.width,
|
||||||
height:
|
height:
|
||||||
widget.size?.height ?? MediaQuery.of(context).size.height * 0.85,
|
widget.size?.height ?? MediaQuery.of(context).size.height * 0.85,
|
||||||
decoration: BoxDecoration(
|
decoration: widget.boxDecoration ??
|
||||||
color: Colors.white,
|
BoxDecoration(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(25.0)),
|
color: Colors.white,
|
||||||
boxShadow: [
|
borderRadius: BorderRadius.all(Radius.circular(25.0)),
|
||||||
BoxShadow(
|
boxShadow: [
|
||||||
color: Colors.grey.withOpacity(1),
|
BoxShadow(
|
||||||
spreadRadius: 5,
|
color: Colors.grey.withOpacity(1),
|
||||||
blurRadius: 7,
|
spreadRadius: 5,
|
||||||
offset: Offset(0, 3), // changes position of shadow
|
blurRadius: 7,
|
||||||
|
offset: Offset(0, 3), // changes position of shadow
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
@@ -72,9 +75,7 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
|||||||
IconButton(
|
IconButton(
|
||||||
padding: const EdgeInsets.all(0),
|
padding: const EdgeInsets.all(0),
|
||||||
iconSize: 20,
|
iconSize: 20,
|
||||||
icon: Icon(
|
icon: const Icon(Icons.close),
|
||||||
Icons.close,
|
|
||||||
),
|
|
||||||
onPressed: () => Navigator.pop(context),
|
onPressed: () => Navigator.pop(context),
|
||||||
),
|
),
|
||||||
if (!widget.hideSearch)
|
if (!widget.hideSearch)
|
||||||
|
|||||||
Reference in New Issue
Block a user