|
|
|
@ -8,6 +8,7 @@ class DefaultAppBarSearchField extends StatefulWidget {
|
|
|
|
|
final String prefixText;
|
|
|
|
|
final String hintText;
|
|
|
|
|
final EdgeInsets padding;
|
|
|
|
|
final bool readOnly;
|
|
|
|
|
|
|
|
|
|
const DefaultAppBarSearchField({
|
|
|
|
|
Key key,
|
|
|
|
@ -18,6 +19,7 @@ class DefaultAppBarSearchField extends StatefulWidget {
|
|
|
|
|
this.prefixText,
|
|
|
|
|
this.hintText,
|
|
|
|
|
this.padding,
|
|
|
|
|
this.readOnly = false,
|
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@ -71,6 +73,7 @@ class _DefaultAppBarSearchFieldState extends State<DefaultAppBarSearchField> {
|
|
|
|
|
controller: _searchController,
|
|
|
|
|
onChanged: widget.onChanged,
|
|
|
|
|
focusNode: _focusNode,
|
|
|
|
|
readOnly: widget.readOnly,
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
prefixText: widget.prefixText,
|
|
|
|
|
contentPadding: EdgeInsets.only(
|
|
|
|
@ -82,9 +85,10 @@ class _DefaultAppBarSearchFieldState extends State<DefaultAppBarSearchField> {
|
|
|
|
|
borderRadius: BorderRadius.circular(32),
|
|
|
|
|
),
|
|
|
|
|
hintText: widget.hintText,
|
|
|
|
|
suffixIcon: _focusNode.hasFocus ||
|
|
|
|
|
(widget.suffix == null &&
|
|
|
|
|
(_searchController.text?.isNotEmpty ?? false))
|
|
|
|
|
suffixIcon: !widget.readOnly &&
|
|
|
|
|
(_focusNode.hasFocus ||
|
|
|
|
|
(widget.suffix == null &&
|
|
|
|
|
(_searchController.text?.isNotEmpty ?? false)))
|
|
|
|
|
? IconButton(
|
|
|
|
|
icon: Icon(Icons.backspace_outlined),
|
|
|
|
|
onPressed: () {
|
|
|
|
|