mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-17 06:33:59 +08:00
@@ -57,7 +57,7 @@ class _FavTopicPageState extends State<FavTopicPage>
|
||||
mainAxisSpacing: 12,
|
||||
crossAxisSpacing: 12,
|
||||
maxCrossAxisExtent: Grid.smallCardWidth,
|
||||
mainAxisExtent: MediaQuery.textScalerOf(context).scale(30),
|
||||
mainAxisExtent: 30,
|
||||
);
|
||||
|
||||
Widget _buildBody(
|
||||
|
||||
@@ -5,7 +5,6 @@ import 'package:PiliPlus/models_new/fav/fav_folder/list.dart';
|
||||
import 'package:PiliPlus/pages/fav/video/controller.dart';
|
||||
import 'package:PiliPlus/pages/fav/video/widgets/item.dart';
|
||||
import 'package:PiliPlus/utils/grid.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@@ -58,16 +57,13 @@ class _FavVideoPageState extends State<FavVideoPage>
|
||||
_favController.onLoadMore();
|
||||
}
|
||||
final item = response[index];
|
||||
String heroTag = Utils.makeHeroTag(item.fid);
|
||||
return FavVideoItem(
|
||||
heroTag: heroTag,
|
||||
item: item,
|
||||
onTap: () async {
|
||||
final res = await Get.toNamed(
|
||||
'/favDetail',
|
||||
arguments: item,
|
||||
parameters: {
|
||||
'heroTag': heroTag,
|
||||
'mediaId': item.id.toString(),
|
||||
},
|
||||
);
|
||||
|
||||
@@ -7,7 +7,6 @@ import 'package:PiliPlus/utils/bili_utils.dart';
|
||||
import 'package:flutter/material.dart' hide LayoutBuilder;
|
||||
|
||||
class FavVideoItem extends StatelessWidget {
|
||||
final String heroTag;
|
||||
final FavFolderInfo item;
|
||||
final VoidCallback? onTap;
|
||||
final VoidCallback? onLongPress;
|
||||
@@ -16,14 +15,13 @@ class FavVideoItem extends StatelessWidget {
|
||||
super.key,
|
||||
this.onTap,
|
||||
this.onLongPress,
|
||||
required this.heroTag,
|
||||
required this.item,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Material(
|
||||
type: MaterialType.transparency,
|
||||
type: .transparency,
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
onLongPress:
|
||||
@@ -43,13 +41,10 @@ class FavVideoItem extends StatelessWidget {
|
||||
aspectRatio: Style.aspectRatio,
|
||||
child: LayoutBuilder(
|
||||
builder: (context, boxConstraints) {
|
||||
return Hero(
|
||||
tag: heroTag,
|
||||
child: NetworkImgLayer(
|
||||
src: item.cover,
|
||||
width: boxConstraints.maxWidth,
|
||||
height: boxConstraints.maxHeight,
|
||||
),
|
||||
return NetworkImgLayer(
|
||||
src: item.cover,
|
||||
width: boxConstraints.maxWidth,
|
||||
height: boxConstraints.maxHeight,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:PiliPlus/common/widgets/scaffold.dart';
|
||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
||||
import 'package:PiliPlus/common/widgets/view_safe_area.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
@@ -52,111 +51,122 @@ class _FavPageState extends State<FavPage> with SingleTickerProviderStateMixin {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('我的收藏'),
|
||||
actions: [
|
||||
Obx(
|
||||
() => _showVideoFavMenu.value
|
||||
? IconButton(
|
||||
onPressed: () => Get.toNamed('/createFav')?.then(
|
||||
(data) {
|
||||
if (data != null) {
|
||||
final list =
|
||||
_favController.loadingState.value.dataOrNull;
|
||||
if (list != null && list.isNotEmpty) {
|
||||
list.insert(1, data);
|
||||
_favController.loadingState.refresh();
|
||||
} else {
|
||||
_favController.loadingState.value = Success([data]);
|
||||
return Material(
|
||||
child: Column(
|
||||
children: [
|
||||
AppBar(
|
||||
title: const Text('我的收藏'),
|
||||
actions: [
|
||||
Obx(
|
||||
() => _showVideoFavMenu.value
|
||||
? IconButton(
|
||||
onPressed: () => Get.toNamed('/createFav')?.then(
|
||||
(data) {
|
||||
if (data != null) {
|
||||
final list =
|
||||
_favController.loadingState.value.dataOrNull;
|
||||
if (list != null && list.isNotEmpty) {
|
||||
list.insert(1, data);
|
||||
_favController.loadingState.refresh();
|
||||
} else {
|
||||
_favController.loadingState.value = Success([
|
||||
data,
|
||||
]);
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
icon: const Icon(Icons.add),
|
||||
tooltip: '新建收藏夹',
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
Obx(
|
||||
() => _showVideoFavMenu.value
|
||||
? IconButton(
|
||||
onPressed: () {
|
||||
if (_favController.loadingState.value.isSuccess) {
|
||||
if (!_favController.isEnd) {
|
||||
SmartDialog.showToast('加载全部收藏夹再排序');
|
||||
return;
|
||||
}
|
||||
Get.to(
|
||||
FavFolderSortPage(favController: _favController),
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
icon: const Icon(Icons.add),
|
||||
tooltip: '新建收藏夹',
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
},
|
||||
icon: const Icon(Icons.sort),
|
||||
tooltip: '收藏夹排序',
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
Obx(
|
||||
() => _showVideoFavMenu.value
|
||||
? IconButton(
|
||||
onPressed: () {
|
||||
if (_favController.loadingState.value case Success(
|
||||
:final response,
|
||||
)) {
|
||||
try {
|
||||
final item = response!.first;
|
||||
Get.toNamed(
|
||||
'/favSearch',
|
||||
arguments: {
|
||||
'type': 1,
|
||||
'mediaId': item.id,
|
||||
'title': item.title,
|
||||
'count': item.mediaCount,
|
||||
'isOwner': true,
|
||||
},
|
||||
);
|
||||
} catch (_) {}
|
||||
}
|
||||
},
|
||||
icon: const Icon(Icons.search_outlined),
|
||||
tooltip: '搜索',
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
],
|
||||
),
|
||||
Obx(
|
||||
() => _showVideoFavMenu.value
|
||||
? IconButton(
|
||||
onPressed: () {
|
||||
if (_favController.loadingState.value.isSuccess) {
|
||||
if (!_favController.isEnd) {
|
||||
SmartDialog.showToast('加载全部收藏夹再排序');
|
||||
return;
|
||||
}
|
||||
Get.to(
|
||||
FavFolderSortPage(favController: _favController),
|
||||
);
|
||||
}
|
||||
},
|
||||
icon: const Icon(Icons.sort),
|
||||
tooltip: '收藏夹排序',
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
Obx(
|
||||
() => _showVideoFavMenu.value
|
||||
? IconButton(
|
||||
onPressed: () {
|
||||
if (_favController.loadingState.value case Success(
|
||||
:final response,
|
||||
)) {
|
||||
try {
|
||||
final item = response!.first;
|
||||
Get.toNamed(
|
||||
'/favSearch',
|
||||
arguments: {
|
||||
'type': 1,
|
||||
'mediaId': item.id,
|
||||
'title': item.title,
|
||||
'count': item.mediaCount,
|
||||
'isOwner': true,
|
||||
},
|
||||
);
|
||||
} catch (_) {}
|
||||
}
|
||||
},
|
||||
icon: const Icon(Icons.search_outlined),
|
||||
tooltip: '搜索',
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
],
|
||||
bottom: TabBar(
|
||||
controller: _tabController,
|
||||
isScrollable: true,
|
||||
tabAlignment: TabAlignment.start,
|
||||
tabs: FavTabType.values.map((item) => Tab(text: item.title)).toList(),
|
||||
onTap: (index) {
|
||||
try {
|
||||
if (!_tabController.indexIsChanging) {
|
||||
switch (FavTabType.values[index]) {
|
||||
case FavTabType.video:
|
||||
_favController.scrollController.animToTop();
|
||||
case FavTabType.article:
|
||||
Get.find<FavArticleController>().scrollController
|
||||
.animToTop();
|
||||
case FavTabType.topic:
|
||||
Get.find<FavTopicController>().scrollController.animToTop();
|
||||
case FavTabType.cheese:
|
||||
Get.find<FavCheeseController>().scrollController
|
||||
.animToTop();
|
||||
default:
|
||||
TabBar(
|
||||
controller: _tabController,
|
||||
isScrollable: true,
|
||||
tabAlignment: TabAlignment.start,
|
||||
tabs: FavTabType.values
|
||||
.map((item) => Tab(text: item.title))
|
||||
.toList(),
|
||||
onTap: (index) {
|
||||
try {
|
||||
if (!_tabController.indexIsChanging) {
|
||||
switch (FavTabType.values[index]) {
|
||||
case FavTabType.video:
|
||||
_favController.scrollController.animToTop();
|
||||
case FavTabType.article:
|
||||
Get.find<FavArticleController>().scrollController
|
||||
.animToTop();
|
||||
case FavTabType.topic:
|
||||
Get.find<FavTopicController>().scrollController
|
||||
.animToTop();
|
||||
case FavTabType.cheese:
|
||||
Get.find<FavCheeseController>().scrollController
|
||||
.animToTop();
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (_) {}
|
||||
},
|
||||
),
|
||||
),
|
||||
body: ViewSafeArea(
|
||||
child: tabBarView(
|
||||
controller: _tabController,
|
||||
children: FavTabType.values.map((item) => item.page).toList(),
|
||||
),
|
||||
} catch (_) {}
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: ViewSafeArea(
|
||||
child: tabBarView(
|
||||
controller: _tabController,
|
||||
children: FavTabType.values.map((item) => item.page).toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user