address book search fixes

This commit is contained in:
julian 2022-11-17 09:04:54 -06:00
parent 49103c86f1
commit 8c0a6f5669
2 changed files with 26 additions and 26 deletions

View file

@ -261,6 +261,7 @@ class _AddressBookViewState extends ConsumerState<AddressBookView> {
onTap: () async { onTap: () async {
setState(() { setState(() {
_searchController.text = ""; _searchController.text = "";
_searchTerm = "";
}); });
}, },
), ),

View file

@ -152,12 +152,6 @@ class _DesktopAddressBook extends ConsumerState<DesktopAddressBook> {
ref.read(addressBookServiceProvider).matches(_searchTerm, e)) ref.read(addressBookServiceProvider).matches(_searchTerm, e))
.where((element) => element.isFavorite); .where((element) => element.isFavorite);
print("=========================================================");
print("contacts: ${contacts.length}");
print("favorites: ${favorites.length}");
print("allContacts: ${allContacts.length}");
print("=========================================================");
return DesktopScaffold( return DesktopScaffold(
appBar: DesktopAppBar( appBar: DesktopAppBar(
isCompactHeight: true, isCompactHeight: true,
@ -222,6 +216,7 @@ class _DesktopAddressBook extends ConsumerState<DesktopAddressBook> {
onTap: () async { onTap: () async {
setState(() { setState(() {
_searchController.text = ""; _searchController.text = "";
_searchTerm = "";
}); });
}, },
), ),
@ -284,8 +279,18 @@ class _DesktopAddressBook extends ConsumerState<DesktopAddressBook> {
style: STextStyles.smallMed12(context), style: STextStyles.smallMed12(context),
), ),
), ),
favorites: favorites.isNotEmpty favorites: favorites.isEmpty
? RoundedWhiteContainer( ? contacts.isNotEmpty
? null
: RoundedWhiteContainer(
child: Center(
child: Text(
"Your favorite contacts will appear here",
style: STextStyles.itemSubtitle(context),
),
),
)
: RoundedWhiteContainer(
padding: const EdgeInsets.all(0), padding: const EdgeInsets.all(0),
child: Column( child: Column(
children: [ children: [
@ -297,17 +302,19 @@ class _DesktopAddressBook extends ConsumerState<DesktopAddressBook> {
), ),
], ],
), ),
)
: RoundedWhiteContainer(
child: Center(
child: Text(
"Your favorite contacts will appear here",
style: STextStyles.itemSubtitle(context),
),
),
), ),
all: allContacts.isNotEmpty all: allContacts.isEmpty
? Column( ? contacts.isNotEmpty
? null
: RoundedWhiteContainer(
child: Center(
child: Text(
"Your contacts will appear here",
style: STextStyles.itemSubtitle(context),
),
),
)
: Column(
children: [ children: [
RoundedWhiteContainer( RoundedWhiteContainer(
padding: const EdgeInsets.all(0), padding: const EdgeInsets.all(0),
@ -326,14 +333,6 @@ class _DesktopAddressBook extends ConsumerState<DesktopAddressBook> {
), ),
), ),
], ],
)
: RoundedWhiteContainer(
child: Center(
child: Text(
"Your contacts will appear here",
style: STextStyles.itemSubtitle(context),
),
),
), ),
details: Container( details: Container(
color: Colors.purple, color: Colors.purple,