1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 13:58:47 +00:00

[veggieseasons] Fix search backspace when no results (#766)

This commit is contained in:
Daco Harkes
2021-03-12 09:20:38 +01:00
committed by GitHub
parent fc5b4510b0
commit a9482b18c2

View File

@@ -45,12 +45,12 @@ class _SearchScreenState extends State<SearchScreen> with RestorationMixin {
setState(() => terms = controller.value.text);
}
Widget _createSearchBox() {
Widget _createSearchBox({bool focus = true}) {
return Padding(
padding: const EdgeInsets.all(8),
child: CupertinoSearchTextField(
controller: controller.value,
focusNode: focusNode,
focusNode: focus ? focusNode : null,
),
);
}
@@ -77,7 +77,7 @@ class _SearchScreenState extends State<SearchScreen> with RestorationMixin {
// This invisible and otherwise unnecessary search box is used to
// pad the list entries downward, so none will be underneath the
// real search box when the list is at its top scroll position.
child: _createSearchBox(),
child: _createSearchBox(focus: false),
visible: false,
maintainSize: true,
maintainAnimation: true,