SearchDelegate: Remove it when pressing 'x'

Usually 'x' just clears the query, but if there is no query it is
strange that nothing happens on pressing it.
This commit is contained in:
Vishesh Handa
2020-02-09 16:07:00 +01:00
parent 5ae288a3f6
commit cfb2703414

View File

@ -31,7 +31,11 @@ class NoteSearchDelegate extends SearchDelegate<Note> {
IconButton(
icon: Icon(Icons.close),
onPressed: () {
if (query.isEmpty) {
close(context, null);
} else {
query = '';
}
},
),
];