From 8c0a6f5669de3d0bf4aa8b6c5329ff4d09e6bc30 Mon Sep 17 00:00:00 2001 From: julian Date: Thu, 17 Nov 2022 09:04:54 -0600 Subject: [PATCH] address book search fixes --- .../address_book_views/address_book_view.dart | 1 + .../desktop_address_book.dart | 51 +++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lib/pages/address_book_views/address_book_view.dart b/lib/pages/address_book_views/address_book_view.dart index 35e2601e2..cdc9fb5b7 100644 --- a/lib/pages/address_book_views/address_book_view.dart +++ b/lib/pages/address_book_views/address_book_view.dart @@ -261,6 +261,7 @@ class _AddressBookViewState extends ConsumerState { onTap: () async { setState(() { _searchController.text = ""; + _searchTerm = ""; }); }, ), diff --git a/lib/pages_desktop_specific/home/address_book_view/desktop_address_book.dart b/lib/pages_desktop_specific/home/address_book_view/desktop_address_book.dart index abb797aac..51b075284 100644 --- a/lib/pages_desktop_specific/home/address_book_view/desktop_address_book.dart +++ b/lib/pages_desktop_specific/home/address_book_view/desktop_address_book.dart @@ -152,12 +152,6 @@ class _DesktopAddressBook extends ConsumerState { ref.read(addressBookServiceProvider).matches(_searchTerm, e)) .where((element) => element.isFavorite); - print("========================================================="); - print("contacts: ${contacts.length}"); - print("favorites: ${favorites.length}"); - print("allContacts: ${allContacts.length}"); - print("========================================================="); - return DesktopScaffold( appBar: DesktopAppBar( isCompactHeight: true, @@ -222,6 +216,7 @@ class _DesktopAddressBook extends ConsumerState { onTap: () async { setState(() { _searchController.text = ""; + _searchTerm = ""; }); }, ), @@ -284,8 +279,18 @@ class _DesktopAddressBook extends ConsumerState { style: STextStyles.smallMed12(context), ), ), - favorites: favorites.isNotEmpty - ? RoundedWhiteContainer( + favorites: favorites.isEmpty + ? contacts.isNotEmpty + ? null + : RoundedWhiteContainer( + child: Center( + child: Text( + "Your favorite contacts will appear here", + style: STextStyles.itemSubtitle(context), + ), + ), + ) + : RoundedWhiteContainer( padding: const EdgeInsets.all(0), child: Column( children: [ @@ -297,17 +302,19 @@ class _DesktopAddressBook extends ConsumerState { ), ], ), - ) - : RoundedWhiteContainer( - child: Center( - child: Text( - "Your favorite contacts will appear here", - style: STextStyles.itemSubtitle(context), - ), - ), ), - all: allContacts.isNotEmpty - ? Column( + all: allContacts.isEmpty + ? contacts.isNotEmpty + ? null + : RoundedWhiteContainer( + child: Center( + child: Text( + "Your contacts will appear here", + style: STextStyles.itemSubtitle(context), + ), + ), + ) + : Column( children: [ RoundedWhiteContainer( padding: const EdgeInsets.all(0), @@ -326,14 +333,6 @@ class _DesktopAddressBook extends ConsumerState { ), ), ], - ) - : RoundedWhiteContainer( - child: Center( - child: Text( - "Your contacts will appear here", - style: STextStyles.itemSubtitle(context), - ), - ), ), details: Container( color: Colors.purple,