Merge branch 'main' into fix
This commit is contained in:
@ -36,7 +36,7 @@ class NetworkImgLayer extends StatelessWidget {
|
|||||||
final int defaultImgQuality = GlobalData().imgQuality;
|
final int defaultImgQuality = GlobalData().imgQuality;
|
||||||
final String imageUrl =
|
final String imageUrl =
|
||||||
'${src!.startsWith('//') ? 'https:${src!}' : src!}@${quality ?? defaultImgQuality}q.webp';
|
'${src!.startsWith('//') ? 'https:${src!}' : src!}@${quality ?? defaultImgQuality}q.webp';
|
||||||
print(imageUrl);
|
// print(imageUrl);
|
||||||
int? memCacheWidth, memCacheHeight;
|
int? memCacheWidth, memCacheHeight;
|
||||||
double aspectRatio = (width / height).toDouble();
|
double aspectRatio = (width / height).toDouble();
|
||||||
|
|
||||||
|
|||||||
@ -62,6 +62,7 @@ class OverlayPop extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
videoItem.title! as String,
|
videoItem.title! as String,
|
||||||
|
style: Theme.of(context).textTheme.titleSmall,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
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:pilipala/utils/feed_back.dart';
|
||||||
import '../../models/model_rec_video_item.dart';
|
import '../../models/model_rec_video_item.dart';
|
||||||
|
import 'overlay_pop.dart';
|
||||||
import 'stat/danmu.dart';
|
import 'stat/danmu.dart';
|
||||||
import 'stat/view.dart';
|
import 'stat/view.dart';
|
||||||
import '../../http/dynamics.dart';
|
import '../../http/dynamics.dart';
|
||||||
@ -19,15 +21,11 @@ import 'network_img_layer.dart';
|
|||||||
class VideoCardV extends StatelessWidget {
|
class VideoCardV extends StatelessWidget {
|
||||||
final dynamic videoItem;
|
final dynamic videoItem;
|
||||||
final int crossAxisCount;
|
final int crossAxisCount;
|
||||||
final Function()? longPress;
|
|
||||||
final Function()? longPressEnd;
|
|
||||||
|
|
||||||
const VideoCardV({
|
const VideoCardV({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.videoItem,
|
required this.videoItem,
|
||||||
required this.crossAxisCount,
|
required this.crossAxisCount,
|
||||||
this.longPress,
|
|
||||||
this.longPressEnd,
|
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
bool isStringNumeric(String str) {
|
bool isStringNumeric(String str) {
|
||||||
@ -127,23 +125,17 @@ class VideoCardV extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
String heroTag = Utils.makeHeroTag(videoItem.id);
|
String heroTag = Utils.makeHeroTag(videoItem.id);
|
||||||
return Card(
|
return InkWell(
|
||||||
elevation: 0,
|
|
||||||
clipBehavior: Clip.hardEdge,
|
|
||||||
margin: EdgeInsets.zero,
|
|
||||||
child: GestureDetector(
|
|
||||||
onLongPress: () {
|
|
||||||
if (longPress != null) {
|
|
||||||
longPress!();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// onLongPressEnd: (details) {
|
|
||||||
// if (longPressEnd != null) {
|
|
||||||
// longPressEnd!();
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () async => onPushDetail(heroTag),
|
onTap: () async => onPushDetail(heroTag),
|
||||||
|
onLongPress: () {
|
||||||
|
SmartDialog.show(
|
||||||
|
builder: (context) => OverlayPop(
|
||||||
|
videoItem: videoItem,
|
||||||
|
closeFn: () => SmartDialog.dismiss(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
AspectRatio(
|
AspectRatio(
|
||||||
@ -184,8 +176,6 @@ class VideoCardV extends StatelessWidget {
|
|||||||
VideoContent(videoItem: videoItem, crossAxisCount: crossAxisCount)
|
VideoContent(videoItem: videoItem, crossAxisCount: crossAxisCount)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -196,123 +186,91 @@ class VideoContent extends StatelessWidget {
|
|||||||
const VideoContent(
|
const VideoContent(
|
||||||
{Key? key, required this.videoItem, required this.crossAxisCount})
|
{Key? key, required this.videoItem, required this.crossAxisCount})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
|
Widget _buildBadge(String text, String type, [double fs = 12]) {
|
||||||
|
return PBadge(
|
||||||
|
text: text,
|
||||||
|
stack: 'normal',
|
||||||
|
size: 'small',
|
||||||
|
type: type,
|
||||||
|
fs: fs,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Expanded(
|
return Padding(
|
||||||
flex: crossAxisCount == 1 ? 0 : 1,
|
|
||||||
child: Padding(
|
|
||||||
padding: crossAxisCount == 1
|
padding: crossAxisCount == 1
|
||||||
? const EdgeInsets.fromLTRB(9, 9, 9, 4)
|
? const EdgeInsets.fromLTRB(9, 9, 9, 4)
|
||||||
: const EdgeInsets.fromLTRB(5, 8, 5, 4),
|
: const EdgeInsets.fromLTRB(5, 8, 5, 4),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Text(
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Text(
|
|
||||||
videoItem.title,
|
videoItem.title,
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
if (videoItem.goto == 'av' && crossAxisCount == 1) ...[
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
VideoPopupMenu(
|
|
||||||
size: 32,
|
|
||||||
iconSize: 18,
|
|
||||||
videoItem: videoItem,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
),
|
|
||||||
if (crossAxisCount > 1) ...[
|
if (crossAxisCount > 1) ...[
|
||||||
const SizedBox(height: 2),
|
const SizedBox(height: 2),
|
||||||
VideoStat(
|
VideoStat(videoItem: videoItem, crossAxisCount: crossAxisCount),
|
||||||
videoItem: videoItem,
|
|
||||||
crossAxisCount: crossAxisCount,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
if (crossAxisCount == 1) const SizedBox(height: 4),
|
if (crossAxisCount == 1) const SizedBox(height: 4),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
if (videoItem.goto == 'bangumi') ...[
|
if (videoItem.goto == 'bangumi')
|
||||||
PBadge(
|
_buildBadge(videoItem.bangumiBadge, 'line', 9),
|
||||||
text: videoItem.bangumiBadge,
|
if (videoItem.rcmdReason?.content != null &&
|
||||||
stack: 'normal',
|
videoItem.rcmdReason.content != '')
|
||||||
size: 'small',
|
_buildBadge(videoItem.rcmdReason.content, 'color'),
|
||||||
type: 'line',
|
if (videoItem.goto == 'picture') _buildBadge('动态', 'line', 9),
|
||||||
fs: 9,
|
if (videoItem.isFollowed == 1) _buildBadge('已关注', 'color'),
|
||||||
)
|
|
||||||
],
|
|
||||||
if (videoItem.rcmdReason != null &&
|
|
||||||
videoItem.rcmdReason.content != '') ...[
|
|
||||||
PBadge(
|
|
||||||
text: videoItem.rcmdReason.content,
|
|
||||||
stack: 'normal',
|
|
||||||
size: 'small',
|
|
||||||
type: 'color',
|
|
||||||
)
|
|
||||||
],
|
|
||||||
if (videoItem.goto == 'picture') ...[
|
|
||||||
const PBadge(
|
|
||||||
text: '动态',
|
|
||||||
stack: 'normal',
|
|
||||||
size: 'small',
|
|
||||||
type: 'line',
|
|
||||||
fs: 9,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
if (videoItem.isFollowed == 1) ...[
|
|
||||||
const PBadge(
|
|
||||||
text: '已关注',
|
|
||||||
stack: 'normal',
|
|
||||||
size: 'small',
|
|
||||||
type: 'color',
|
|
||||||
)
|
|
||||||
],
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: crossAxisCount == 1 ? 0 : 1,
|
flex: crossAxisCount == 1 ? 0 : 1,
|
||||||
child: Text(
|
child: Text(
|
||||||
videoItem.owner.name,
|
videoItem.owner.name,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize:
|
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||||
Theme.of(context).textTheme.labelMedium!.fontSize,
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
color: Theme.of(context).colorScheme.outline,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (crossAxisCount == 1) ...[
|
if (crossAxisCount == 1) ...[
|
||||||
Text(
|
const SizedBox(width: 10),
|
||||||
' • ',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize:
|
|
||||||
Theme.of(context).textTheme.labelMedium!.fontSize,
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
VideoStat(
|
VideoStat(
|
||||||
videoItem: videoItem,
|
videoItem: videoItem,
|
||||||
crossAxisCount: crossAxisCount,
|
crossAxisCount: crossAxisCount,
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
],
|
],
|
||||||
if (videoItem.goto == 'av' && crossAxisCount != 1) ...[
|
if (videoItem.goto == 'av')
|
||||||
VideoPopupMenu(
|
SizedBox(
|
||||||
size: 24,
|
width: 24,
|
||||||
iconSize: 14,
|
height: 24,
|
||||||
videoItem: videoItem,
|
child: IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
feedBack();
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
useRootNavigator: true,
|
||||||
|
isScrollControlled: true,
|
||||||
|
builder: (context) {
|
||||||
|
return MorePanel(videoItem: videoItem);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
Icons.more_vert_outlined,
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
size: 14,
|
||||||
),
|
),
|
||||||
] else ...[
|
),
|
||||||
const SizedBox(height: 24)
|
)
|
||||||
]
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -331,15 +289,9 @@ class VideoStat extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
StatView(
|
StatView(theme: 'gray', view: videoItem.stat.view),
|
||||||
theme: 'gray',
|
|
||||||
view: videoItem.stat.view,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
StatDanMu(
|
StatDanMu(theme: 'gray', danmu: videoItem.stat.danmu),
|
||||||
theme: 'gray',
|
|
||||||
danmu: videoItem.stat.danmu,
|
|
||||||
),
|
|
||||||
if (videoItem is RecVideoItemModel) ...<Widget>[
|
if (videoItem is RecVideoItemModel) ...<Widget>[
|
||||||
crossAxisCount > 1 ? const Spacer() : const SizedBox(width: 8),
|
crossAxisCount > 1 ? const Spacer() : const SizedBox(width: 8),
|
||||||
RichText(
|
RichText(
|
||||||
@ -358,69 +310,39 @@ class VideoStat extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class VideoPopupMenu extends StatelessWidget {
|
class MorePanel extends StatelessWidget {
|
||||||
final double? size;
|
|
||||||
final double? iconSize;
|
|
||||||
final dynamic videoItem;
|
final dynamic videoItem;
|
||||||
|
const MorePanel({super.key, required this.videoItem});
|
||||||
|
|
||||||
const VideoPopupMenu({
|
Future<dynamic> menuActionHandler(String type) async {
|
||||||
Key? key,
|
switch (type) {
|
||||||
required this.size,
|
case 'block':
|
||||||
required this.iconSize,
|
blockUser();
|
||||||
required this.videoItem,
|
break;
|
||||||
}) : super(key: key);
|
case 'watchLater':
|
||||||
|
var res = await UserHttp.toViewLater(bvid: videoItem.bvid as String);
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return SizedBox(
|
|
||||||
width: size,
|
|
||||||
height: size,
|
|
||||||
child: PopupMenuButton<String>(
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
icon: Icon(
|
|
||||||
Icons.more_vert_outlined,
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
size: iconSize,
|
|
||||||
),
|
|
||||||
position: PopupMenuPosition.under,
|
|
||||||
// constraints: const BoxConstraints(maxHeight: 35),
|
|
||||||
onSelected: (String type) {},
|
|
||||||
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
|
|
||||||
PopupMenuItem<String>(
|
|
||||||
onTap: () async {
|
|
||||||
var res =
|
|
||||||
await UserHttp.toViewLater(bvid: videoItem.bvid as String);
|
|
||||||
SmartDialog.showToast(res['msg']);
|
SmartDialog.showToast(res['msg']);
|
||||||
},
|
Get.back();
|
||||||
value: 'pause',
|
break;
|
||||||
height: 40,
|
default:
|
||||||
child: const Row(
|
}
|
||||||
children: [
|
}
|
||||||
Icon(Icons.watch_later_outlined, size: 16),
|
|
||||||
SizedBox(width: 6),
|
void blockUser() async {
|
||||||
Text('稍后再看', style: TextStyle(fontSize: 13))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const PopupMenuDivider(),
|
|
||||||
PopupMenuItem<String>(
|
|
||||||
onTap: () async {
|
|
||||||
SmartDialog.show(
|
SmartDialog.show(
|
||||||
useSystem: true,
|
useSystem: true,
|
||||||
animationType: SmartAnimationType.centerFade_otherSlide,
|
animationType: SmartAnimationType.centerFade_otherSlide,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('提示'),
|
title: const Text('提示'),
|
||||||
content: Text(
|
content: Text('确定拉黑:${videoItem.owner.name}(${videoItem.owner.mid})?'
|
||||||
'确定拉黑:${videoItem.owner.name}(${videoItem.owner.mid})?'
|
|
||||||
'\n\n注:被拉黑的Up可以在隐私设置-黑名单管理中解除'),
|
'\n\n注:被拉黑的Up可以在隐私设置-黑名单管理中解除'),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => SmartDialog.dismiss(),
|
onPressed: () => SmartDialog.dismiss(),
|
||||||
child: Text(
|
child: Text(
|
||||||
'点错了',
|
'点错了',
|
||||||
style: TextStyle(
|
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
||||||
color: Theme.of(context).colorScheme.outline),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
@ -439,18 +361,47 @@ class VideoPopupMenu extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
value: 'pause',
|
|
||||||
height: 40,
|
@override
|
||||||
child: Row(
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
const Icon(Icons.block, size: 16),
|
InkWell(
|
||||||
const SizedBox(width: 6),
|
onTap: () => Get.back(),
|
||||||
Text('拉黑:${videoItem.owner.name}',
|
child: Container(
|
||||||
style: const TextStyle(fontSize: 13))
|
height: 35,
|
||||||
],
|
padding: const EdgeInsets.only(bottom: 2),
|
||||||
|
child: Center(
|
||||||
|
child: Container(
|
||||||
|
width: 32,
|
||||||
|
height: 3,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () async => await menuActionHandler('block'),
|
||||||
|
minLeadingWidth: 0,
|
||||||
|
leading: const Icon(Icons.block, size: 19),
|
||||||
|
title: Text(
|
||||||
|
'拉黑up主 「${videoItem.owner.name}」',
|
||||||
|
style: Theme.of(context).textTheme.titleSmall,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () async => await menuActionHandler('watchLater'),
|
||||||
|
minLeadingWidth: 0,
|
||||||
|
leading: const Icon(Icons.watch_later_outlined, size: 19),
|
||||||
|
title:
|
||||||
|
Text('添加至稍后再看', style: Theme.of(context).textTheme.titleSmall),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -192,22 +192,15 @@ class VideoHttp {
|
|||||||
// 视频信息 标题、简介
|
// 视频信息 标题、简介
|
||||||
static Future videoIntro({required String bvid}) async {
|
static Future videoIntro({required String bvid}) async {
|
||||||
var res = await Request().get(Api.videoIntro, data: {'bvid': bvid});
|
var res = await Request().get(Api.videoIntro, data: {'bvid': bvid});
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
VideoDetailResponse result = VideoDetailResponse.fromJson(res.data);
|
VideoDetailResponse result = VideoDetailResponse.fromJson(res.data);
|
||||||
if (result.code == 0) {
|
|
||||||
return {'status': true, 'data': result.data!};
|
return {'status': true, 'data': result.data!};
|
||||||
} else {
|
} else {
|
||||||
Map errMap = {
|
|
||||||
-400: '请求错误',
|
|
||||||
-403: '权限不足',
|
|
||||||
-404: '视频资源失效',
|
|
||||||
62002: '稿件不可见',
|
|
||||||
62004: '稿件审核中',
|
|
||||||
};
|
|
||||||
return {
|
return {
|
||||||
'status': false,
|
'status': false,
|
||||||
'data': null,
|
'data': null,
|
||||||
'code': result.code,
|
'code': res.data['code'],
|
||||||
'msg': errMap[result.code] ?? '请求异常',
|
'msg': res.data['message'],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,6 +67,7 @@ class VideoDetailData {
|
|||||||
String? likeIcon;
|
String? likeIcon;
|
||||||
bool? needJumpBv;
|
bool? needJumpBv;
|
||||||
String? epId;
|
String? epId;
|
||||||
|
List<Staff>? staff;
|
||||||
|
|
||||||
VideoDetailData({
|
VideoDetailData({
|
||||||
this.bvid,
|
this.bvid,
|
||||||
@ -103,6 +104,7 @@ class VideoDetailData {
|
|||||||
this.likeIcon,
|
this.likeIcon,
|
||||||
this.needJumpBv,
|
this.needJumpBv,
|
||||||
this.epId,
|
this.epId,
|
||||||
|
this.staff,
|
||||||
});
|
});
|
||||||
|
|
||||||
VideoDetailData.fromJson(Map<String, dynamic> json) {
|
VideoDetailData.fromJson(Map<String, dynamic> json) {
|
||||||
@ -155,6 +157,9 @@ class VideoDetailData {
|
|||||||
if (json['redirect_url'] != null) {
|
if (json['redirect_url'] != null) {
|
||||||
epId = resolveEpId(json['redirect_url']);
|
epId = resolveEpId(json['redirect_url']);
|
||||||
}
|
}
|
||||||
|
staff = json["staff"] != null
|
||||||
|
? List<Staff>.from(json["staff"]!.map((e) => Staff.fromJson(e)))
|
||||||
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String resolveEpId(url) {
|
String resolveEpId(url) {
|
||||||
@ -652,3 +657,43 @@ class EpisodeItem {
|
|||||||
bvid = json['bvid'];
|
bvid = json['bvid'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Staff {
|
||||||
|
Staff({
|
||||||
|
this.mid,
|
||||||
|
this.title,
|
||||||
|
this.name,
|
||||||
|
this.face,
|
||||||
|
this.vip,
|
||||||
|
});
|
||||||
|
|
||||||
|
int? mid;
|
||||||
|
String? title;
|
||||||
|
String? name;
|
||||||
|
String? face;
|
||||||
|
int? status;
|
||||||
|
Vip? vip;
|
||||||
|
|
||||||
|
Staff.fromJson(Map<String, dynamic> json) {
|
||||||
|
mid = json['mid'];
|
||||||
|
title = json['title'];
|
||||||
|
name = json['name'];
|
||||||
|
face = json['face'];
|
||||||
|
vip = Vip.fromJson(json['vip']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Vip {
|
||||||
|
Vip({
|
||||||
|
this.type,
|
||||||
|
this.status,
|
||||||
|
});
|
||||||
|
|
||||||
|
int? type;
|
||||||
|
int? status;
|
||||||
|
|
||||||
|
Vip.fromJson(Map<String, dynamic> json) {
|
||||||
|
type = json['type'];
|
||||||
|
status = json['status'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -214,24 +214,8 @@ class UserInfoWidget extends StatelessWidget {
|
|||||||
final VoidCallback? callback;
|
final VoidCallback? callback;
|
||||||
final HomeController? ctr;
|
final HomeController? ctr;
|
||||||
|
|
||||||
@override
|
Widget buildLoggedInWidget(context) {
|
||||||
Widget build(BuildContext context) {
|
return Stack(
|
||||||
return Row(
|
|
||||||
children: [
|
|
||||||
SearchBar(ctr: ctr),
|
|
||||||
if (userLogin.value) ...[
|
|
||||||
const SizedBox(width: 4),
|
|
||||||
ClipRect(
|
|
||||||
child: IconButton(
|
|
||||||
onPressed: () => Get.toNamed('/whisper'),
|
|
||||||
icon: const Icon(Icons.notifications_none),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
const SizedBox(width: 8),
|
|
||||||
Obx(
|
|
||||||
() => userLogin.value
|
|
||||||
? Stack(
|
|
||||||
children: [
|
children: [
|
||||||
NetworkImgLayer(
|
NetworkImgLayer(
|
||||||
type: 'avatar',
|
type: 'avatar',
|
||||||
@ -255,7 +239,27 @@ class UserInfoWidget extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
SearchBar(ctr: ctr),
|
||||||
|
if (userLogin.value) ...[
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
ClipRect(
|
||||||
|
child: IconButton(
|
||||||
|
onPressed: () => Get.toNamed('/whisper'),
|
||||||
|
icon: const Icon(Icons.notifications_none),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
],
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Obx(
|
||||||
|
() => userLogin.value
|
||||||
|
? buildLoggedInWidget(context)
|
||||||
: DefaultUser(callback: () => callback!()),
|
: DefaultUser(callback: () => callback!()),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -402,34 +406,31 @@ class SearchBar extends StatelessWidget {
|
|||||||
color: colorScheme.onSecondaryContainer.withOpacity(0.05),
|
color: colorScheme.onSecondaryContainer.withOpacity(0.05),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
splashColor: colorScheme.primaryContainer.withOpacity(0.3),
|
splashColor: colorScheme.primaryContainer.withOpacity(0.3),
|
||||||
onTap: () => Get.toNamed(
|
onTap: () => Get.toNamed('/search',
|
||||||
'/search',
|
parameters: {'hintText': ctr!.defaultSearch.value}),
|
||||||
parameters: {'hintText': ctr!.defaultSearch.value},
|
child: Padding(
|
||||||
),
|
padding: const EdgeInsets.symmetric(horizontal: 14),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(width: 14),
|
|
||||||
Icon(
|
Icon(
|
||||||
Icons.search_outlined,
|
Icons.search_outlined,
|
||||||
color: colorScheme.onSecondaryContainer,
|
color: colorScheme.onSecondaryContainer,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Obx(
|
Obx(
|
||||||
() => Expanded(
|
() => Text(
|
||||||
child: Text(
|
|
||||||
ctr!.defaultSearch.value,
|
ctr!.defaultSearch.value,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(color: colorScheme.outline),
|
style: TextStyle(color: colorScheme.outline),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
const SizedBox(width: 15),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,9 +5,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/common/constants.dart';
|
import 'package:pilipala/common/constants.dart';
|
||||||
import 'package:pilipala/common/skeleton/video_card_v.dart';
|
import 'package:pilipala/common/skeleton/video_card_v.dart';
|
||||||
import 'package:pilipala/common/widgets/animated_dialog.dart';
|
|
||||||
import 'package:pilipala/common/widgets/http_error.dart';
|
import 'package:pilipala/common/widgets/http_error.dart';
|
||||||
import 'package:pilipala/common/widgets/overlay_pop.dart';
|
|
||||||
import 'package:pilipala/common/widgets/video_card_v.dart';
|
import 'package:pilipala/common/widgets/video_card_v.dart';
|
||||||
import 'package:pilipala/utils/main_stream.dart';
|
import 'package:pilipala/utils/main_stream.dart';
|
||||||
|
|
||||||
@ -118,16 +116,6 @@ class _RcmdPageState extends State<RcmdPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
OverlayEntry _createPopupDialog(videoItem) {
|
|
||||||
return OverlayEntry(
|
|
||||||
builder: (context) => AnimatedDialog(
|
|
||||||
closeFn: _rcmdController.popupDialog?.remove,
|
|
||||||
child: OverlayPop(
|
|
||||||
videoItem: videoItem, closeFn: _rcmdController.popupDialog?.remove),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget contentGrid(ctr, videoList) {
|
Widget contentGrid(ctr, videoList) {
|
||||||
// double maxWidth = Get.size.width;
|
// double maxWidth = Get.size.width;
|
||||||
// int baseWidth = 500;
|
// int baseWidth = 500;
|
||||||
@ -158,14 +146,6 @@ class _RcmdPageState extends State<RcmdPage>
|
|||||||
? VideoCardV(
|
? VideoCardV(
|
||||||
videoItem: videoList[index],
|
videoItem: videoList[index],
|
||||||
crossAxisCount: crossAxisCount,
|
crossAxisCount: crossAxisCount,
|
||||||
longPress: () {
|
|
||||||
_rcmdController.popupDialog =
|
|
||||||
_createPopupDialog(videoList[index]);
|
|
||||||
Overlay.of(context).insert(_rcmdController.popupDialog!);
|
|
||||||
},
|
|
||||||
longPressEnd: () {
|
|
||||||
_rcmdController.popupDialog?.remove();
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
: const VideoCardVSkeleton();
|
: const VideoCardVSkeleton();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import 'widgets/fav_panel.dart';
|
|||||||
import 'widgets/intro_detail.dart';
|
import 'widgets/intro_detail.dart';
|
||||||
import 'widgets/page_panel.dart';
|
import 'widgets/page_panel.dart';
|
||||||
import 'widgets/season_panel.dart';
|
import 'widgets/season_panel.dart';
|
||||||
|
import 'widgets/staff_up_item.dart';
|
||||||
|
|
||||||
class VideoIntroPanel extends StatefulWidget {
|
class VideoIntroPanel extends StatefulWidget {
|
||||||
final String bvid;
|
final String bvid;
|
||||||
@ -409,10 +410,12 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
if (widget.videoDetail!.staff == null)
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: onPushMember,
|
onTap: onPushMember,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 4),
|
padding:
|
||||||
|
const EdgeInsets.symmetric(vertical: 12, horizontal: 4),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
NetworkImgLayer(
|
NetworkImgLayer(
|
||||||
@ -434,7 +437,8 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Obx(() => AnimatedOpacity(
|
Obx(
|
||||||
|
() => AnimatedOpacity(
|
||||||
opacity:
|
opacity:
|
||||||
videoIntroController.followStatus.isEmpty ? 0 : 1,
|
videoIntroController.followStatus.isEmpty ? 0 : 1,
|
||||||
duration: const Duration(milliseconds: 50),
|
duration: const Duration(milliseconds: 50),
|
||||||
@ -474,11 +478,58 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (widget.videoDetail!.staff != null) ...[
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text.rich(
|
||||||
|
TextSpan(
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize:
|
||||||
|
Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
TextSpan(
|
||||||
|
text: '创作团队',
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.titleSmall!
|
||||||
|
.copyWith(fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
const WidgetSpan(child: SizedBox(width: 6)),
|
||||||
|
TextSpan(
|
||||||
|
text: '${widget.videoDetail!.staff!.length}人',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 120,
|
||||||
|
child: ListView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
children: [
|
||||||
|
for (int i = 0;
|
||||||
|
i < widget.videoDetail!.staff!.length;
|
||||||
|
i++) ...[
|
||||||
|
StaffUpItem(item: widget.videoDetail!.staff![i])
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
@ -545,4 +596,8 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Widget StaffPanel(BuildContext context, videoIntroController) {
|
||||||
|
// return
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,6 +23,8 @@ class IntroDetail extends StatelessWidget {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Clipboard.setData(ClipboardData(text: videoDetail!.bvid!));
|
Clipboard.setData(ClipboardData(text: videoDetail!.bvid!));
|
||||||
@ -31,9 +33,25 @@ class IntroDetail extends StatelessWidget {
|
|||||||
child: Text(
|
child: Text(
|
||||||
videoDetail!.bvid!,
|
videoDetail!.bvid!,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 13, color: Theme.of(context).colorScheme.primary),
|
fontSize: 13,
|
||||||
|
color: Theme.of(context).colorScheme.primary),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Clipboard.setData(ClipboardData(text: videoDetail!.bvid!));
|
||||||
|
SmartDialog.showToast('已复制');
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
videoDetail!.aid!.toString(),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
color: Theme.of(context).colorScheme.primary),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
Text.rich(
|
Text.rich(
|
||||||
style: const TextStyle(height: 1.4),
|
style: const TextStyle(height: 1.4),
|
||||||
|
|||||||
@ -0,0 +1,74 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
|
import 'package:pilipala/models/video_detail_res.dart';
|
||||||
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
|
class StaffUpItem extends StatelessWidget {
|
||||||
|
final Staff item;
|
||||||
|
|
||||||
|
const StaffUpItem({
|
||||||
|
super.key,
|
||||||
|
required this.item,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final String heroTag = Utils.makeHeroTag(item.mid);
|
||||||
|
return Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () => Get.toNamed(
|
||||||
|
'/member?mid=${item.mid}',
|
||||||
|
arguments: {'face': item.face, 'heroTag': heroTag},
|
||||||
|
),
|
||||||
|
child: Hero(
|
||||||
|
tag: heroTag,
|
||||||
|
child: NetworkImgLayer(
|
||||||
|
width: 45,
|
||||||
|
height: 45,
|
||||||
|
src: item.face,
|
||||||
|
type: 'avatar',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 4),
|
||||||
|
child: SizedBox(
|
||||||
|
width: 85,
|
||||||
|
child: Text(
|
||||||
|
item.name!,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
softWrap: false,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: item.vip!.status == 1
|
||||||
|
? const Color.fromARGB(255, 251, 100, 163)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 4),
|
||||||
|
child: SizedBox(
|
||||||
|
width: 85,
|
||||||
|
child: Text(
|
||||||
|
item.title!,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
softWrap: false,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -20,7 +20,7 @@ class PiliSchame {
|
|||||||
/// 完整链接进入 b23.无效
|
/// 完整链接进入 b23.无效
|
||||||
appScheme.getLatestScheme().then((SchemeEntity? value) {
|
appScheme.getLatestScheme().then((SchemeEntity? value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
_fullPathPush(value);
|
_routePush(value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -37,7 +37,6 @@ class PiliSchame {
|
|||||||
final String scheme = value.scheme;
|
final String scheme = value.scheme;
|
||||||
final String host = value.host;
|
final String host = value.host;
|
||||||
final String path = value.path;
|
final String path = value.path;
|
||||||
|
|
||||||
if (scheme == 'bilibili') {
|
if (scheme == 'bilibili') {
|
||||||
if (host == 'root') {
|
if (host == 'root') {
|
||||||
Navigator.popUntil(
|
Navigator.popUntil(
|
||||||
@ -85,6 +84,14 @@ class PiliSchame {
|
|||||||
}
|
}
|
||||||
} else if (host == 'search') {
|
} else if (host == 'search') {
|
||||||
Get.toNamed('/searchResult', parameters: {'keyword': ''});
|
Get.toNamed('/searchResult', parameters: {'keyword': ''});
|
||||||
|
} else if (host == 'article') {
|
||||||
|
final String id = path.split('/').last.split('?').first;
|
||||||
|
Get.toNamed('/htmlRender', parameters: {
|
||||||
|
'url': 'https://www.bilibili.com/read/cv$id',
|
||||||
|
'title': 'cv$id',
|
||||||
|
'id': 'cv$id',
|
||||||
|
'dynamicType': 'read'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (scheme == 'https') {
|
if (scheme == 'https') {
|
||||||
@ -155,9 +162,14 @@ class PiliSchame {
|
|||||||
final String host = value.host!;
|
final String host = value.host!;
|
||||||
final String? path = value.path;
|
final String? path = value.path;
|
||||||
Map<String, String>? query = value.query;
|
Map<String, String>? query = value.query;
|
||||||
RegExp regExp = RegExp(r'^(www\.)?m?\.(bilibili\.com)$');
|
RegExp regExp = RegExp(r'^((www\.)|(m\.))?bilibili\.com$');
|
||||||
if (regExp.hasMatch(host)) {
|
if (regExp.hasMatch(host)) {
|
||||||
print('bilibili.com');
|
print('bilibili.com host: $host');
|
||||||
|
print('bilibili.com path: $path');
|
||||||
|
final String lastPathSegment = path!.split('/').last;
|
||||||
|
if (lastPathSegment.contains('BV')) {
|
||||||
|
_videoPush(null, lastPathSegment);
|
||||||
|
}
|
||||||
} else if (host.contains('live')) {
|
} else if (host.contains('live')) {
|
||||||
int roomId = int.parse(path!.split('/').last);
|
int roomId = int.parse(path!.split('/').last);
|
||||||
Get.toNamed(
|
Get.toNamed(
|
||||||
@ -226,6 +238,13 @@ class PiliSchame {
|
|||||||
break;
|
break;
|
||||||
case 'read':
|
case 'read':
|
||||||
print('专栏');
|
print('专栏');
|
||||||
|
String id = 'cv${matchNum(query!['id']!).first}';
|
||||||
|
Get.toNamed('/htmlRender', parameters: {
|
||||||
|
'url': value.dataString!,
|
||||||
|
'title': '',
|
||||||
|
'id': id,
|
||||||
|
'dynamicType': 'read'
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case 'space':
|
case 'space':
|
||||||
print('个人空间');
|
print('个人空间');
|
||||||
|
|||||||
Reference in New Issue
Block a user