feat: 稍后再看下拉刷新

This commit is contained in:
guozhigq
2024-10-15 00:17:46 +08:00
parent 3f9b35b56b
commit 63a6c048e6
2 changed files with 66 additions and 59 deletions

View File

@ -22,11 +22,11 @@ class LaterController extends GetxController {
userInfo = userInfoCache.get('userInfoCache');
}
Future queryLaterList() async {
Future queryLaterList({type = 'init'}) async {
if (userInfo == null) {
return {'status': false, 'msg': '账号未登录', 'code': -101};
}
isLoading.value = true;
isLoading.value = type == 'init';
var res = await UserHttp.seeYouLater();
if (res['status']) {
count = res['data']['count'];

View File

@ -66,8 +66,13 @@ class _LaterPageState extends State<LaterPage> {
const SizedBox(width: 8),
],
),
body: CustomScrollView(
body: RefreshIndicator(
onRefresh: () async {
await _laterController.queryLaterList(type: 'onRefresh');
},
child: CustomScrollView(
controller: _laterController.scrollController,
physics: const AlwaysScrollableScrollPhysics(),
slivers: [
FutureBuilder(
future: _futureBuilderFuture,
@ -81,12 +86,13 @@ class _LaterPageState extends State<LaterPage> {
? SliverList(
delegate:
SliverChildBuilderDelegate((context, index) {
var videoItem = _laterController.laterList[index];
var videoItem =
_laterController.laterList[index];
return VideoCardH(
videoItem: videoItem,
source: 'later',
onPressedFn: () => _laterController.toViewDel(
aid: videoItem.aid));
onPressedFn: () => _laterController
.toViewDel(aid: videoItem.aid));
}, childCount: _laterController.laterList.length),
)
: _laterController.isLoading.value
@ -128,6 +134,7 @@ class _LaterPageState extends State<LaterPage> {
)
],
),
),
floatingActionButton: Obx(
() => _laterController.laterList.isNotEmpty
? FloatingActionButton.extended(