mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-20 18:40:13 +08:00
@@ -1,33 +1,35 @@
|
||||
import 'package:PiliPlus/http/fav.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/http/user.dart';
|
||||
import 'package:PiliPlus/models/user/sub_detail.dart';
|
||||
import 'package:PiliPlus/models/user/sub_folder.dart';
|
||||
import 'package:PiliPlus/models_new/sub/sub/list.dart';
|
||||
import 'package:PiliPlus/models_new/sub/sub_detail/data.dart';
|
||||
import 'package:PiliPlus/models_new/sub/sub_detail/media.dart';
|
||||
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class SubDetailController
|
||||
extends CommonListController<SubDetailModelData, SubDetailMediaItem> {
|
||||
late SubFolderItemData item;
|
||||
extends CommonListController<SubDetailData, SubDetailItemModel> {
|
||||
late SubItemModel item;
|
||||
|
||||
late int id;
|
||||
late String heroTag;
|
||||
|
||||
RxInt mediaCount = 0.obs;
|
||||
RxInt playCount = 0.obs;
|
||||
late final RxInt mediaCount;
|
||||
late final RxInt playCount;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
item = Get.arguments;
|
||||
playCount.value = item.viewCount!;
|
||||
mediaCount = (item.mediaCount ?? 0).obs;
|
||||
playCount = (item.viewCount ?? 0).obs;
|
||||
id = int.parse(Get.parameters['id']!);
|
||||
heroTag = Get.parameters['heroTag']!;
|
||||
queryData();
|
||||
}
|
||||
|
||||
@override
|
||||
List<SubDetailMediaItem>? getDataList(SubDetailModelData response) {
|
||||
return response.list;
|
||||
List<SubDetailItemModel>? getDataList(SubDetailData response) {
|
||||
return response.medias;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -38,26 +40,24 @@ class SubDetailController
|
||||
}
|
||||
|
||||
@override
|
||||
bool customHandleResponse(
|
||||
bool isRefresh, Success<SubDetailModelData> response) {
|
||||
bool customHandleResponse(bool isRefresh, Success<SubDetailData> response) {
|
||||
mediaCount.value = response.response.info!.mediaCount!;
|
||||
if (item.type == 11) {
|
||||
playCount.value = response.response.info!.cntInfo!['play'];
|
||||
playCount.value = response.response.info!.cntInfo!.play!;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<LoadingState<SubDetailModelData>> customGetData() {
|
||||
if (item.type! == 11) {
|
||||
return UserHttp.favResourceList(
|
||||
Future<LoadingState<SubDetailData>> customGetData() {
|
||||
if (item.type == 11) {
|
||||
return FavHttp.favResourceList(
|
||||
id: id,
|
||||
ps: 20,
|
||||
pn: page,
|
||||
);
|
||||
} else {
|
||||
return UserHttp.favSeasonList(
|
||||
// item.type! == 21
|
||||
return FavHttp.favSeasonList(
|
||||
id: id,
|
||||
ps: 20,
|
||||
pn: page,
|
||||
|
||||
@@ -3,8 +3,7 @@ import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
|
||||
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models/user/sub_detail.dart';
|
||||
import 'package:PiliPlus/models/user/sub_folder.dart';
|
||||
import 'package:PiliPlus/models_new/sub/sub_detail/media.dart';
|
||||
import 'package:PiliPlus/pages/subscription_detail/controller.dart';
|
||||
import 'package:PiliPlus/pages/subscription_detail/widget/sub_video_card.dart';
|
||||
import 'package:PiliPlus/utils/grid.dart';
|
||||
@@ -39,9 +38,9 @@ class _SubDetailPageState extends State<SubDetailPage> {
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
_buildAppBar(theme),
|
||||
_buildCount(theme),
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 7,
|
||||
bottom: MediaQuery.paddingOf(context).bottom + 80,
|
||||
),
|
||||
sliver: Obx(
|
||||
@@ -54,7 +53,7 @@ class _SubDetailPageState extends State<SubDetailPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBody(LoadingState<List<SubDetailMediaItem>?> loadingState) {
|
||||
Widget _buildBody(LoadingState<List<SubDetailItemModel>?> loadingState) {
|
||||
return switch (loadingState) {
|
||||
Loading() => SliverGrid(
|
||||
gridDelegate: Grid.videoCardHDelegate(context),
|
||||
@@ -88,113 +87,106 @@ class _SubDetailPageState extends State<SubDetailPage> {
|
||||
};
|
||||
}
|
||||
|
||||
Widget _buildCount(ThemeData theme) => SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 12, bottom: 8, left: 14),
|
||||
child: Obx(
|
||||
Widget _buildAppBar(ThemeData theme) {
|
||||
final style = TextStyle(
|
||||
fontSize: 12.5,
|
||||
color: theme.colorScheme.outline,
|
||||
);
|
||||
return SliverAppBar.medium(
|
||||
expandedHeight: kToolbarHeight + 132,
|
||||
pinned: true,
|
||||
title: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
_subDetailController.item.title!,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.textTheme.titleMedium,
|
||||
),
|
||||
Obx(
|
||||
() => Text(
|
||||
'共${_subDetailController.mediaCount.value}条视频',
|
||||
style: TextStyle(
|
||||
fontSize: theme.textTheme.labelMedium!.fontSize,
|
||||
color: theme.colorScheme.outline,
|
||||
letterSpacing: 1,
|
||||
style: theme.textTheme.labelMedium,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
background: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: theme.dividerColor.withValues(alpha: 0.2),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Widget _buildAppBar(ThemeData theme) => SliverAppBar.medium(
|
||||
expandedHeight: kToolbarHeight + 132,
|
||||
pinned: true,
|
||||
title: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
_subDetailController.item.title!,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.textTheme.titleMedium,
|
||||
),
|
||||
Obx(
|
||||
() => Text(
|
||||
'共${_subDetailController.mediaCount.value}条视频',
|
||||
style: theme.textTheme.labelMedium,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
background: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: theme.dividerColor.withValues(alpha: 0.2),
|
||||
padding: EdgeInsets.only(
|
||||
top: kToolbarHeight + MediaQuery.of(context).padding.top + 10,
|
||||
left: 12,
|
||||
right: 12,
|
||||
bottom: 12,
|
||||
),
|
||||
child: Row(
|
||||
spacing: 12,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Hero(
|
||||
tag: _subDetailController.heroTag,
|
||||
child: NetworkImgLayer(
|
||||
width: 176,
|
||||
height: 110,
|
||||
src: _subDetailController.item.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.only(
|
||||
top: kToolbarHeight + MediaQuery.of(context).padding.top + 10,
|
||||
left: 12,
|
||||
right: 12,
|
||||
bottom: 12,
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Hero(
|
||||
tag: _subDetailController.heroTag,
|
||||
child: NetworkImgLayer(
|
||||
width: 176,
|
||||
height: 110,
|
||||
src: _subDetailController.item.cover,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
spacing: 4,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
_subDetailController.item.title!,
|
||||
style: TextStyle(
|
||||
fontSize: theme.textTheme.titleMedium!.fontSize,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(
|
||||
'/member?mid=${_subDetailController.item.upper!.mid}',
|
||||
arguments: {
|
||||
'face': _subDetailController.item.upper!.face,
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
_subDetailController.item.upper!.name!,
|
||||
style: TextStyle(color: theme.colorScheme.primary),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Obx(
|
||||
() => _subDetailController.mediaCount.value == 0
|
||||
? const SizedBox.shrink()
|
||||
: Text(
|
||||
'共${_subDetailController.mediaCount.value}条视频',
|
||||
style: style,
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() => Text(
|
||||
'${Utils.numFormat(_subDetailController.playCount.value)}次播放',
|
||||
style: style,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
_subDetailController.item.title!,
|
||||
style: TextStyle(
|
||||
fontSize: theme.textTheme.titleMedium!.fontSize,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
SubFolderItemData item = _subDetailController.item;
|
||||
Get.toNamed(
|
||||
'/member?mid=${item.upper!.mid}',
|
||||
arguments: {
|
||||
'face': item.upper!.face,
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
_subDetailController.item.upper!.name!,
|
||||
style: TextStyle(color: theme.colorScheme.primary),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Obx(
|
||||
() => Text(
|
||||
'${Utils.numFormat(_subDetailController.playCount.value)}次播放',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,14 +6,14 @@ import 'package:PiliPlus/common/widgets/stat/stat.dart';
|
||||
import 'package:PiliPlus/http/search.dart';
|
||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||
import 'package:PiliPlus/models/common/search_type.dart';
|
||||
import 'package:PiliPlus/models/user/sub_detail.dart';
|
||||
import 'package:PiliPlus/models_new/sub/sub_detail/media.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// 收藏视频卡片 - 水平布局
|
||||
class SubVideoCardH extends StatelessWidget {
|
||||
final SubDetailMediaItem videoItem;
|
||||
final SubDetailItemModel videoItem;
|
||||
final int? searchType;
|
||||
|
||||
const SubVideoCardH({
|
||||
@@ -115,13 +115,13 @@ class SubVideoCardH extends StatelessWidget {
|
||||
StatView(
|
||||
context: context,
|
||||
theme: 'gray',
|
||||
value: Utils.numFormat(videoItem.cntInfo?['play']),
|
||||
value: Utils.numFormat(videoItem.cntInfo?.play),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
StatDanMu(
|
||||
context: context,
|
||||
theme: 'gray',
|
||||
value: Utils.numFormat(videoItem.cntInfo?['danmaku']),
|
||||
value: Utils.numFormat(videoItem.cntInfo?.danmaku),
|
||||
),
|
||||
const Spacer(),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user