Improve SelectionDialog Performance

* Also added a emptySearchBuilder property, this is the widget that will build when a search contains no results.
This commit is contained in:
Andrew Fulton
2019-04-01 21:27:53 -05:00
parent 7cec16c29d
commit 7ffdd968f7
2 changed files with 66 additions and 38 deletions

View File

@@ -14,6 +14,7 @@ class CountryCodePicker extends StatefulWidget {
final TextStyle textStyle;
final EdgeInsetsGeometry padding;
final bool showCountryOnly;
final WidgetBuilder emptySearchBuilder;
CountryCodePicker({
this.onChanged,
@@ -22,6 +23,7 @@ class CountryCodePicker extends StatefulWidget {
this.textStyle,
this.padding = const EdgeInsets.all(0.0),
this.showCountryOnly = false,
this.emptySearchBuilder,
});
@override
@@ -107,8 +109,13 @@ class _CountryCodePickerState extends State<CountryCodePicker> {
void _showSelectionDialog() {
showDialog(
context: context,
builder: (_) => new SelectionDialog(elements, favoriteElements,
showCountryOnly: widget.showCountryOnly),
builder: (_) =>
SelectionDialog(
elements,
favoriteElements,
showCountryOnly: widget.showCountryOnly,
emptySearchBuilder: widget.emptySearchBuilder,
),
).then((e) {
if (e != null) {
setState(() {