fix: 首页搜索框频繁点击消失、评论排序切换空白
This commit is contained in:
@ -45,11 +45,7 @@ class _SearchPageState extends State<SearchPage> with RouteAware {
|
|||||||
return OpenContainer(
|
return OpenContainer(
|
||||||
closedElevation: 0,
|
closedElevation: 0,
|
||||||
openElevation: 0,
|
openElevation: 0,
|
||||||
onClosed: (_) async {
|
onClosed: (_) => _searchController.onClear(),
|
||||||
// 在 openBuilder 关闭时触发的回调函数
|
|
||||||
await Future.delayed(const Duration(milliseconds: 500));
|
|
||||||
_searchController.onClear();
|
|
||||||
},
|
|
||||||
openColor: Theme.of(context).colorScheme.background,
|
openColor: Theme.of(context).colorScheme.background,
|
||||||
middleColor: Theme.of(context).colorScheme.background,
|
middleColor: Theme.of(context).colorScheme.background,
|
||||||
closedColor: Theme.of(context).colorScheme.background,
|
closedColor: Theme.of(context).colorScheme.background,
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/http/reply.dart';
|
import 'package:pilipala/http/reply.dart';
|
||||||
@ -92,6 +93,7 @@ class VideoReplyController extends GetxController {
|
|||||||
|
|
||||||
// 排序搜索评论
|
// 排序搜索评论
|
||||||
queryBySort() {
|
queryBySort() {
|
||||||
|
EasyThrottle.throttle('queryBySort', const Duration(seconds: 1), () {
|
||||||
feedBack();
|
feedBack();
|
||||||
switch (sortType) {
|
switch (sortType) {
|
||||||
case ReplySortType.time:
|
case ReplySortType.time:
|
||||||
@ -108,7 +110,9 @@ class VideoReplyController extends GetxController {
|
|||||||
sortTypeTitle.value = sortType.titles;
|
sortTypeTitle.value = sortType.titles;
|
||||||
sortTypeLabel.value = sortType.labels;
|
sortTypeLabel.value = sortType.labels;
|
||||||
currentPage = 0;
|
currentPage = 0;
|
||||||
|
noMore.value = '';
|
||||||
replyList.clear();
|
replyList.clear();
|
||||||
queryReplyList(type: 'init');
|
queryReplyList(type: 'init');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user