mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-08 19:17:49 +08:00
@@ -6,7 +6,7 @@ import 'package:PiliPlus/pages/search_panel/controller.dart';
|
||||
import 'package:PiliPlus/utils/app_scheme.dart';
|
||||
|
||||
class SearchAllController
|
||||
extends SearchPanelController<SearchAllModel, dynamic> {
|
||||
extends SearchPanelController<SearchAllData, dynamic> {
|
||||
SearchAllController({
|
||||
required super.keyword,
|
||||
required super.searchType,
|
||||
@@ -38,7 +38,7 @@ class SearchAllController
|
||||
}
|
||||
|
||||
@override
|
||||
Future<LoadingState<SearchAllModel>> customGetData() => SearchHttp.searchAll(
|
||||
Future<LoadingState<SearchAllData>> customGetData() => SearchHttp.searchAll(
|
||||
keyword: keyword,
|
||||
page: page,
|
||||
order: order.value,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'package:PiliPlus/common/constants.dart';
|
||||
import 'package:PiliPlus/common/widgets/video_card/video_card_h.dart';
|
||||
import 'package:PiliPlus/models/search/result.dart';
|
||||
import 'package:PiliPlus/pages/bangumi/widgets/bangumi_card_v_search.dart';
|
||||
import 'package:PiliPlus/pages/search_panel/all/controller.dart';
|
||||
import 'package:PiliPlus/pages/search_panel/all/widgets/pgc_card_v_search.dart';
|
||||
import 'package:PiliPlus/pages/search_panel/pgc/widgets/item.dart';
|
||||
import 'package:PiliPlus/pages/search_panel/user/widgets/item.dart';
|
||||
import 'package:PiliPlus/pages/search_panel/view.dart';
|
||||
@@ -24,7 +24,7 @@ class SearchAllPanel extends CommonSearchPanel {
|
||||
}
|
||||
|
||||
class _SearchAllPanelState
|
||||
extends CommonSearchPanelState<SearchAllPanel, SearchAllModel, dynamic> {
|
||||
extends CommonSearchPanelState<SearchAllPanel, SearchAllData, dynamic> {
|
||||
@override
|
||||
late final SearchAllController controller = Get.put(
|
||||
SearchAllController(
|
||||
@@ -58,7 +58,7 @@ class _SearchAllPanelState
|
||||
showPubdate: true,
|
||||
),
|
||||
),
|
||||
List<SearchMBangumiItemModel>() => item.length == 1
|
||||
List<SearchPgcItemModel>() => item.length == 1
|
||||
? SizedBox(
|
||||
height: 160,
|
||||
child: SearchPgcItem(item: item.first),
|
||||
@@ -80,7 +80,7 @@ class _SearchAllPanelState
|
||||
? StyleString.safeSpace
|
||||
: 0,
|
||||
),
|
||||
child: BangumiCardVSearch(item: item[index]),
|
||||
child: PgcCardVSearch(item: item[index]),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
70
lib/pages/search_panel/all/widgets/pgc_card_v_search.dart
Normal file
70
lib/pages/search_panel/all/widgets/pgc_card_v_search.dart
Normal file
@@ -0,0 +1,70 @@
|
||||
import 'package:PiliPlus/common/widgets/badge.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/image_save.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/models/search/result.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// 视频卡片 - 垂直布局
|
||||
class PgcCardVSearch extends StatelessWidget {
|
||||
const PgcCardVSearch({
|
||||
super.key,
|
||||
required this.item,
|
||||
});
|
||||
|
||||
final SearchPgcItemModel item;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
margin: EdgeInsets.zero,
|
||||
child: InkWell(
|
||||
onLongPress: () => imageSaveDialog(
|
||||
title: item.title.map((e) => e.text).join(),
|
||||
cover: item.cover,
|
||||
),
|
||||
onTap: () => PageUtils.viewPgc(seasonId: item.seasonId),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AspectRatio(
|
||||
aspectRatio: 0.75,
|
||||
child: LayoutBuilder(builder: (context, boxConstraints) {
|
||||
final double maxWidth = boxConstraints.maxWidth;
|
||||
final double maxHeight = boxConstraints.maxHeight;
|
||||
return Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
src: item.cover,
|
||||
width: maxWidth,
|
||||
height: maxHeight,
|
||||
),
|
||||
PBadge(
|
||||
text: item.seasonTypeName,
|
||||
right: 6,
|
||||
top: 6,
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(4, 5, 0, 3),
|
||||
child: Text(
|
||||
item.title.map((e) => e.text).join(),
|
||||
textAlign: TextAlign.start,
|
||||
style: const TextStyle(
|
||||
letterSpacing: 0.3,
|
||||
),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class SearchArticleController
|
||||
extends SearchPanelController<SearchArticleModel, SearchArticleItemModel> {
|
||||
extends SearchPanelController<SearchArticleData, SearchArticleItemModel> {
|
||||
SearchArticleController({
|
||||
required super.keyword,
|
||||
required super.searchType,
|
||||
|
||||
@@ -20,7 +20,7 @@ class SearchArticlePanel extends CommonSearchPanel {
|
||||
}
|
||||
|
||||
class _SearchArticlePanelState extends CommonSearchPanelState<
|
||||
SearchArticlePanel, SearchArticleModel, SearchArticleItemModel> {
|
||||
SearchArticlePanel, SearchArticleData, SearchArticleItemModel> {
|
||||
@override
|
||||
late final SearchArticleController controller = Get.put(
|
||||
SearchArticleController(
|
||||
|
||||
@@ -27,7 +27,7 @@ class SearchArticleItem extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
onLongPress: () => imageSaveDialog(
|
||||
title: item.title?.map((item) => item['text']).join() ?? '',
|
||||
title: item.title.map((item) => item.text).join(),
|
||||
cover: item.imageUrls?.firstOrNull,
|
||||
),
|
||||
child: Padding(
|
||||
@@ -60,19 +60,16 @@ class SearchArticleItem extends StatelessWidget {
|
||||
Text.rich(
|
||||
maxLines: 2,
|
||||
TextSpan(
|
||||
children: [
|
||||
for (var i in item.title!) ...[
|
||||
TextSpan(
|
||||
text: i['text'],
|
||||
style: TextStyle(
|
||||
color: i['type'] == 'em'
|
||||
? theme.colorScheme.primary
|
||||
: theme.colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
]
|
||||
],
|
||||
),
|
||||
children: item.title
|
||||
.map((e) => TextSpan(
|
||||
text: e.text,
|
||||
style: TextStyle(
|
||||
color: e.isEm
|
||||
? theme.colorScheme.primary
|
||||
: theme.colorScheme.onSurface,
|
||||
),
|
||||
))
|
||||
.toList()),
|
||||
),
|
||||
const Spacer(),
|
||||
Text(
|
||||
|
||||
@@ -20,10 +20,10 @@ class SearchLivePanel extends CommonSearchPanel {
|
||||
}
|
||||
|
||||
class _SearchLivePanelState extends CommonSearchPanelState<SearchLivePanel,
|
||||
SearchLiveModel, SearchLiveItemModel> {
|
||||
SearchLiveData, SearchLiveItemModel> {
|
||||
@override
|
||||
late final controller = Get.put(
|
||||
SearchPanelController<SearchLiveModel, SearchLiveItemModel>(
|
||||
SearchPanelController<SearchLiveData, SearchLiveItemModel>(
|
||||
keyword: widget.keyword,
|
||||
searchType: widget.searchType,
|
||||
tag: widget.tag,
|
||||
|
||||
@@ -21,7 +21,7 @@ class LiveItem extends StatelessWidget {
|
||||
child: InkWell(
|
||||
onTap: () => Get.toNamed('/liveRoom?roomid=${liveItem.roomid}'),
|
||||
onLongPress: () => imageSaveDialog(
|
||||
title: liveItem.title?.map((item) => item['text']).join() ?? '',
|
||||
title: liveItem.title.map((item) => item.text).join(),
|
||||
cover: liveItem.cover,
|
||||
),
|
||||
child: Column(
|
||||
@@ -73,20 +73,16 @@ class LiveItem extends StatelessWidget {
|
||||
children: [
|
||||
Text.rich(
|
||||
TextSpan(
|
||||
children: [
|
||||
for (var i in liveItem.title!) ...[
|
||||
TextSpan(
|
||||
text: i['text'],
|
||||
style: TextStyle(
|
||||
letterSpacing: 0.3,
|
||||
color: i['type'] == 'em'
|
||||
? theme.colorScheme.primary
|
||||
: theme.colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
]
|
||||
],
|
||||
),
|
||||
children: liveItem.title
|
||||
.map((e) => TextSpan(
|
||||
text: e.text,
|
||||
style: TextStyle(
|
||||
color: e.isEm
|
||||
? theme.colorScheme.primary
|
||||
: theme.colorScheme.onSurface,
|
||||
),
|
||||
))
|
||||
.toList()),
|
||||
),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
|
||||
@@ -19,10 +19,10 @@ class SearchPgcPanel extends CommonSearchPanel {
|
||||
}
|
||||
|
||||
class _SearchPgcPanelState extends CommonSearchPanelState<SearchPgcPanel,
|
||||
SearchMBangumiModel, SearchMBangumiItemModel> {
|
||||
SearchPgcData, SearchPgcItemModel> {
|
||||
@override
|
||||
late final controller = Get.put(
|
||||
SearchPanelController<SearchMBangumiModel, SearchMBangumiItemModel>(
|
||||
SearchPanelController<SearchPgcData, SearchPgcItemModel>(
|
||||
keyword: widget.keyword,
|
||||
searchType: widget.searchType,
|
||||
tag: widget.tag,
|
||||
@@ -31,7 +31,7 @@ class _SearchPgcPanelState extends CommonSearchPanelState<SearchPgcPanel,
|
||||
);
|
||||
|
||||
@override
|
||||
Widget buildList(ThemeData theme, List<SearchMBangumiItemModel> list) {
|
||||
Widget buildList(ThemeData theme, List<SearchPgcItemModel> list) {
|
||||
return SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
maxCrossAxisExtent: Grid.smallCardWidth * 2,
|
||||
|
||||
@@ -13,16 +13,16 @@ class SearchPgcItem extends StatelessWidget {
|
||||
required this.item,
|
||||
});
|
||||
|
||||
final SearchMBangumiItemModel item;
|
||||
final SearchPgcItemModel item;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
const TextStyle style = TextStyle(fontSize: 13);
|
||||
return InkWell(
|
||||
onTap: () => PageUtils.viewBangumi(seasonId: item.seasonId),
|
||||
onTap: () => PageUtils.viewPgc(seasonId: item.seasonId),
|
||||
onLongPress: () => imageSaveDialog(
|
||||
title: item.title?.map((item) => item['text']).join() ?? '',
|
||||
title: item.title.map((item) => item.text).join(),
|
||||
cover: item.cover,
|
||||
),
|
||||
child: Padding(
|
||||
@@ -58,22 +58,16 @@ class SearchPgcItem extends StatelessWidget {
|
||||
const SizedBox(height: 4),
|
||||
Text.rich(
|
||||
TextSpan(
|
||||
style: TextStyle(color: theme.colorScheme.onSurface),
|
||||
children: [
|
||||
for (var i in item.title!) ...[
|
||||
TextSpan(
|
||||
text: i['text'],
|
||||
style: TextStyle(
|
||||
fontSize: theme.textTheme.titleSmall!.fontSize!,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: i['type'] == 'em'
|
||||
? theme.colorScheme.primary
|
||||
: theme.colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
children: item.title
|
||||
.map((e) => TextSpan(
|
||||
text: e.text,
|
||||
style: TextStyle(
|
||||
color: e.isEm
|
||||
? theme.colorScheme.primary
|
||||
: theme.colorScheme.onSurface,
|
||||
),
|
||||
))
|
||||
.toList()),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text('评分:${item.mediaScore?['score']}', style: style),
|
||||
|
||||
@@ -8,7 +8,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class SearchUserController
|
||||
extends SearchPanelController<SearchUserModel, SearchUserItemModel> {
|
||||
extends SearchPanelController<SearchUserData, SearchUserItemModel> {
|
||||
SearchUserController({
|
||||
required super.keyword,
|
||||
required super.searchType,
|
||||
|
||||
@@ -20,7 +20,7 @@ class SearchUserPanel extends CommonSearchPanel {
|
||||
}
|
||||
|
||||
class _SearchUserPanelState extends CommonSearchPanelState<SearchUserPanel,
|
||||
SearchUserModel, SearchUserItemModel> {
|
||||
SearchUserData, SearchUserItemModel> {
|
||||
@override
|
||||
late final SearchUserController controller = Get.put(
|
||||
SearchUserController(
|
||||
|
||||
@@ -12,7 +12,7 @@ import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class SearchVideoController
|
||||
extends SearchPanelController<SearchVideoModel, SearchVideoItemModel> {
|
||||
extends SearchPanelController<SearchVideoData, SearchVideoItemModel> {
|
||||
SearchVideoController({
|
||||
required super.keyword,
|
||||
required super.searchType,
|
||||
@@ -46,13 +46,12 @@ class SearchVideoController
|
||||
}
|
||||
|
||||
@override
|
||||
List<SearchVideoItemModel>? getDataList(SearchVideoModel response) {
|
||||
List<SearchVideoItemModel>? getDataList(SearchVideoData response) {
|
||||
return response.list;
|
||||
}
|
||||
|
||||
@override
|
||||
bool customHandleResponse(
|
||||
bool isRefresh, Success<SearchVideoModel> response) {
|
||||
bool customHandleResponse(bool isRefresh, Success<SearchVideoData> response) {
|
||||
searchResultController?.count[searchType.index] =
|
||||
response.response.numResults ?? 0;
|
||||
if (searchType == SearchType.video && hasJump2Video != true && isRefresh) {
|
||||
|
||||
@@ -22,7 +22,7 @@ class SearchVideoPanel extends CommonSearchPanel {
|
||||
}
|
||||
|
||||
class _SearchVideoPanelState extends CommonSearchPanelState<SearchVideoPanel,
|
||||
SearchVideoModel, SearchVideoItemModel> {
|
||||
SearchVideoData, SearchVideoItemModel> {
|
||||
@override
|
||||
late final SearchVideoController controller = Get.put(
|
||||
SearchVideoController(
|
||||
|
||||
@@ -80,7 +80,7 @@ abstract class CommonSearchPanelState<
|
||||
(context, index) {
|
||||
switch (widget.searchType) {
|
||||
case SearchType.media_bangumi || SearchType.media_ft:
|
||||
return const MediaBangumiSkeleton();
|
||||
return const MediaPgcSkeleton();
|
||||
case SearchType.bili_user:
|
||||
return const MsgFeedTopSkeleton();
|
||||
case SearchType.live_room:
|
||||
|
||||
Reference in New Issue
Block a user