From 628d52f01fbe5f6b7f9be0521fdfef822ee84596 Mon Sep 17 00:00:00 2001 From: bytedream Date: Wed, 27 Mar 2024 18:27:13 +0100 Subject: [PATCH] added text if no search results were found --- lib/view/locationSearch.dart | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/view/locationSearch.dart b/lib/view/locationSearch.dart index e79a295..cda4eb4 100644 --- a/lib/view/locationSearch.dart +++ b/lib/view/locationSearch.dart @@ -38,8 +38,18 @@ class LocationSearchDelegate extends SearchDelegate { case ConnectionState.active: case ConnectionState.none: case ConnectionState.done: + if ((snapshot.data?.length ?? 0) == 0) { + return const Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 50), + Text("Keine Sucherergebnisse gefunden") + ], + ); + } return ListView.builder( - itemCount: snapshot.data?.length ?? 0, + itemCount: snapshot.data!.length, itemBuilder: (context, index) { Place place = snapshot.data![index]; return ListTile(