mod: 番剧搜索
This commit is contained in:
@ -67,6 +67,9 @@ class SearchHttp {
|
||||
case SearchType.bili_user:
|
||||
data = SearchUserModel.fromJson(res.data['data']);
|
||||
break;
|
||||
case SearchType.media_bangumi:
|
||||
data = SearchMBangumiModel.fromJson(res.data['data']);
|
||||
break;
|
||||
}
|
||||
return {
|
||||
'status': true,
|
||||
|
@ -3,7 +3,7 @@ enum SearchType {
|
||||
// 视频:video
|
||||
video,
|
||||
// 番剧:media_bangumi,
|
||||
// media_bangumi,
|
||||
media_bangumi,
|
||||
// 影视:media_ft
|
||||
// media_ft,
|
||||
// 直播间及主播:live
|
||||
@ -23,6 +23,7 @@ enum SearchType {
|
||||
}
|
||||
|
||||
extension SearchTypeExtension on SearchType {
|
||||
String get type => ['video', 'live_room', 'bili_user'][index];
|
||||
String get label => ['视频', '直播间', '用户'][index];
|
||||
String get type =>
|
||||
['video', 'media_bangumi', 'live_room', 'bili_user'][index];
|
||||
String get label => ['视频', '番剧', '直播间', '用户'][index];
|
||||
}
|
||||
|
@ -282,3 +282,98 @@ class SearchLiveItemModel {
|
||||
cateName = Em.regCate(json['cate_name']) ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
class SearchMBangumiModel {
|
||||
SearchMBangumiModel({this.list});
|
||||
List<SearchMBangumiItemModel>? list;
|
||||
SearchMBangumiModel.fromJson(Map<String, dynamic> json) {
|
||||
list = json['result']
|
||||
.map<SearchMBangumiItemModel>(
|
||||
(e) => SearchMBangumiItemModel.fromJson(e))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
||||
class SearchMBangumiItemModel {
|
||||
SearchMBangumiItemModel({
|
||||
this.type,
|
||||
this.mediaId,
|
||||
this.title,
|
||||
this.orgTitle,
|
||||
this.mediaType,
|
||||
this.cv,
|
||||
this.staff,
|
||||
this.seasonId,
|
||||
this.isAvid,
|
||||
this.hitEpids,
|
||||
this.seasonType,
|
||||
this.seasonTypeName,
|
||||
this.url,
|
||||
this.buttonText,
|
||||
this.isFollow,
|
||||
this.isSelection,
|
||||
this.cover,
|
||||
this.areas,
|
||||
this.styles,
|
||||
this.gotoUrl,
|
||||
this.desc,
|
||||
this.pubtime,
|
||||
this.mediaMode,
|
||||
this.mediaScore,
|
||||
this.indexShow,
|
||||
});
|
||||
|
||||
String? type;
|
||||
int? mediaId;
|
||||
List? title;
|
||||
String? orgTitle;
|
||||
int? mediaType;
|
||||
String? cv;
|
||||
String? staff;
|
||||
int? seasonId;
|
||||
bool? isAvid;
|
||||
String? hitEpids;
|
||||
int? seasonType;
|
||||
String? seasonTypeName;
|
||||
String? url;
|
||||
String? buttonText;
|
||||
int? isFollow;
|
||||
int? isSelection;
|
||||
String? cover;
|
||||
String? areas;
|
||||
String? styles;
|
||||
String? gotoUrl;
|
||||
String? desc;
|
||||
int? pubtime;
|
||||
int? mediaMode;
|
||||
Map? mediaScore;
|
||||
String? indexShow;
|
||||
|
||||
SearchMBangumiItemModel.fromJson(Map<String, dynamic> json) {
|
||||
type = json['type'];
|
||||
mediaId = json['media_id'];
|
||||
title = Em.regTitle(json['title']);
|
||||
orgTitle = json['org_title'];
|
||||
mediaType = json['media_type'];
|
||||
cv = json['cv'];
|
||||
staff = json['staff'];
|
||||
seasonId = json['season_id'];
|
||||
isAvid = json['is_avid'];
|
||||
hitEpids = json['hit_epids'];
|
||||
seasonType = json['season_type'];
|
||||
seasonTypeName = json['season_type_name'];
|
||||
url = json['url'];
|
||||
buttonText = json['button_text'];
|
||||
isFollow = json['is_follow'];
|
||||
isSelection = json['is_selection'];
|
||||
cover = json['cover'];
|
||||
areas = json['areas'];
|
||||
styles = json['styles'];
|
||||
gotoUrl = json['goto_url'];
|
||||
desc = json['desc'];
|
||||
pubtime = json['pubtime'];
|
||||
mediaMode = json['media_mode'];
|
||||
mediaScore = json['media_score'];
|
||||
indexShow = json['index_show'];
|
||||
}
|
||||
}
|
||||
|
@ -2,15 +2,13 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/skeleton/video_card_h.dart';
|
||||
import 'package:pilipala/common/widgets/http_error.dart';
|
||||
import 'package:pilipala/common/widgets/live_card.dart';
|
||||
import 'package:pilipala/common/widgets/video_card_h.dart';
|
||||
import 'package:pilipala/models/common/search_type.dart';
|
||||
|
||||
import 'controller.dart';
|
||||
import 'widgets/live_panerl.dart';
|
||||
import 'widgets/live_panel.dart';
|
||||
import 'widgets/media_bangumi_panel.dart';
|
||||
import 'widgets/user_panel.dart';
|
||||
import 'widgets/video_panel.dart';
|
||||
import 'widgets/userPanel.dart';
|
||||
|
||||
class SearchPanel extends StatefulWidget {
|
||||
String? keyword;
|
||||
@ -73,6 +71,8 @@ class _SearchPanelState extends State<SearchPanel>
|
||||
switch (widget.searchType) {
|
||||
case SearchType.video:
|
||||
return searchVideoPanel(context, ctr, list);
|
||||
case SearchType.media_bangumi:
|
||||
return searchMbangumiPanel(context, ctr, list);
|
||||
case SearchType.bili_user:
|
||||
return searchUserPanel(context, ctr, list);
|
||||
case SearchType.live_room:
|
||||
|
@ -1,8 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/constants.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/pages/home/index.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
|
||||
Widget searchLivePanel(BuildContext context, ctr, list) {
|
105
lib/pages/searchPanel/widgets/media_bangumi_panel.dart
Normal file
105
lib/pages/searchPanel/widgets/media_bangumi_panel.dart
Normal file
@ -0,0 +1,105 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
|
||||
Widget searchMbangumiPanel(BuildContext context, ctr, list) {
|
||||
return ListView.builder(
|
||||
controller: ctr!.scrollController,
|
||||
addAutomaticKeepAlives: false,
|
||||
addRepaintBoundaries: false,
|
||||
itemCount: list!.length,
|
||||
itemBuilder: (context, index) {
|
||||
var i = list![index];
|
||||
return InkWell(
|
||||
onTap: () {},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
width: 111,
|
||||
height: 148,
|
||||
src: i.cover,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
RichText(
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onSurface),
|
||||
children: [
|
||||
WidgetSpan(child: UpTag(type: i.mediaType)),
|
||||
for (var i in i.title) ...[
|
||||
TextSpan(
|
||||
text: i['text'],
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context)
|
||||
.textTheme
|
||||
.titleSmall!
|
||||
.fontSize,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: i['type'] == 'em'
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text('评分:${i.mediaScore['score'].toString()}'),
|
||||
const SizedBox(height: 2),
|
||||
// Text(Utils.dateFormat(i.pubtime).toString()),
|
||||
// const SizedBox(height: 2),
|
||||
Row(
|
||||
children: [
|
||||
Text(i.styles),
|
||||
const SizedBox(width: 3),
|
||||
const Text('·'),
|
||||
const SizedBox(width: 3),
|
||||
Text(i.indexShow),
|
||||
const SizedBox(width: 3),
|
||||
],
|
||||
),
|
||||
// Text('声优:${i.cv}'),
|
||||
const SizedBox(height: 2),
|
||||
Text(i.desc, overflow: TextOverflow.ellipsis, maxLines: 2),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
class UpTag extends StatelessWidget {
|
||||
int? type;
|
||||
UpTag({super.key, this.type = 4});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Color primary = Theme.of(context).colorScheme.primary;
|
||||
return Container(
|
||||
width: 24,
|
||||
height: 16,
|
||||
decoration:
|
||||
BoxDecoration(borderRadius: BorderRadius.circular(3), color: primary),
|
||||
margin: const EdgeInsets.only(right: 4),
|
||||
child: Center(
|
||||
child: Text(
|
||||
type == 1 ? '番剧' : '国创',
|
||||
style: TextStyle(
|
||||
fontSize: 9,
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
|
||||
class UserPanel extends StatelessWidget {
|
||||
var userItem;
|
||||
UserPanel({super.key, this.userItem});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
|
||||
child: Row(
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
width: 42,
|
||||
height: 42,
|
||||
src: userItem.upic,
|
||||
type: 'avatar',
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
userItem!.uname,
|
||||
style: TextStyle(
|
||||
// color: replyItem!.isUp! ||
|
||||
// replyItem!.member!.vip!['vipType'] > 0
|
||||
// ? Theme.of(context).colorScheme.primary
|
||||
// : Theme.of(context).colorScheme.outline,
|
||||
fontSize:
|
||||
Theme.of(context).textTheme.titleMedium!.fontSize,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Image.asset(
|
||||
'assets/images/lv/lv${userItem!.level}.png',
|
||||
height: 11,
|
||||
),
|
||||
],
|
||||
),
|
||||
if (userItem.officialVerify['desc'] != '')
|
||||
Text(
|
||||
userItem.officialVerify['desc'],
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
Theme.of(context).textTheme.labelSmall!.fontSize,
|
||||
color: Theme.of(context).colorScheme.outline),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user