chore: Follow up fix search bar

This commit is contained in:
Krille Fear 2022-12-29 10:33:13 +01:00
parent 05285b46d8
commit 54303ef635
2 changed files with 12 additions and 13 deletions

View File

@ -225,7 +225,7 @@ class ChatListController extends State<ChatList>
void onSearchEnter(String text) {
if (text.isEmpty) {
cancelSearch();
cancelSearch(unfocus: false);
return;
}
@ -236,14 +236,14 @@ class ChatListController extends State<ChatList>
_coolDown = Timer(const Duration(milliseconds: 500), _search);
}
void cancelSearch() {
void cancelSearch({bool unfocus = true}) {
setState(() {
searchController.clear();
isSearchMode = false;
roomSearchResult = userSearchResult = null;
isSearching = false;
});
FocusManager.instance.primaryFocus?.unfocus();
if (unfocus) FocusManager.instance.primaryFocus?.unfocus();
}
bool isTorBrowser = false;

View File

@ -67,16 +67,15 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
),
suffixIcon: controller.isSearchMode
? controller.isSearching
? const Align(
alignment: Alignment.centerRight,
child: Padding(
padding: EdgeInsets.symmetric(
vertical: 8.0, horizontal: 12),
child: SizedBox.square(
dimension: 24,
child: CircularProgressIndicator.adaptive(
strokeWidth: 2,
),
? const Padding(
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 12,
),
child: SizedBox.square(
dimension: 24,
child: CircularProgressIndicator.adaptive(
strokeWidth: 2,
),
),
)