Added flagDecoration feature to allow for flexibility in flag design/shape etc
This commit is contained in:
@@ -74,6 +74,9 @@ class CountryCodePicker extends StatefulWidget {
|
||||
/// Set to true if you want to show drop down button
|
||||
final bool showDropDownButton;
|
||||
|
||||
/// [BoxDecoration] for the flag image
|
||||
final Decoration flagDecoration;
|
||||
|
||||
CountryCodePicker({
|
||||
this.onChanged,
|
||||
this.onInit,
|
||||
@@ -92,6 +95,7 @@ class CountryCodePicker extends StatefulWidget {
|
||||
this.showFlagDialog,
|
||||
this.hideMainText = false,
|
||||
this.showFlagMain,
|
||||
this.flagDecoration,
|
||||
this.builder,
|
||||
this.flagWidth = 32.0,
|
||||
this.enabled = true,
|
||||
@@ -164,8 +168,11 @@ class CountryCodePickerState extends State<CountryCodePicker> {
|
||||
Flexible(
|
||||
flex: widget.alignLeft ? 0 : 1,
|
||||
fit: widget.alignLeft ? FlexFit.tight : FlexFit.loose,
|
||||
child: Padding(
|
||||
padding: widget.alignLeft
|
||||
child: Container(
|
||||
clipBehavior:
|
||||
widget.flagDecoration == null ? Clip.none : Clip.hardEdge,
|
||||
decoration: widget.flagDecoration,
|
||||
margin: widget.alignLeft
|
||||
? const EdgeInsets.only(right: 16.0, left: 8.0)
|
||||
: const EdgeInsets.only(right: 16.0),
|
||||
child: Image.asset(
|
||||
@@ -281,6 +288,7 @@ class CountryCodePickerState extends State<CountryCodePicker> {
|
||||
? widget.showFlagDialog
|
||||
: widget.showFlag,
|
||||
flagWidth: widget.flagWidth,
|
||||
flagDecoration: widget.flagDecoration,
|
||||
size: widget.dialogSize,
|
||||
backgroundColor: widget.dialogBackgroundColor,
|
||||
barrierColor: widget.barrierColor,
|
||||
|
||||
@@ -12,6 +12,7 @@ class SelectionDialog extends StatefulWidget {
|
||||
final WidgetBuilder emptySearchBuilder;
|
||||
final bool showFlag;
|
||||
final double flagWidth;
|
||||
final Decoration flagDecoration;
|
||||
final Size size;
|
||||
final bool hideSearch;
|
||||
final Icon closeIcon;
|
||||
@@ -36,6 +37,7 @@ class SelectionDialog extends StatefulWidget {
|
||||
this.textStyle,
|
||||
this.boxDecoration,
|
||||
this.showFlag,
|
||||
this.flagDecoration,
|
||||
this.flagWidth = 32,
|
||||
this.size,
|
||||
this.backgroundColor,
|
||||
@@ -142,8 +144,11 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
||||
children: <Widget>[
|
||||
if (widget.showFlag)
|
||||
Flexible(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(right: 16.0),
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(right: 16.0),
|
||||
decoration: widget.flagDecoration,
|
||||
clipBehavior:
|
||||
widget.flagDecoration == null ? Clip.none : Clip.hardEdge,
|
||||
child: Image.asset(
|
||||
e.flagUri,
|
||||
package: 'country_code_picker',
|
||||
|
||||
Reference in New Issue
Block a user