diff --git a/lib/country_code_picker.dart b/lib/country_code_picker.dart index 9b02493..fa9d6c5 100644 --- a/lib/country_code_picker.dart +++ b/lib/country_code_picker.dart @@ -14,6 +14,7 @@ class CountryCodePicker extends StatefulWidget { final TextStyle textStyle; final EdgeInsetsGeometry padding; final bool showCountryOnly; + final InputDecoration searchDecoration; CountryCodePicker({ this.onChanged, @@ -22,6 +23,7 @@ class CountryCodePicker extends StatefulWidget { this.textStyle, this.padding = const EdgeInsets.all(0.0), this.showCountryOnly = false, + this.searchDecoration, }); @override @@ -108,7 +110,8 @@ class _CountryCodePickerState extends State { showDialog( context: context, builder: (_) => new SelectionDialog(elements, favoriteElements, - showCountryOnly: widget.showCountryOnly), + showCountryOnly: widget.showCountryOnly, + searchDecoration: widget.searchDecoration,), ).then((e) { if (e != null) { setState(() { diff --git a/lib/selection_dialog.dart b/lib/selection_dialog.dart index c5da25b..feceafd 100644 --- a/lib/selection_dialog.dart +++ b/lib/selection_dialog.dart @@ -5,11 +5,15 @@ import 'package:flutter/material.dart'; class SelectionDialog extends StatefulWidget { final List elements; final bool showCountryOnly; + final InputDecoration searchDecoration; /// elements passed as favorite final List favoriteElements; - SelectionDialog(this.elements, this.favoriteElements, {this.showCountryOnly}); + SelectionDialog(this.elements, this.favoriteElements, { + this.showCountryOnly, + InputDecoration searchDecoration = const InputDecoration(), + }) : this.searchDecoration = searchDecoration.copyWith(prefixIcon: Icon(Icons.search)); @override State createState() => new _SelectionDialogState(); @@ -24,7 +28,7 @@ class _SelectionDialogState extends State { title: new Column( children: [ new TextField( - decoration: new InputDecoration(prefixIcon: new Icon(Icons.search)), + decoration: widget.searchDecoration, onChanged: _filterElements, ), ],