Search: Show a better message when not found

It used to show "Why don't you add a new note"
This commit is contained in:
Vishesh Handa
2019-10-06 12:46:06 +02:00
parent 8d717cbaeb
commit d4718e9fc9
2 changed files with 5 additions and 1 deletions

View File

@ -33,6 +33,7 @@ class HomeScreen extends StatelessWidget {
); );
Navigator.of(context).push(route); Navigator.of(context).push(route);
}, },
emptyText: "Why not add your first\n Journal Entry?",
); );
bool shouldShowBadge = bool shouldShowBadge =
@ -141,6 +142,7 @@ class NoteSearch extends SearchDelegate<Note> {
); );
Navigator.of(context).push(route); Navigator.of(context).push(route);
}, },
emptyText: "No Search Results Found",
); );
return journalList; return journalList;
} }

View File

@ -12,10 +12,12 @@ typedef void NoteSelectedFunction(int noteIndex);
class JournalList extends StatelessWidget { class JournalList extends StatelessWidget {
final NoteSelectedFunction noteSelectedFunction; final NoteSelectedFunction noteSelectedFunction;
final List<Note> notes; final List<Note> notes;
final String emptyText;
JournalList({ JournalList({
@required this.notes, @required this.notes,
@required this.noteSelectedFunction, @required this.noteSelectedFunction,
@required this.emptyText,
}); });
@override @override
@ -23,7 +25,7 @@ class JournalList extends StatelessWidget {
if (notes.isEmpty) { if (notes.isEmpty) {
return Center( return Center(
child: Text( child: Text(
"Why not add your first\n Journal Entry?", emptyText,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 28.0, fontSize: 28.0,