mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-31 07:50:12 +08:00
refa: split fav search page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -671,7 +671,7 @@ class MemberHttp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 搜索follow
|
// 搜索follow
|
||||||
static Future<LoadingState> getfollowSearch({
|
static Future<LoadingState<FollowDataModel>> getfollowSearch({
|
||||||
required int mid,
|
required int mid,
|
||||||
required int ps,
|
required int ps,
|
||||||
required int pn,
|
required int pn,
|
||||||
|
|||||||
@@ -443,7 +443,7 @@ class UserHttp {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// 搜索历史记录
|
// 搜索历史记录
|
||||||
static Future<LoadingState> searchHistory(
|
static Future<LoadingState<HistoryData>> searchHistory(
|
||||||
{required int pn, required String keyword}) async {
|
{required int pn, required String keyword}) async {
|
||||||
var res = await Request().get(
|
var res = await Request().get(
|
||||||
Api.searchHistory,
|
Api.searchHistory,
|
||||||
|
|||||||
31
lib/pages/common/common_search_controller.dart
Normal file
31
lib/pages/common/common_search_controller.dart
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
abstract class CommonSearchController<R, T> extends CommonListController<R, T> {
|
||||||
|
final editController = TextEditingController();
|
||||||
|
final focusNode = FocusNode();
|
||||||
|
|
||||||
|
void onClear() {
|
||||||
|
if (editController.text.isNotEmpty) {
|
||||||
|
editController.clear();
|
||||||
|
} else {
|
||||||
|
Get.back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future onRefresh() {
|
||||||
|
if (editController.value.text.isEmpty) {
|
||||||
|
return Future.value();
|
||||||
|
}
|
||||||
|
return super.onRefresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
editController.dispose();
|
||||||
|
focusNode.dispose();
|
||||||
|
super.onClose();
|
||||||
|
}
|
||||||
|
}
|
||||||
72
lib/pages/common/common_search_page.dart
Normal file
72
lib/pages/common/common_search_page.dart
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
import 'package:PiliPlus/common/widgets/loading_widget.dart';
|
||||||
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
|
import 'package:PiliPlus/pages/common/common_search_controller.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
abstract class CommonSearchPage extends StatefulWidget {
|
||||||
|
const CommonSearchPage({super.key});
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class CommonSearchPageState<S extends CommonSearchPage, R, T>
|
||||||
|
extends State<S> {
|
||||||
|
CommonSearchController<R, T> get controller;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
resizeToAvoidBottomInset: false,
|
||||||
|
appBar: AppBar(
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
tooltip: '搜索',
|
||||||
|
onPressed: controller.onRefresh,
|
||||||
|
icon: const Icon(Icons.search_outlined, size: 22),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10)
|
||||||
|
],
|
||||||
|
title: TextField(
|
||||||
|
autofocus: true,
|
||||||
|
focusNode: controller.focusNode,
|
||||||
|
controller: controller.editController,
|
||||||
|
textInputAction: TextInputAction.search,
|
||||||
|
textAlignVertical: TextAlignVertical.center,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: '搜索',
|
||||||
|
border: InputBorder.none,
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
tooltip: '清空',
|
||||||
|
icon: const Icon(Icons.clear, size: 22),
|
||||||
|
onPressed: () {
|
||||||
|
controller
|
||||||
|
..loadingState.value = LoadingState.loading()
|
||||||
|
..onClear()
|
||||||
|
..focusNode.requestFocus();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onSubmitted: (value) => controller.onReload(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Obx(() => _buildBody(controller.loadingState.value)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildBody(LoadingState<List<T>?> loadingState) {
|
||||||
|
return switch (loadingState) {
|
||||||
|
Loading() => errorWidget(),
|
||||||
|
Success() => loadingState.response?.isNotEmpty == true
|
||||||
|
? buildList(loadingState.response!)
|
||||||
|
: errorWidget(
|
||||||
|
callback: controller.onReload,
|
||||||
|
),
|
||||||
|
Error() => errorWidget(
|
||||||
|
errMsg: loadingState.errMsg,
|
||||||
|
callback: controller.onReload,
|
||||||
|
),
|
||||||
|
_ => throw UnimplementedError(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildList(List<T> list);
|
||||||
|
}
|
||||||
@@ -6,7 +6,6 @@ import 'package:PiliPlus/pages/fav/note/view.dart';
|
|||||||
import 'package:PiliPlus/pages/fav/pgc/view.dart';
|
import 'package:PiliPlus/pages/fav/pgc/view.dart';
|
||||||
import 'package:PiliPlus/pages/fav/video/fav_folder_sort_page.dart';
|
import 'package:PiliPlus/pages/fav/video/fav_folder_sort_page.dart';
|
||||||
import 'package:PiliPlus/pages/fav/video/index.dart';
|
import 'package:PiliPlus/pages/fav/video/index.dart';
|
||||||
import 'package:PiliPlus/pages/fav_search/view.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
@@ -117,7 +116,6 @@ class _FavPageState extends State<FavPage> with SingleTickerProviderStateMixin {
|
|||||||
'mediaId': item.id,
|
'mediaId': item.id,
|
||||||
'title': item.title,
|
'title': item.title,
|
||||||
'count': item.mediaCount,
|
'count': item.mediaCount,
|
||||||
'searchType': SearchType.fav,
|
|
||||||
'isOwner': true,
|
'isOwner': true,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import 'package:PiliPlus/http/user.dart';
|
|||||||
import 'package:PiliPlus/models/user/fav_detail.dart';
|
import 'package:PiliPlus/models/user/fav_detail.dart';
|
||||||
import 'package:PiliPlus/models/user/fav_folder.dart';
|
import 'package:PiliPlus/models/user/fav_folder.dart';
|
||||||
import 'package:PiliPlus/pages/fav_detail/fav_sort_page.dart';
|
import 'package:PiliPlus/pages/fav_detail/fav_sort_page.dart';
|
||||||
import 'package:PiliPlus/pages/fav_search/view.dart' show SearchType;
|
|
||||||
import 'package:PiliPlus/utils/extension.dart';
|
import 'package:PiliPlus/utils/extension.dart';
|
||||||
import 'package:PiliPlus/utils/page_utils.dart';
|
import 'package:PiliPlus/utils/page_utils.dart';
|
||||||
import 'package:PiliPlus/utils/request_utils.dart';
|
import 'package:PiliPlus/utils/request_utils.dart';
|
||||||
@@ -206,16 +205,11 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
|||||||
'title': _favDetailController.item.value.title,
|
'title': _favDetailController.item.value.title,
|
||||||
'count':
|
'count':
|
||||||
_favDetailController.item.value.mediaCount,
|
_favDetailController.item.value.mediaCount,
|
||||||
'searchType': SearchType.fav,
|
|
||||||
'isOwner': _favDetailController.isOwner.value,
|
'isOwner': _favDetailController.isOwner.value,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
icon: const Icon(Icons.search_outlined),
|
icon: const Icon(Icons.search_outlined),
|
||||||
),
|
),
|
||||||
// IconButton(
|
|
||||||
// onPressed: () {},
|
|
||||||
// icon: const Icon(Icons.more_vert),
|
|
||||||
// ),
|
|
||||||
Obx(
|
Obx(
|
||||||
() => _favDetailController.isOwner.value
|
() => _favDetailController.isOwner.value
|
||||||
? PopupMenuButton(
|
? PopupMenuButton(
|
||||||
|
|||||||
@@ -1,69 +1,43 @@
|
|||||||
import 'package:PiliPlus/http/loading_state.dart';
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
import 'package:PiliPlus/http/member.dart';
|
import 'package:PiliPlus/http/video.dart';
|
||||||
import 'package:PiliPlus/models/model_hot_video_item.dart';
|
import 'package:PiliPlus/models/user/fav_detail.dart';
|
||||||
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
import 'package:PiliPlus/pages/common/common_search_controller.dart';
|
||||||
import 'package:PiliPlus/pages/fav_search/view.dart' show SearchType;
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:PiliPlus/http/user.dart';
|
import 'package:PiliPlus/http/user.dart';
|
||||||
|
|
||||||
import '../../http/video.dart';
|
class FavSearchController
|
||||||
|
extends CommonSearchController<FavDetailData, FavDetailItemData> {
|
||||||
class FavSearchController extends CommonListController {
|
int type = Get.arguments['type'];
|
||||||
final controller = TextEditingController();
|
int mediaId = Get.arguments['mediaId'];
|
||||||
final searchFocusNode = FocusNode();
|
bool isOwner = Get.arguments['isOwner'];
|
||||||
|
dynamic count = Get.arguments['count'];
|
||||||
int? type;
|
dynamic title = Get.arguments['title'];
|
||||||
int? mediaId;
|
|
||||||
int? mid;
|
|
||||||
late SearchType searchType;
|
|
||||||
final bool? isOwner = Get.arguments['isOwner'];
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
Future<LoadingState<FavDetailData>> customGetData() =>
|
||||||
super.onInit();
|
UserHttp.userFavFolderDetail(
|
||||||
type = Get.arguments['type'];
|
pn: currentPage,
|
||||||
mediaId = Get.arguments['mediaId'];
|
ps: 20,
|
||||||
mid = Get.arguments['mid'];
|
mediaId: mediaId,
|
||||||
searchType = Get.arguments['searchType'];
|
keyword: editController.text,
|
||||||
}
|
type: type,
|
||||||
|
);
|
||||||
// 清空搜索
|
|
||||||
void onClear() {
|
|
||||||
if (controller.text.isNotEmpty) {
|
|
||||||
controller.clear();
|
|
||||||
} else {
|
|
||||||
Get.back();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future onRefresh() {
|
List<FavDetailItemData>? getDataList(FavDetailData response) {
|
||||||
if (controller.value.text.isEmpty) {
|
|
||||||
return Future.value();
|
|
||||||
}
|
|
||||||
return super.onRefresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
List? getDataList(response) {
|
|
||||||
if (searchType == SearchType.later) {
|
|
||||||
return response['list'];
|
|
||||||
}
|
|
||||||
return response.list;
|
return response.list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool customHandleResponse(bool isRefresh, Success response) {
|
bool customHandleResponse(bool isRefresh, Success<FavDetailData> response) {
|
||||||
if (searchType == SearchType.fav && response.response.hasMore == false) {
|
if (response.response.hasMore == false) {
|
||||||
isEnd = true;
|
isEnd = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
onCancelFav(int index, int id, int type) async {
|
onCancelFav(int index, int id, int? type) async {
|
||||||
var result = await VideoHttp.favVideo(
|
var result = await VideoHttp.favVideo(
|
||||||
aid: id,
|
aid: id,
|
||||||
addIds: '',
|
addIds: '',
|
||||||
@@ -71,69 +45,11 @@ class FavSearchController extends CommonListController {
|
|||||||
type: type,
|
type: type,
|
||||||
);
|
);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
List dataList = (loadingState.value as Success).response;
|
List<FavDetailItemData> dataList =
|
||||||
|
(loadingState.value as Success).response;
|
||||||
dataList.removeAt(index);
|
dataList.removeAt(index);
|
||||||
loadingState.refresh();
|
loadingState.refresh();
|
||||||
SmartDialog.showToast('取消收藏');
|
SmartDialog.showToast('取消收藏');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<LoadingState> customGetData() => switch (searchType) {
|
|
||||||
SearchType.fav => UserHttp.userFavFolderDetail(
|
|
||||||
pn: currentPage,
|
|
||||||
ps: 20,
|
|
||||||
mediaId: mediaId!,
|
|
||||||
keyword: controller.text,
|
|
||||||
type: type!,
|
|
||||||
),
|
|
||||||
SearchType.follow => MemberHttp.getfollowSearch(
|
|
||||||
mid: mid!,
|
|
||||||
ps: 20,
|
|
||||||
pn: currentPage,
|
|
||||||
name: controller.value.text,
|
|
||||||
),
|
|
||||||
SearchType.history => UserHttp.searchHistory(
|
|
||||||
pn: currentPage,
|
|
||||||
keyword: controller.value.text,
|
|
||||||
),
|
|
||||||
SearchType.later => UserHttp.seeYouLater(
|
|
||||||
page: currentPage,
|
|
||||||
keyword: controller.value.text,
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onClose() {
|
|
||||||
searchFocusNode.dispose();
|
|
||||||
controller.dispose();
|
|
||||||
super.onClose();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future onDelHistory(index, kid, business) async {
|
|
||||||
String resKid = 'archive_$kid';
|
|
||||||
if (business == 'live') {
|
|
||||||
resKid = 'live_$kid';
|
|
||||||
} else if (business.contains('article')) {
|
|
||||||
resKid = 'article_$kid';
|
|
||||||
}
|
|
||||||
|
|
||||||
var res = await UserHttp.delHistory([resKid]);
|
|
||||||
if (res['status']) {
|
|
||||||
List historyList = (loadingState.value as Success).response;
|
|
||||||
historyList.removeAt(index);
|
|
||||||
loadingState.refresh();
|
|
||||||
SmartDialog.showToast(res['msg']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future toViewDel(BuildContext context, int index, aid) async {
|
|
||||||
var res = await UserHttp.toViewDel(aids: [aid]);
|
|
||||||
if (res['status']) {
|
|
||||||
List<HotVideoItemModel> list = (loadingState.value as Success).response;
|
|
||||||
list.removeAt(index);
|
|
||||||
loadingState.refresh();
|
|
||||||
}
|
|
||||||
SmartDialog.showToast(res['msg']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
library fav_search;
|
|
||||||
|
|
||||||
export './controller.dart';
|
|
||||||
export './view.dart';
|
|
||||||
@@ -1,10 +1,5 @@
|
|||||||
import 'package:PiliPlus/common/constants.dart';
|
import 'package:PiliPlus/models/user/fav_detail.dart';
|
||||||
import 'package:PiliPlus/common/widgets/icon_button.dart';
|
import 'package:PiliPlus/pages/common/common_search_page.dart';
|
||||||
import 'package:PiliPlus/common/widgets/loading_widget.dart';
|
|
||||||
import 'package:PiliPlus/common/widgets/video_card_h.dart';
|
|
||||||
import 'package:PiliPlus/http/loading_state.dart';
|
|
||||||
import 'package:PiliPlus/pages/follow/widgets/follow_item.dart';
|
|
||||||
import 'package:PiliPlus/pages/history/widgets/item.dart';
|
|
||||||
import 'package:PiliPlus/utils/grid.dart';
|
import 'package:PiliPlus/utils/grid.dart';
|
||||||
import 'package:PiliPlus/utils/page_utils.dart';
|
import 'package:PiliPlus/utils/page_utils.dart';
|
||||||
import 'package:PiliPlus/utils/utils.dart';
|
import 'package:PiliPlus/utils/utils.dart';
|
||||||
@@ -14,93 +9,44 @@ import 'package:PiliPlus/pages/fav_detail/widget/fav_video_card.dart';
|
|||||||
|
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
|
|
||||||
enum SearchType { fav, follow, history, later }
|
class FavSearchPage extends CommonSearchPage {
|
||||||
|
|
||||||
class FavSearchPage extends StatefulWidget {
|
|
||||||
const FavSearchPage({super.key});
|
const FavSearchPage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<FavSearchPage> createState() => _FavSearchPageState();
|
State<FavSearchPage> createState() => _FavSearchPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _FavSearchPageState extends State<FavSearchPage> {
|
class _FavSearchPageState extends CommonSearchPageState<FavSearchPage,
|
||||||
final FavSearchController _favSearchCtr = Get.put(
|
FavDetailData, FavDetailItemData> {
|
||||||
|
@override
|
||||||
|
final FavSearchController controller = Get.put(
|
||||||
FavSearchController(),
|
FavSearchController(),
|
||||||
tag: Utils.generateRandomString(8),
|
tag: Utils.generateRandomString(8),
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget buildList(List<FavDetailItemData> list) {
|
||||||
return Scaffold(
|
return CustomScrollView(
|
||||||
resizeToAvoidBottomInset: false,
|
|
||||||
appBar: AppBar(
|
|
||||||
actions: [
|
|
||||||
IconButton(
|
|
||||||
tooltip: '搜索',
|
|
||||||
onPressed: _favSearchCtr.onRefresh,
|
|
||||||
icon: const Icon(Icons.search_outlined, size: 22),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10)
|
|
||||||
],
|
|
||||||
title: TextField(
|
|
||||||
autofocus: true,
|
|
||||||
focusNode: _favSearchCtr.searchFocusNode,
|
|
||||||
controller: _favSearchCtr.controller,
|
|
||||||
textInputAction: TextInputAction.search,
|
|
||||||
textAlignVertical: TextAlignVertical.center,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintText: '搜索',
|
|
||||||
border: InputBorder.none,
|
|
||||||
suffixIcon: IconButton(
|
|
||||||
tooltip: '清空',
|
|
||||||
icon: const Icon(Icons.clear, size: 22),
|
|
||||||
onPressed: () {
|
|
||||||
_favSearchCtr
|
|
||||||
..loadingState.value = LoadingState.loading()
|
|
||||||
..onClear()
|
|
||||||
..searchFocusNode.requestFocus();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onSubmitted: (value) => _favSearchCtr.onReload(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
body: Obx(() => _buildBody(_favSearchCtr.loadingState.value)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildBody(LoadingState<List<dynamic>?> loadingState) {
|
|
||||||
return switch (loadingState) {
|
|
||||||
Loading() => errorWidget(),
|
|
||||||
Success() => loadingState.response?.isNotEmpty == true
|
|
||||||
? switch (_favSearchCtr.searchType) {
|
|
||||||
SearchType.fav ||
|
|
||||||
SearchType.history ||
|
|
||||||
SearchType.later =>
|
|
||||||
CustomScrollView(
|
|
||||||
physics: const AlwaysScrollableScrollPhysics(),
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
controller: _favSearchCtr.scrollController,
|
controller: controller.scrollController,
|
||||||
slivers: [
|
slivers: [
|
||||||
SliverPadding(
|
SliverPadding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
bottom: MediaQuery.of(context).padding.bottom + 80,
|
bottom: MediaQuery.of(context).padding.bottom + 80,
|
||||||
),
|
),
|
||||||
sliver: SliverGrid(
|
sliver: SliverGrid(
|
||||||
gridDelegate: _favSearchCtr.searchType == SearchType.fav
|
gridDelegate: Grid.videoCardHDelegate(context, minHeight: 110),
|
||||||
? Grid.videoCardHDelegate(context, minHeight: 110)
|
|
||||||
: Grid.videoCardHDelegate(context),
|
|
||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
(context, index) {
|
(context, index) {
|
||||||
if (index == loadingState.response!.length - 1) {
|
if (index == list.length - 1) {
|
||||||
_favSearchCtr.onLoadMore();
|
controller.onLoadMore();
|
||||||
}
|
}
|
||||||
final item = loadingState.response![index];
|
final item = list[index];
|
||||||
if (_favSearchCtr.searchType == SearchType.fav) {
|
|
||||||
return FavVideoCardH(
|
return FavVideoCardH(
|
||||||
videoItem: item,
|
videoItem: item,
|
||||||
onDelFav: _favSearchCtr.isOwner == true
|
onDelFav: controller.isOwner == true
|
||||||
? () {
|
? () {
|
||||||
_favSearchCtr.onCancelFav(
|
controller.onCancelFav(
|
||||||
index,
|
index,
|
||||||
item.id!,
|
item.id!,
|
||||||
item.type,
|
item.type,
|
||||||
@@ -114,169 +60,21 @@ class _FavSearchPageState extends State<FavSearchPage> {
|
|||||||
'videoItem': item,
|
'videoItem': item,
|
||||||
'heroTag': Utils.makeHeroTag(item.bvid),
|
'heroTag': Utils.makeHeroTag(item.bvid),
|
||||||
'sourceType': 'fav',
|
'sourceType': 'fav',
|
||||||
'mediaId': Get.arguments['mediaId'],
|
'mediaId': controller.mediaId,
|
||||||
'oid': item.id,
|
'oid': item.id,
|
||||||
'favTitle': Get.arguments['title'],
|
'favTitle': controller.title,
|
||||||
'count': Get.arguments['count'],
|
'count': controller.count,
|
||||||
'desc': true,
|
'desc': true,
|
||||||
'isContinuePlaying': true,
|
'isContinuePlaying': true,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
if (_favSearchCtr.searchType ==
|
|
||||||
SearchType.history) {
|
|
||||||
return HistoryItem(
|
|
||||||
videoItem: item,
|
|
||||||
ctr: _favSearchCtr,
|
|
||||||
onChoose: null,
|
|
||||||
onDelete: (kid, business) {
|
|
||||||
_favSearchCtr.onDelHistory(
|
|
||||||
index, kid, business);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Stack(
|
|
||||||
children: [
|
|
||||||
VideoCardH(
|
|
||||||
videoItem: item,
|
|
||||||
source: 'later',
|
|
||||||
onViewLater: (cid) {
|
|
||||||
PageUtils.toVideoPage(
|
|
||||||
'bvid=${item.bvid}&cid=$cid',
|
|
||||||
arguments: {
|
|
||||||
'videoItem': item,
|
|
||||||
'oid': item.aid,
|
|
||||||
'heroTag': Utils.makeHeroTag(item.bvid),
|
|
||||||
'sourceType': 'watchLater',
|
|
||||||
'count': Get.arguments['count'],
|
|
||||||
'favTitle': '稍后再看',
|
|
||||||
'mediaId': _favSearchCtr.mid,
|
|
||||||
'desc': false,
|
|
||||||
'isContinuePlaying': index != 0,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Positioned(
|
|
||||||
top: 5,
|
|
||||||
left: 12,
|
|
||||||
bottom: 5,
|
|
||||||
child: IgnorePointer(
|
|
||||||
child: LayoutBuilder(
|
|
||||||
builder: (context, constraints) =>
|
|
||||||
AnimatedOpacity(
|
|
||||||
opacity: item.checked == true ? 1 : 0,
|
|
||||||
duration:
|
|
||||||
const Duration(milliseconds: 200),
|
|
||||||
child: Container(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
height: constraints.maxHeight,
|
|
||||||
width: constraints.maxHeight *
|
|
||||||
StyleString.aspectRatio,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius:
|
|
||||||
BorderRadius.circular(10),
|
|
||||||
color:
|
|
||||||
Colors.black.withOpacity(0.6),
|
|
||||||
),
|
|
||||||
child: SizedBox(
|
|
||||||
width: 34,
|
|
||||||
height: 34,
|
|
||||||
child: AnimatedScale(
|
|
||||||
scale:
|
|
||||||
item.checked == true ? 1 : 0,
|
|
||||||
duration: const Duration(
|
|
||||||
milliseconds: 250),
|
|
||||||
curve: Curves.easeInOut,
|
|
||||||
child: IconButton(
|
|
||||||
tooltip: '取消选择',
|
|
||||||
style: ButtonStyle(
|
|
||||||
padding:
|
|
||||||
WidgetStateProperty.all(
|
|
||||||
EdgeInsets.zero),
|
|
||||||
backgroundColor:
|
|
||||||
WidgetStateProperty
|
|
||||||
.resolveWith(
|
|
||||||
(states) {
|
|
||||||
return Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.surface
|
|
||||||
.withOpacity(0.8);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onPressed: null,
|
|
||||||
icon: Icon(
|
|
||||||
Icons.done_all_outlined,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.primary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
right: 12,
|
|
||||||
bottom: 0,
|
|
||||||
child: iconButton(
|
|
||||||
tooltip: '移除',
|
|
||||||
context: context,
|
|
||||||
onPressed: () {
|
|
||||||
_favSearchCtr.toViewDel(
|
|
||||||
context,
|
|
||||||
index,
|
|
||||||
item.aid,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
icon: Icons.clear,
|
|
||||||
iconColor: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.onSurfaceVariant,
|
|
||||||
bgColor: Colors.transparent,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
|
||||||
childCount: loadingState.response!.length,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SearchType.follow => ListView.builder(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
bottom: MediaQuery.of(context).padding.bottom + 80,
|
|
||||||
),
|
|
||||||
controller: _favSearchCtr.scrollController,
|
|
||||||
itemCount: loadingState.response!.length,
|
|
||||||
itemBuilder: ((context, index) {
|
|
||||||
if (index == loadingState.response!.length - 1) {
|
|
||||||
_favSearchCtr.onLoadMore();
|
|
||||||
}
|
|
||||||
return FollowItem(
|
|
||||||
item: loadingState.response![index],
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
}
|
|
||||||
: errorWidget(
|
|
||||||
callback: _favSearchCtr.onReload,
|
|
||||||
),
|
|
||||||
Error() => errorWidget(
|
|
||||||
errMsg: loadingState.errMsg,
|
|
||||||
callback: _favSearchCtr.onReload,
|
|
||||||
),
|
|
||||||
LoadingState() => throw UnimplementedError(),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:PiliPlus/pages/fav_search/view.dart' show SearchType;
|
|
||||||
import 'package:PiliPlus/utils/utils.dart';
|
import 'package:PiliPlus/utils/utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@@ -38,10 +37,9 @@ class _FollowPageState extends State<FollowPage> {
|
|||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () => Get.toNamed(
|
onPressed: () => Get.toNamed(
|
||||||
'/favSearch',
|
'/followSearch',
|
||||||
arguments: {
|
arguments: {
|
||||||
'mid': int.parse(mid),
|
'mid': int.parse(mid),
|
||||||
'searchType': SearchType.follow,
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
icon: const Icon(Icons.search_outlined),
|
icon: const Icon(Icons.search_outlined),
|
||||||
|
|||||||
24
lib/pages/follow_search/controller.dart
Normal file
24
lib/pages/follow_search/controller.dart
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
|
import 'package:PiliPlus/http/member.dart';
|
||||||
|
import 'package:PiliPlus/models/follow/result.dart';
|
||||||
|
import 'package:PiliPlus/pages/common/common_search_controller.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class FollowSearchController
|
||||||
|
extends CommonSearchController<FollowDataModel, FollowItemModel> {
|
||||||
|
dynamic mid = Get.arguments['mid'];
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<LoadingState<FollowDataModel>> customGetData() =>
|
||||||
|
MemberHttp.getfollowSearch(
|
||||||
|
mid: mid,
|
||||||
|
ps: 20,
|
||||||
|
pn: currentPage,
|
||||||
|
name: editController.value.text,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<FollowItemModel>? getDataList(FollowDataModel response) {
|
||||||
|
return response.list;
|
||||||
|
}
|
||||||
|
}
|
||||||
41
lib/pages/follow_search/view.dart
Normal file
41
lib/pages/follow_search/view.dart
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import 'package:PiliPlus/models/follow/result.dart';
|
||||||
|
import 'package:PiliPlus/pages/common/common_search_page.dart';
|
||||||
|
import 'package:PiliPlus/pages/follow/widgets/follow_item.dart';
|
||||||
|
import 'package:PiliPlus/utils/utils.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import 'controller.dart';
|
||||||
|
|
||||||
|
class FollowSearchPage extends CommonSearchPage {
|
||||||
|
const FollowSearchPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<FollowSearchPage> createState() => _FollowSearchPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FollowSearchPageState extends CommonSearchPageState<FollowSearchPage,
|
||||||
|
FollowDataModel, FollowItemModel> {
|
||||||
|
@override
|
||||||
|
final FollowSearchController controller = Get.put(
|
||||||
|
FollowSearchController(),
|
||||||
|
tag: Utils.generateRandomString(8),
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget buildList(List<FollowItemModel> list) {
|
||||||
|
return ListView.builder(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
bottom: MediaQuery.of(context).padding.bottom + 80,
|
||||||
|
),
|
||||||
|
controller: controller.scrollController,
|
||||||
|
itemCount: list.length,
|
||||||
|
itemBuilder: ((context, index) {
|
||||||
|
if (index == list.length - 1) {
|
||||||
|
controller.onLoadMore();
|
||||||
|
}
|
||||||
|
return FollowItem(item: list[index]);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,6 @@ import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
|||||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
||||||
import 'package:PiliPlus/http/loading_state.dart';
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
import 'package:PiliPlus/models/user/history.dart';
|
import 'package:PiliPlus/models/user/history.dart';
|
||||||
import 'package:PiliPlus/pages/fav_search/view.dart' show SearchType;
|
|
||||||
import 'package:PiliPlus/pages/history/base_controller.dart';
|
import 'package:PiliPlus/pages/history/base_controller.dart';
|
||||||
import 'package:PiliPlus/utils/extension.dart';
|
import 'package:PiliPlus/utils/extension.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -77,12 +76,7 @@ class _HistoryPageState extends State<HistoryPage>
|
|||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
IconButton(
|
||||||
tooltip: '搜索',
|
tooltip: '搜索',
|
||||||
onPressed: () => Get.toNamed(
|
onPressed: () => Get.toNamed('/historySearch'),
|
||||||
'/favSearch',
|
|
||||||
arguments: {
|
|
||||||
'searchType': SearchType.history,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
icon: const Icon(Icons.search_outlined),
|
icon: const Icon(Icons.search_outlined),
|
||||||
),
|
),
|
||||||
PopupMenuButton<String>(
|
PopupMenuButton<String>(
|
||||||
|
|||||||
36
lib/pages/history_search/controller.dart
Normal file
36
lib/pages/history_search/controller.dart
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
|
import 'package:PiliPlus/models/user/history.dart';
|
||||||
|
import 'package:PiliPlus/pages/common/common_search_controller.dart';
|
||||||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
|
import 'package:PiliPlus/http/user.dart';
|
||||||
|
|
||||||
|
class HistorySearchController
|
||||||
|
extends CommonSearchController<HistoryData, HisListItem> {
|
||||||
|
@override
|
||||||
|
Future<LoadingState<HistoryData>> customGetData() => UserHttp.searchHistory(
|
||||||
|
pn: currentPage,
|
||||||
|
keyword: editController.value.text,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<HisListItem>? getDataList(HistoryData response) {
|
||||||
|
return response.list;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future onDelHistory(index, kid, business) async {
|
||||||
|
String resKid = 'archive_$kid';
|
||||||
|
if (business == 'live') {
|
||||||
|
resKid = 'live_$kid';
|
||||||
|
} else if (business.contains('article')) {
|
||||||
|
resKid = 'article_$kid';
|
||||||
|
}
|
||||||
|
|
||||||
|
var res = await UserHttp.delHistory([resKid]);
|
||||||
|
if (res['status']) {
|
||||||
|
List historyList = (loadingState.value as Success).response;
|
||||||
|
historyList.removeAt(index);
|
||||||
|
loadingState.refresh();
|
||||||
|
SmartDialog.showToast(res['msg']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
59
lib/pages/history_search/view.dart
Normal file
59
lib/pages/history_search/view.dart
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
import 'package:PiliPlus/models/user/history.dart';
|
||||||
|
import 'package:PiliPlus/pages/common/common_search_page.dart';
|
||||||
|
import 'package:PiliPlus/pages/history/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';
|
||||||
|
|
||||||
|
import 'controller.dart';
|
||||||
|
|
||||||
|
class HistorySearchPage extends CommonSearchPage {
|
||||||
|
const HistorySearchPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<HistorySearchPage> createState() => _HistorySearchPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _HistorySearchPageState
|
||||||
|
extends CommonSearchPageState<HistorySearchPage, HistoryData, HisListItem> {
|
||||||
|
@override
|
||||||
|
final HistorySearchController controller = Get.put(
|
||||||
|
HistorySearchController(),
|
||||||
|
tag: Utils.generateRandomString(8),
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget buildList(List<HisListItem> list) {
|
||||||
|
return CustomScrollView(
|
||||||
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
|
controller: controller.scrollController,
|
||||||
|
slivers: [
|
||||||
|
SliverPadding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
bottom: MediaQuery.of(context).padding.bottom + 80,
|
||||||
|
),
|
||||||
|
sliver: SliverGrid(
|
||||||
|
gridDelegate: Grid.videoCardHDelegate(context, minHeight: 110),
|
||||||
|
delegate: SliverChildBuilderDelegate(
|
||||||
|
(context, index) {
|
||||||
|
if (index == list.length - 1) {
|
||||||
|
controller.onLoadMore();
|
||||||
|
}
|
||||||
|
final item = list[index];
|
||||||
|
return HistoryItem(
|
||||||
|
videoItem: item,
|
||||||
|
ctr: controller,
|
||||||
|
onChoose: null,
|
||||||
|
onDelete: (kid, business) {
|
||||||
|
controller.onDelHistory(index, kid, business);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
||||||
import 'package:PiliPlus/http/loading_state.dart';
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
import 'package:PiliPlus/models/model_hot_video_item.dart';
|
import 'package:PiliPlus/models/model_hot_video_item.dart';
|
||||||
import 'package:PiliPlus/pages/fav_search/view.dart';
|
|
||||||
import 'package:PiliPlus/pages/history/view.dart' show AppBarWidget;
|
import 'package:PiliPlus/pages/history/view.dart' show AppBarWidget;
|
||||||
import 'package:PiliPlus/pages/later/base_controller.dart';
|
import 'package:PiliPlus/pages/later/base_controller.dart';
|
||||||
import 'package:PiliPlus/pages/later/child_view.dart';
|
import 'package:PiliPlus/pages/later/child_view.dart';
|
||||||
@@ -138,14 +137,13 @@ class _LaterPageState extends State<LaterPage>
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
final mid = Accounts.main.mid;
|
final mid = Accounts.main.mid;
|
||||||
Get.toNamed(
|
Get.toNamed(
|
||||||
'/favSearch',
|
'/laterSearch',
|
||||||
arguments: {
|
arguments: {
|
||||||
'type': 0,
|
'type': 0,
|
||||||
'mediaId': mid,
|
'mediaId': mid,
|
||||||
'mid': mid,
|
'mid': mid,
|
||||||
'title': '稍后再看',
|
'title': '稍后再看',
|
||||||
'count': _baseCtr.counts[LaterViewType.all],
|
'count': _baseCtr.counts[LaterViewType.all],
|
||||||
'searchType': SearchType.later,
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
34
lib/pages/later_search/controller.dart
Normal file
34
lib/pages/later_search/controller.dart
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
|
import 'package:PiliPlus/models/model_hot_video_item.dart';
|
||||||
|
import 'package:PiliPlus/pages/common/common_search_controller.dart';
|
||||||
|
import 'package:PiliPlus/http/user.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class LaterSearchController
|
||||||
|
extends CommonSearchController<Map, HotVideoItemModel> {
|
||||||
|
dynamic mid = Get.arguments['mid'];
|
||||||
|
dynamic count = Get.arguments['count'];
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<LoadingState<Map>> customGetData() => UserHttp.seeYouLater(
|
||||||
|
page: currentPage,
|
||||||
|
keyword: editController.value.text,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<HotVideoItemModel>? getDataList(Map response) {
|
||||||
|
return response['list'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Future toViewDel(BuildContext context, int index, aid) async {
|
||||||
|
var res = await UserHttp.toViewDel(aids: [aid]);
|
||||||
|
if (res['status']) {
|
||||||
|
List<HotVideoItemModel> list = (loadingState.value as Success).response;
|
||||||
|
list.removeAt(index);
|
||||||
|
loadingState.refresh();
|
||||||
|
}
|
||||||
|
SmartDialog.showToast(res['msg']);
|
||||||
|
}
|
||||||
|
}
|
||||||
151
lib/pages/later_search/view.dart
Normal file
151
lib/pages/later_search/view.dart
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
import 'package:PiliPlus/common/constants.dart';
|
||||||
|
import 'package:PiliPlus/common/widgets/icon_button.dart';
|
||||||
|
import 'package:PiliPlus/common/widgets/video_card_h.dart';
|
||||||
|
import 'package:PiliPlus/models/model_hot_video_item.dart';
|
||||||
|
import 'package:PiliPlus/pages/common/common_search_page.dart';
|
||||||
|
import 'package:PiliPlus/utils/grid.dart';
|
||||||
|
import 'package:PiliPlus/utils/page_utils.dart';
|
||||||
|
import 'package:PiliPlus/utils/utils.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import 'controller.dart';
|
||||||
|
|
||||||
|
class LaterSearchPage extends CommonSearchPage {
|
||||||
|
const LaterSearchPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<LaterSearchPage> createState() => _LaterSearchPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LaterSearchPageState
|
||||||
|
extends CommonSearchPageState<LaterSearchPage, Map, HotVideoItemModel> {
|
||||||
|
@override
|
||||||
|
final LaterSearchController controller = Get.put(
|
||||||
|
LaterSearchController(),
|
||||||
|
tag: Utils.generateRandomString(8),
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget buildList(List<HotVideoItemModel> list) {
|
||||||
|
return CustomScrollView(
|
||||||
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
|
controller: controller.scrollController,
|
||||||
|
slivers: [
|
||||||
|
SliverPadding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
bottom: MediaQuery.of(context).padding.bottom + 80,
|
||||||
|
),
|
||||||
|
sliver: SliverGrid(
|
||||||
|
gridDelegate: Grid.videoCardHDelegate(context, minHeight: 110),
|
||||||
|
delegate: SliverChildBuilderDelegate(
|
||||||
|
(context, index) {
|
||||||
|
if (index == list.length - 1) {
|
||||||
|
controller.onLoadMore();
|
||||||
|
}
|
||||||
|
final item = list[index];
|
||||||
|
return Stack(
|
||||||
|
children: [
|
||||||
|
VideoCardH(
|
||||||
|
videoItem: item,
|
||||||
|
source: 'later',
|
||||||
|
onViewLater: (cid) {
|
||||||
|
PageUtils.toVideoPage(
|
||||||
|
'bvid=${item.bvid}&cid=$cid',
|
||||||
|
arguments: {
|
||||||
|
'videoItem': item,
|
||||||
|
'oid': item.aid,
|
||||||
|
'heroTag': Utils.makeHeroTag(item.bvid),
|
||||||
|
'sourceType': 'watchLater',
|
||||||
|
'count': controller.count,
|
||||||
|
'favTitle': '稍后再看',
|
||||||
|
'mediaId': controller.mid,
|
||||||
|
'desc': false,
|
||||||
|
'isContinuePlaying': index != 0,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
top: 5,
|
||||||
|
left: 12,
|
||||||
|
bottom: 5,
|
||||||
|
child: IgnorePointer(
|
||||||
|
child: LayoutBuilder(
|
||||||
|
builder: (context, constraints) => AnimatedOpacity(
|
||||||
|
opacity: item.checked == true ? 1 : 0,
|
||||||
|
duration: const Duration(milliseconds: 200),
|
||||||
|
child: Container(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
height: constraints.maxHeight,
|
||||||
|
width: constraints.maxHeight *
|
||||||
|
StyleString.aspectRatio,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
color: Colors.black.withOpacity(0.6),
|
||||||
|
),
|
||||||
|
child: SizedBox(
|
||||||
|
width: 34,
|
||||||
|
height: 34,
|
||||||
|
child: AnimatedScale(
|
||||||
|
scale: item.checked == true ? 1 : 0,
|
||||||
|
duration: const Duration(milliseconds: 250),
|
||||||
|
curve: Curves.easeInOut,
|
||||||
|
child: IconButton(
|
||||||
|
tooltip: '取消选择',
|
||||||
|
style: ButtonStyle(
|
||||||
|
padding: WidgetStateProperty.all(
|
||||||
|
EdgeInsets.zero),
|
||||||
|
backgroundColor:
|
||||||
|
WidgetStateProperty.resolveWith(
|
||||||
|
(states) {
|
||||||
|
return Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.surface
|
||||||
|
.withOpacity(0.8);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: null,
|
||||||
|
icon: Icon(
|
||||||
|
Icons.done_all_outlined,
|
||||||
|
color:
|
||||||
|
Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
right: 12,
|
||||||
|
bottom: 0,
|
||||||
|
child: iconButton(
|
||||||
|
tooltip: '移除',
|
||||||
|
context: context,
|
||||||
|
onPressed: () {
|
||||||
|
controller.toViewDel(
|
||||||
|
context,
|
||||||
|
index,
|
||||||
|
item.aid,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: Icons.clear,
|
||||||
|
iconColor:
|
||||||
|
Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
|
bgColor: Colors.transparent,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
import 'package:PiliPlus/pages/fav/view.dart';
|
import 'package:PiliPlus/pages/fav/view.dart';
|
||||||
|
import 'package:PiliPlus/pages/fav_search/view.dart';
|
||||||
|
import 'package:PiliPlus/pages/follow_search/view.dart';
|
||||||
|
import 'package:PiliPlus/pages/history_search/view.dart';
|
||||||
|
import 'package:PiliPlus/pages/later_search/view.dart';
|
||||||
import 'package:PiliPlus/pages/member/member_page.dart';
|
import 'package:PiliPlus/pages/member/member_page.dart';
|
||||||
import 'package:PiliPlus/pages/member/widget/edit_profile_page.dart';
|
import 'package:PiliPlus/pages/member/widget/edit_profile_page.dart';
|
||||||
import 'package:PiliPlus/pages/search_trending/view.dart';
|
import 'package:PiliPlus/pages/search_trending/view.dart';
|
||||||
@@ -25,7 +29,6 @@ import '../pages/dynamics/detail/index.dart';
|
|||||||
import '../pages/dynamics/index.dart';
|
import '../pages/dynamics/index.dart';
|
||||||
import '../pages/fan/index.dart';
|
import '../pages/fan/index.dart';
|
||||||
import '../pages/fav_detail/index.dart';
|
import '../pages/fav_detail/index.dart';
|
||||||
import '../pages/fav_search/index.dart';
|
|
||||||
import '../pages/follow/index.dart';
|
import '../pages/follow/index.dart';
|
||||||
import '../pages/history/index.dart';
|
import '../pages/history/index.dart';
|
||||||
import '../pages/home/index.dart';
|
import '../pages/home/index.dart';
|
||||||
@@ -132,6 +135,10 @@ class Routes {
|
|||||||
CustomGetPage(name: '/playSpeedSet', page: () => const PlaySpeedPage()),
|
CustomGetPage(name: '/playSpeedSet', page: () => const PlaySpeedPage()),
|
||||||
// 收藏搜索
|
// 收藏搜索
|
||||||
CustomGetPage(name: '/favSearch', page: () => const FavSearchPage()),
|
CustomGetPage(name: '/favSearch', page: () => const FavSearchPage()),
|
||||||
|
CustomGetPage(
|
||||||
|
name: '/historySearch', page: () => const HistorySearchPage()),
|
||||||
|
CustomGetPage(name: '/laterSearch', page: () => const LaterSearchPage()),
|
||||||
|
CustomGetPage(name: '/followSearch', page: () => const FollowSearchPage()),
|
||||||
// 消息页面
|
// 消息页面
|
||||||
CustomGetPage(name: '/whisper', page: () => const WhisperPage()),
|
CustomGetPage(name: '/whisper', page: () => const WhisperPage()),
|
||||||
// 私信详情
|
// 私信详情
|
||||||
|
|||||||
Reference in New Issue
Block a user