mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-10 09:45:14 +00:00
chore: Follow up fix search bar
This commit is contained in:
parent
9f4d11347c
commit
3d3a8f1853
2 changed files with 12 additions and 13 deletions
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue