fix: 收藏夹

This commit is contained in:
guozhigq
2024-10-04 11:36:17 +08:00
parent 31f87bd24c
commit f1441ac97e
4 changed files with 82 additions and 62 deletions

View File

@ -79,7 +79,21 @@ class _FavPageState extends State<FavPage> {
const SizedBox(width: 14), const SizedBox(width: 14),
], ],
), ),
body: FutureBuilder( body: RefreshIndicator(
onRefresh: () async {
_favController.hasMore.value = true;
_favController.currentPage = 1;
setState(() {
_futureBuilderFuture = _favController.queryFavFolder(type: 'init');
});
},
child: _buildBody(),
),
);
}
Widget _buildBody() {
return FutureBuilder(
future: _futureBuilderFuture, future: _futureBuilderFuture,
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) { if (snapshot.connectionState == ConnectionState.done) {
@ -109,8 +123,7 @@ class _FavPageState extends State<FavPage> {
RoutePush.loginRedirectPush(); RoutePush.loginRedirectPush();
} else { } else {
setState(() { setState(() {
_futureBuilderFuture = _futureBuilderFuture = _favController.queryFavFolder();
_favController.queryFavFolder();
}); });
} }
}, },
@ -128,7 +141,6 @@ class _FavPageState extends State<FavPage> {
); );
} }
}, },
),
); );
} }
} }

View File

@ -10,6 +10,7 @@ import 'package:pilipala/utils/utils.dart';
class FavDetailController extends GetxController { class FavDetailController extends GetxController {
FavFolderItemData? item; FavFolderItemData? item;
RxString title = ''.obs;
int? mediaId; int? mediaId;
late String heroTag; late String heroTag;
@ -24,6 +25,7 @@ class FavDetailController extends GetxController {
@override @override
void onInit() { void onInit() {
item = Get.arguments; item = Get.arguments;
title.value = item!.title!;
if (Get.parameters.keys.isNotEmpty) { if (Get.parameters.keys.isNotEmpty) {
mediaId = int.parse(Get.parameters['mediaId']!); mediaId = int.parse(Get.parameters['mediaId']!);
heroTag = Get.parameters['heroTag']!; heroTag = Get.parameters['heroTag']!;
@ -117,16 +119,18 @@ class FavDetailController extends GetxController {
} }
onEditFavFolder() async { onEditFavFolder() async {
Get.toNamed( var res = await Get.toNamed(
'/favEdit', '/favEdit',
arguments: { arguments: {
'mediaId': mediaId.toString(), 'mediaId': mediaId.toString(),
'title': item!.title, 'title': item!.title,
'intro': item!.intro, 'intro': item!.intro,
'cover': item!.cover, 'cover': item!.cover,
'privacy': item!.attr, 'privacy': [23, 1].contains(item!.attr) ? 1 : 0,
}, },
); );
title.value = res['title'];
print(title);
} }
Future toViewPlayAll() async { Future toViewPlayAll() async {

View File

@ -80,10 +80,12 @@ class _FavDetailPageState extends State<FavDetailPage> {
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Obx(
_favDetailController.item!.title!, () => Text(
_favDetailController.title.value,
style: Theme.of(context).textTheme.titleMedium, style: Theme.of(context).textTheme.titleMedium,
), ),
),
Text( Text(
'${_favDetailController.mediaCount}条视频', '${_favDetailController.mediaCount}条视频',
style: Theme.of(context).textTheme.labelMedium, style: Theme.of(context).textTheme.labelMedium,
@ -156,8 +158,9 @@ class _FavDetailPageState extends State<FavDetailPage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
const SizedBox(height: 4), const SizedBox(height: 4),
Text( Obx(
_favDetailController.item!.title!, () => Text(
_favDetailController.title.value,
style: TextStyle( style: TextStyle(
fontSize: Theme.of(context) fontSize: Theme.of(context)
.textTheme .textTheme
@ -165,6 +168,7 @@ class _FavDetailPageState extends State<FavDetailPage> {
.fontSize, .fontSize,
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
), ),
),
const SizedBox(height: 4), const SizedBox(height: 4),
Text( Text(
_favDetailController.item!.upper!.name!, _favDetailController.item!.upper!.name!,

View File

@ -56,7 +56,7 @@ class FavEditController extends GetxController {
); );
if (res['status']) { if (res['status']) {
SmartDialog.showToast('编辑成功'); SmartDialog.showToast('编辑成功');
Get.back(); Get.back(result: {'title': title});
} else { } else {
SmartDialog.showToast(res['msg']); SmartDialog.showToast(res['msg']);
} }