mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
refactor: popular [wip]
mod: grpc request
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:PiliPalaX/grpc/app/card/v1/card.pb.dart';
|
||||
import 'package:PiliPalaX/http/loading_state.dart';
|
||||
import 'package:PiliPalaX/pages/common/popup_controller.dart';
|
||||
import 'package:PiliPalaX/http/video.dart';
|
||||
@@ -5,6 +6,8 @@ import 'package:PiliPalaX/http/video.dart';
|
||||
class HotController extends PopupController {
|
||||
final int _count = 20;
|
||||
|
||||
int idx = 0;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
@@ -12,8 +15,22 @@ class HotController extends PopupController {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<LoadingState> customGetData() => VideoHttp.hotVideoList(
|
||||
pn: currentPage,
|
||||
ps: _count,
|
||||
);
|
||||
Future onRefresh() {
|
||||
idx = 0;
|
||||
return super.onRefresh();
|
||||
}
|
||||
|
||||
// @override
|
||||
// Future<LoadingState> customGetData() => VideoHttp.hotVideoList(
|
||||
// pn: currentPage,
|
||||
// ps: _count,
|
||||
// );
|
||||
|
||||
@override
|
||||
void handleSuccess(List currentList, List dataList) {
|
||||
idx = (dataList.last as Card?)?.smallCoverV5.base.idx.toInt() ?? 0;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<LoadingState> customGetData() => VideoHttp.hotVideoListGrpc(idx: idx);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:PiliPalaX/common/widgets/video_card_h_grpc.dart';
|
||||
import 'package:PiliPalaX/http/loading_state.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
@@ -136,7 +137,7 @@ class _HotPageState extends State<HotPage> with AutomaticKeepAliveClientMixin {
|
||||
),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
return VideoCardH(
|
||||
return VideoCardHGrpc(
|
||||
videoItem: loadingState.response[index],
|
||||
showPubdate: true,
|
||||
longPress: () {
|
||||
|
||||
Reference in New Issue
Block a user