Merge pull request #3 from Afulton11/feature/styleable-search-field
Add custom search InputDecoration to SelectionDialog
This commit is contained in:
@@ -14,6 +14,7 @@ class CountryCodePicker extends StatefulWidget {
|
|||||||
final TextStyle textStyle;
|
final TextStyle textStyle;
|
||||||
final EdgeInsetsGeometry padding;
|
final EdgeInsetsGeometry padding;
|
||||||
final bool showCountryOnly;
|
final bool showCountryOnly;
|
||||||
|
final InputDecoration searchDecoration;
|
||||||
final WidgetBuilder emptySearchBuilder;
|
final WidgetBuilder emptySearchBuilder;
|
||||||
|
|
||||||
CountryCodePicker({
|
CountryCodePicker({
|
||||||
@@ -23,6 +24,7 @@ class CountryCodePicker extends StatefulWidget {
|
|||||||
this.textStyle,
|
this.textStyle,
|
||||||
this.padding = const EdgeInsets.all(0.0),
|
this.padding = const EdgeInsets.all(0.0),
|
||||||
this.showCountryOnly = false,
|
this.showCountryOnly = false,
|
||||||
|
this.searchDecoration,
|
||||||
this.emptySearchBuilder,
|
this.emptySearchBuilder,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -115,6 +117,7 @@ class _CountryCodePickerState extends State<CountryCodePicker> {
|
|||||||
favoriteElements,
|
favoriteElements,
|
||||||
showCountryOnly: widget.showCountryOnly,
|
showCountryOnly: widget.showCountryOnly,
|
||||||
emptySearchBuilder: widget.emptySearchBuilder,
|
emptySearchBuilder: widget.emptySearchBuilder,
|
||||||
|
searchDecoration: widget.searchDecoration,
|
||||||
),
|
),
|
||||||
).then((e) {
|
).then((e) {
|
||||||
if (e != null) {
|
if (e != null) {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
|
|||||||
class SelectionDialog extends StatefulWidget {
|
class SelectionDialog extends StatefulWidget {
|
||||||
final List<CountryCode> elements;
|
final List<CountryCode> elements;
|
||||||
final bool showCountryOnly;
|
final bool showCountryOnly;
|
||||||
|
final InputDecoration searchDecoration;
|
||||||
final WidgetBuilder emptySearchBuilder;
|
final WidgetBuilder emptySearchBuilder;
|
||||||
|
|
||||||
/// elements passed as favorite
|
/// elements passed as favorite
|
||||||
@@ -14,7 +15,10 @@ class SelectionDialog extends StatefulWidget {
|
|||||||
Key key,
|
Key key,
|
||||||
this.showCountryOnly,
|
this.showCountryOnly,
|
||||||
this.emptySearchBuilder,
|
this.emptySearchBuilder,
|
||||||
}) : super(key: key);
|
InputDecoration searchDecoration = const InputDecoration(),
|
||||||
|
}) :
|
||||||
|
this.searchDecoration = searchDecoration.copyWith(prefixIcon: Icon(Icons.search)),
|
||||||
|
super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() => _SelectionDialogState();
|
State<StatefulWidget> createState() => _SelectionDialogState();
|
||||||
@@ -29,7 +33,7 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
|||||||
title: Column(
|
title: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
TextField(
|
TextField(
|
||||||
decoration: const InputDecoration(prefixIcon: Icon(Icons.search)),
|
decoration: widget.searchDecoration,
|
||||||
onChanged: _filterElements,
|
onChanged: _filterElements,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user