Merge pull request #25 from Afulton11/feature/styleable-search-field
Add custom search InputDecoration to SelectionDialog
This commit is contained in:
@@ -14,6 +14,8 @@ class CountryCodePicker extends StatefulWidget {
|
||||
final TextStyle textStyle;
|
||||
final EdgeInsetsGeometry padding;
|
||||
final bool showCountryOnly;
|
||||
final InputDecoration searchDecoration;
|
||||
final TextStyle searchStyle;
|
||||
final WidgetBuilder emptySearchBuilder;
|
||||
|
||||
/// shows the name of the country instead of the dialcode
|
||||
@@ -33,6 +35,8 @@ class CountryCodePicker extends StatefulWidget {
|
||||
this.textStyle,
|
||||
this.padding = const EdgeInsets.all(0.0),
|
||||
this.showCountryOnly = false,
|
||||
this.searchDecoration = const InputDecoration(),
|
||||
this.searchStyle,
|
||||
this.emptySearchBuilder,
|
||||
this.showOnlyCountryWhenClosed = false,
|
||||
this.alignLeft = false,
|
||||
@@ -132,6 +136,8 @@ class _CountryCodePickerState extends State<CountryCodePicker> {
|
||||
favoriteElements,
|
||||
showCountryOnly: widget.showCountryOnly,
|
||||
emptySearchBuilder: widget.emptySearchBuilder,
|
||||
searchDecoration: widget.searchDecoration,
|
||||
searchStyle: widget.searchStyle,
|
||||
),
|
||||
).then((e) {
|
||||
if (e != null) {
|
||||
|
||||
@@ -5,6 +5,8 @@ import 'package:flutter/material.dart';
|
||||
class SelectionDialog extends StatefulWidget {
|
||||
final List<CountryCode> elements;
|
||||
final bool showCountryOnly;
|
||||
final InputDecoration searchDecoration;
|
||||
final TextStyle searchStyle;
|
||||
final WidgetBuilder emptySearchBuilder;
|
||||
|
||||
/// elements passed as favorite
|
||||
@@ -14,7 +16,12 @@ class SelectionDialog extends StatefulWidget {
|
||||
Key key,
|
||||
this.showCountryOnly,
|
||||
this.emptySearchBuilder,
|
||||
}) : super(key: key);
|
||||
InputDecoration searchDecoration = const InputDecoration(),
|
||||
this.searchStyle,
|
||||
}) :
|
||||
assert(searchDecoration != null, 'searchDecoration must not be null!'),
|
||||
this.searchDecoration = searchDecoration.copyWith(prefixIcon: Icon(Icons.search)),
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _SelectionDialogState();
|
||||
@@ -29,7 +36,8 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
||||
title: Column(
|
||||
children: <Widget>[
|
||||
TextField(
|
||||
decoration: const InputDecoration(prefixIcon: Icon(Icons.search)),
|
||||
style: widget.searchStyle,
|
||||
decoration: widget.searchDecoration,
|
||||
onChanged: _filterElements,
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user