mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1b5219f8c | ||
|
|
2dafffda94 | ||
|
|
83205caa80 | ||
|
|
8291359cda | ||
|
|
907a1f67a2 | ||
|
|
64e8f9365a | ||
|
|
f82b361ec6 | ||
|
|
a32c332117 | ||
|
|
bbbba4e70a | ||
|
|
c02d828e2c | ||
|
|
2acbb17648 | ||
|
|
12e299a5d8 | ||
|
|
dff4d27736 | ||
|
|
c0f8959ffe | ||
|
|
a17a2f5465 |
4
.github/ISSUE_TEMPLATE/bug-反馈.md
vendored
4
.github/ISSUE_TEMPLATE/bug-反馈.md
vendored
@@ -19,9 +19,5 @@ assignees: ''
|
||||
### 错误日志
|
||||
请提供设置->关于->错误日志中的内容,粘贴在下方代码框中。如果没有,请提供您的app版本号、系统版本、设备型号等相关信息。
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
### 相关信息
|
||||
请补充截图、录屏、BV号等其他有助于解决问题的信息。
|
||||
|
||||
@@ -31,8 +31,7 @@ class VideoCardHSkeleton extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
Theme.of(context).colorScheme.onInverseSurface,
|
||||
borderRadius:
|
||||
BorderRadius.circular(StyleString.imgRadius.x),
|
||||
borderRadius: StyleString.mdRadius,
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -16,9 +16,9 @@ class VideoCardVSkeleton extends StatelessWidget {
|
||||
builder: (context, boxConstraints) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||
borderRadius:
|
||||
BorderRadius.circular(StyleString.imgRadius.x)),
|
||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||
borderRadius: StyleString.mdRadius,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:PiliPlus/common/constants.dart';
|
||||
import 'package:PiliPlus/common/widgets/badge.dart';
|
||||
import 'package:PiliPlus/common/widgets/network_img_layer.dart';
|
||||
import 'package:PiliPlus/common/widgets/nine_grid_view.dart';
|
||||
@@ -49,7 +50,7 @@ Widget imageview(
|
||||
}
|
||||
BorderRadius borderRadius(index) {
|
||||
if (picArr.length == 1) {
|
||||
return BorderRadius.circular(12);
|
||||
return StyleString.mdRadius;
|
||||
}
|
||||
final int row = picArr.length == 4 ? 2 : 3;
|
||||
return BorderRadius.only(
|
||||
@@ -57,27 +58,27 @@ Widget imageview(
|
||||
(index - row >= 0 ||
|
||||
((index - 1) >= 0 && (index - 1) % row < index % row))
|
||||
? 0
|
||||
: 12,
|
||||
: 10,
|
||||
),
|
||||
topRight: Radius.circular(
|
||||
(index - row >= 0 ||
|
||||
((index + 1) < picArr.length &&
|
||||
(index + 1) % row > index % row))
|
||||
? 0
|
||||
: 12,
|
||||
: 10,
|
||||
),
|
||||
bottomLeft: Radius.circular(
|
||||
(index + row < picArr.length ||
|
||||
((index - 1) >= 0 && (index - 1) % row < index % row))
|
||||
? 0
|
||||
: 12,
|
||||
: 10,
|
||||
),
|
||||
bottomRight: Radius.circular(
|
||||
(index + row < picArr.length ||
|
||||
((index + 1) < picArr.length &&
|
||||
(index + 1) % row > index % row))
|
||||
? 0
|
||||
: 12,
|
||||
: 10,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -41,20 +41,17 @@ class NetworkImgLayer extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double radius = this.radius != null
|
||||
? this.radius!
|
||||
: type == 'avatar'
|
||||
? 50
|
||||
: type == 'emote'
|
||||
? 0
|
||||
: StyleString.imgRadius.x;
|
||||
return src.isNullOrEmpty.not
|
||||
? radius != 0
|
||||
? ClipRRect(
|
||||
borderRadius: BorderRadius.circular(radius),
|
||||
child: _buildImage(context),
|
||||
)
|
||||
: _buildImage(context)
|
||||
? type == 'avatar'
|
||||
? ClipOval(child: _buildImage(context))
|
||||
: radius == 0 || type == 'emote'
|
||||
? _buildImage(context)
|
||||
: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(
|
||||
radius ?? StyleString.imgRadius.x,
|
||||
),
|
||||
child: _buildImage(context),
|
||||
)
|
||||
: getPlaceHolder?.call() ?? placeholder(context);
|
||||
}
|
||||
|
||||
@@ -99,15 +96,15 @@ class NetworkImgLayer extends StatelessWidget {
|
||||
return Container(
|
||||
width: width,
|
||||
height: height,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
shape: type == 'avatar' ? BoxShape.circle : BoxShape.rectangle,
|
||||
color: Theme.of(context).colorScheme.onInverseSurface.withOpacity(0.4),
|
||||
borderRadius: BorderRadius.circular(
|
||||
type == 'avatar'
|
||||
? 50
|
||||
: type == 'emote'
|
||||
? 0
|
||||
: StyleString.imgRadius.x,
|
||||
),
|
||||
borderRadius: type == 'avatar' || type == 'emote' || radius == 0
|
||||
? null
|
||||
: BorderRadius.circular(
|
||||
radius ?? StyleString.imgRadius.x,
|
||||
),
|
||||
),
|
||||
child: type == 'bg'
|
||||
? const SizedBox()
|
||||
|
||||
@@ -82,14 +82,14 @@ class VideoCardHMemberVideo extends StatelessWidget {
|
||||
width: maxWidth,
|
||||
height: maxHeight,
|
||||
),
|
||||
// if (videoItem.season != null)
|
||||
// PBadge(
|
||||
// text: '合集: ${videoItem.season?['count']}',
|
||||
// right: 6.0,
|
||||
// bottom: 6.0,
|
||||
// type: 'gray',
|
||||
// )
|
||||
// else
|
||||
if (videoItem.badges?.isNotEmpty == true)
|
||||
PBadge(
|
||||
text: videoItem.badges!
|
||||
.map((item) => item.text)
|
||||
.join('|'),
|
||||
right: 6.0,
|
||||
top: 6.0,
|
||||
),
|
||||
if (videoItem.duration != null)
|
||||
PBadge(
|
||||
text: Utils.timeFormat(videoItem.duration),
|
||||
|
||||
@@ -54,6 +54,7 @@ class ItemOrigModel {
|
||||
this.modules,
|
||||
this.type,
|
||||
this.visible,
|
||||
this.idStr,
|
||||
});
|
||||
|
||||
Map? basic;
|
||||
@@ -61,6 +62,7 @@ class ItemOrigModel {
|
||||
ItemModulesModel? modules;
|
||||
String? type;
|
||||
bool? visible;
|
||||
dynamic idStr;
|
||||
|
||||
ItemOrigModel.fromJson(Map<String, dynamic> json) {
|
||||
basic = json['basic'];
|
||||
@@ -68,6 +70,7 @@ class ItemOrigModel {
|
||||
modules = ItemModulesModel.fromJson(json['modules']);
|
||||
type = json['type'];
|
||||
visible = json['visible'];
|
||||
idStr = json['id_str'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -288,24 +288,29 @@ class BangumiIntroController extends CommonController {
|
||||
// 收藏至默认文件夹
|
||||
if (type == 'default') {
|
||||
SmartDialog.showLoading(msg: '请求中');
|
||||
await queryVideoInFolder();
|
||||
int defaultFolderId = favFolderData.value.list!.first.id!;
|
||||
int favStatus = favFolderData.value.list!.first.favState!;
|
||||
var result = await VideoHttp.favVideo(
|
||||
aid: epId,
|
||||
type: 24,
|
||||
addIds: favStatus == 0 ? '$defaultFolderId' : '',
|
||||
delIds: favStatus == 1 ? '$defaultFolderId' : '',
|
||||
);
|
||||
SmartDialog.dismiss();
|
||||
if (result['status']) {
|
||||
// 重新获取收藏状态
|
||||
await Future.delayed(const Duration(milliseconds: 255));
|
||||
await queryBangumiLikeCoinFav();
|
||||
SmartDialog.showToast('✅ 快速收藏/取消收藏成功');
|
||||
} else {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
}
|
||||
queryVideoInFolder().then((res) async {
|
||||
if (res['status']) {
|
||||
int defaultFolderId = favFolderData.value.list!.first.id!;
|
||||
int favStatus = favFolderData.value.list!.first.favState!;
|
||||
var result = await VideoHttp.favVideo(
|
||||
aid: epId,
|
||||
type: 24,
|
||||
addIds: favStatus == 0 ? '$defaultFolderId' : '',
|
||||
delIds: favStatus == 1 ? '$defaultFolderId' : '',
|
||||
);
|
||||
SmartDialog.dismiss();
|
||||
if (result['status']) {
|
||||
// 重新获取收藏状态
|
||||
await Future.delayed(const Duration(milliseconds: 255));
|
||||
await queryBangumiLikeCoinFav();
|
||||
SmartDialog.showToast('✅ 快速收藏/取消收藏成功');
|
||||
} else {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
}
|
||||
} else {
|
||||
SmartDialog.dismiss();
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
try {
|
||||
|
||||
@@ -72,7 +72,7 @@ class BangumiCardV extends StatelessWidget {
|
||||
child: Column(
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: const BorderRadius.all(StyleString.imgRadius),
|
||||
borderRadius: StyleString.mdRadius,
|
||||
child: AspectRatio(
|
||||
aspectRatio: 0.75,
|
||||
child: LayoutBuilder(builder: (context, boxConstraints) {
|
||||
|
||||
@@ -2,20 +2,13 @@ import 'package:PiliPlus/http/follow.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/tab/controller.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/tab/view.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/url_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPlus/http/dynamics.dart';
|
||||
import 'package:PiliPlus/http/search.dart';
|
||||
import 'package:PiliPlus/models/common/dynamics_type.dart';
|
||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||
import 'package:PiliPlus/models/dynamics/up.dart';
|
||||
import 'package:PiliPlus/models/live/item.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/id_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
|
||||
import '../../models/follow/result.dart';
|
||||
|
||||
@@ -68,165 +61,6 @@ class DynamicsController extends GetxController
|
||||
initialValue.value = value;
|
||||
}
|
||||
|
||||
pushDetail(item, floor, {action = 'all'}) async {
|
||||
feedBack();
|
||||
|
||||
/// 点击评论action 直接查看评论
|
||||
if (action == 'comment') {
|
||||
Utils.toDupNamed('/dynamicDetail',
|
||||
arguments: {'item': item, 'floor': floor, 'action': action});
|
||||
return false;
|
||||
}
|
||||
switch (item!.type) {
|
||||
/// 转发的动态
|
||||
case 'DYNAMIC_TYPE_FORWARD':
|
||||
Utils.toDupNamed('/dynamicDetail',
|
||||
arguments: {'item': item, 'floor': floor});
|
||||
break;
|
||||
|
||||
/// 图文动态查看
|
||||
case 'DYNAMIC_TYPE_DRAW':
|
||||
Utils.toDupNamed('/dynamicDetail',
|
||||
arguments: {'item': item, 'floor': floor});
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_AV':
|
||||
if (item.modules.moduleDynamic.major.archive.type == 2) {
|
||||
if (item.modules.moduleDynamic.major.archive.jumpUrl
|
||||
.startsWith('//')) {
|
||||
item.modules.moduleDynamic.major.archive.jumpUrl =
|
||||
'https:${item.modules.moduleDynamic.major.archive.jumpUrl}';
|
||||
}
|
||||
String? redirectUrl = await UrlUtils.parseRedirectUrl(
|
||||
item.modules.moduleDynamic.major.archive.jumpUrl, false);
|
||||
if (redirectUrl != null) {
|
||||
Utils.viewPgcFromUri(redirectUrl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
String bvid = item.modules.moduleDynamic.major.archive.bvid;
|
||||
String cover = item.modules.moduleDynamic.major.archive.cover;
|
||||
try {
|
||||
int cid = await SearchHttp.ab2c(bvid: bvid);
|
||||
Utils.toDupNamed(
|
||||
'/video?bvid=$bvid&cid=$cid',
|
||||
arguments: {
|
||||
'pic': cover,
|
||||
'heroTag': Utils.makeHeroTag(bvid),
|
||||
},
|
||||
);
|
||||
} catch (err) {
|
||||
SmartDialog.showToast(err.toString());
|
||||
}
|
||||
break;
|
||||
|
||||
/// 专栏文章查看
|
||||
case 'DYNAMIC_TYPE_ARTICLE':
|
||||
String title = item.modules.moduleDynamic.major.opus.title;
|
||||
String url = item.modules.moduleDynamic.major.opus.jumpUrl;
|
||||
if (url.contains('opus') || url.contains('read')) {
|
||||
RegExp digitRegExp = RegExp(r'\d+');
|
||||
Iterable<Match> matches = digitRegExp.allMatches(url);
|
||||
String number = matches.first.group(0)!;
|
||||
if (url.contains('read')) {
|
||||
number = 'cv$number';
|
||||
}
|
||||
Utils.toDupNamed('/htmlRender', parameters: {
|
||||
'url': url.startsWith('//') ? url.split('//').last : url,
|
||||
'title': title,
|
||||
'id': number,
|
||||
'dynamicType': url.split('//').last.split('/')[1]
|
||||
});
|
||||
} else {
|
||||
Utils.handleWebview('https:$url');
|
||||
}
|
||||
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_PGC':
|
||||
debugPrint('番剧');
|
||||
SmartDialog.showToast('暂未支持的类型,请联系开发者');
|
||||
break;
|
||||
|
||||
/// 纯文字动态查看
|
||||
case 'DYNAMIC_TYPE_WORD':
|
||||
debugPrint('纯文本');
|
||||
Utils.toDupNamed('/dynamicDetail',
|
||||
arguments: {'item': item, 'floor': floor});
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
||||
DynamicLiveModel liveRcmd = item.modules.moduleDynamic.major.liveRcmd;
|
||||
ModuleAuthorModel author = item.modules.moduleAuthor;
|
||||
LiveItemModel liveItem = LiveItemModel.fromJson({
|
||||
'title': liveRcmd.title,
|
||||
'uname': author.name,
|
||||
'cover': liveRcmd.cover,
|
||||
'mid': author.mid,
|
||||
'face': author.face,
|
||||
'roomid': liveRcmd.roomId,
|
||||
'watched_show': liveRcmd.watchedShow,
|
||||
});
|
||||
Utils.toDupNamed('/liveRoom?roomid=${liveItem.roomId}');
|
||||
break;
|
||||
|
||||
/// 合集查看
|
||||
case 'DYNAMIC_TYPE_UGC_SEASON':
|
||||
DynamicArchiveModel ugcSeason =
|
||||
item.modules.moduleDynamic.major.ugcSeason;
|
||||
int aid = ugcSeason.aid!;
|
||||
String bvid = IdUtils.av2bv(aid);
|
||||
String cover = ugcSeason.cover!;
|
||||
int cid = await SearchHttp.ab2c(bvid: bvid);
|
||||
Utils.toDupNamed(
|
||||
'/video?bvid=$bvid&cid=$cid',
|
||||
arguments: {
|
||||
'pic': cover,
|
||||
'heroTag': Utils.makeHeroTag(bvid),
|
||||
},
|
||||
);
|
||||
break;
|
||||
|
||||
/// 番剧查看
|
||||
case 'DYNAMIC_TYPE_PGC_UNION':
|
||||
debugPrint('DYNAMIC_TYPE_PGC_UNION 番剧');
|
||||
DynamicArchiveModel pgc = item.modules.moduleDynamic.major.pgc;
|
||||
if (pgc.epid != null) {
|
||||
Utils.viewBangumi(epId: pgc.epid);
|
||||
// SmartDialog.showLoading(msg: '获取中...');
|
||||
// var res = await SearchHttp.bangumiInfo(epId: pgc.epid);
|
||||
// SmartDialog.dismiss();
|
||||
// if (res['status']) {
|
||||
// // dynamic episode -> progress episode -> first episode
|
||||
// EpisodeItem episode = (res['data'].episodes as List)
|
||||
// .firstWhereOrNull(
|
||||
// (item) => item.epId == pgc.epid,
|
||||
// ) ??
|
||||
// (res['data'].episodes as List).firstWhereOrNull(
|
||||
// (item) =>
|
||||
// item.epId == res['data'].userStatus?.progress?.lastEpId,
|
||||
// ) ??
|
||||
// res['data'].episodes.first;
|
||||
// dynamic epId = episode.epId;
|
||||
// dynamic bvid = episode.bvid;
|
||||
// dynamic cid = episode.cid;
|
||||
// dynamic pic = episode.cover;
|
||||
// dynamic heroTag = Utils.makeHeroTag(cid);
|
||||
// Utils.toDupNamed(
|
||||
// '/video?bvid=$bvid&cid=$cid&seasonId=${res['data'].seasonId}&epId=$epId',
|
||||
// arguments: {
|
||||
// 'pic': pic,
|
||||
// 'heroTag': heroTag,
|
||||
// 'videoType': SearchType.media_bangumi,
|
||||
// 'bangumiItem': res['data'],
|
||||
// },
|
||||
// );
|
||||
// } else {
|
||||
// SmartDialog.showToast(res['msg']);
|
||||
// }
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Future queryFollowing2() async {
|
||||
if (allFollowedUps.length >= allFollowedUpsTotal) {
|
||||
SmartDialog.showToast('没有更多了');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// 操作栏
|
||||
|
||||
import 'package:PiliPlus/common/widgets/network_img_layer.dart';
|
||||
import 'package:PiliPlus/http/msg.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
@@ -11,7 +9,6 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPlus/http/dynamics.dart';
|
||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/index.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
|
||||
class ActionPanel extends StatefulWidget {
|
||||
@@ -26,8 +23,6 @@ class ActionPanel extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ActionPanelState extends State<ActionPanel> {
|
||||
final DynamicsController _dynamicsController = Get.put(DynamicsController());
|
||||
// late ModuleStatModel stat;
|
||||
bool isProcessing = false;
|
||||
void handleState(Future Function() action) async {
|
||||
if (isProcessing.not) {
|
||||
@@ -37,12 +32,6 @@ class _ActionPanelState extends State<ActionPanel> {
|
||||
}
|
||||
}
|
||||
|
||||
// @override
|
||||
// void initState() {
|
||||
// super.initState();
|
||||
// stat = widget.item!.modules.moduleStat;
|
||||
// }
|
||||
|
||||
// 动态点赞
|
||||
Future onLikeDynamic() async {
|
||||
feedBack();
|
||||
@@ -123,8 +112,8 @@ class _ActionPanelState extends State<ActionPanel> {
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: TextButton.icon(
|
||||
onPressed: () => _dynamicsController.pushDetail(widget.item, 1,
|
||||
action: 'comment'),
|
||||
onPressed: () =>
|
||||
Utils.pushDynDetail(widget.item, 1, action: 'comment'),
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.comment,
|
||||
size: 16,
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import 'package:PiliPlus/http/index.dart';
|
||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||
import 'package:PiliPlus/pages/member/view.dart' show radioWidget;
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPlus/common/widgets/network_img_layer.dart';
|
||||
@@ -82,7 +87,9 @@ class AuthorPanel extends StatelessWidget {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(item.modules.moduleAuthor.pubTime),
|
||||
Text(item is ItemOrigModel
|
||||
? Utils.dateFormat(item.modules.moduleAuthor.pubTs)
|
||||
: item.modules.moduleAuthor.pubTime),
|
||||
if (item.modules.moduleAuthor.pubTime != '' &&
|
||||
item.modules.moduleAuthor.pubAction != '')
|
||||
const Text(' '),
|
||||
@@ -132,10 +139,7 @@ class AuthorPanel extends StatelessWidget {
|
||||
useRootNavigator: true,
|
||||
isScrollControlled: true,
|
||||
builder: (context) {
|
||||
return MorePanel(
|
||||
item: item,
|
||||
onRemove: onRemove,
|
||||
);
|
||||
return morePanel(context);
|
||||
},
|
||||
);
|
||||
},
|
||||
@@ -145,19 +149,8 @@ class AuthorPanel extends StatelessWidget {
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MorePanel extends StatelessWidget {
|
||||
final dynamic item;
|
||||
final Function? onRemove;
|
||||
const MorePanel({
|
||||
super.key,
|
||||
required this.item,
|
||||
this.onRemove,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget morePanel(context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||
// clipBehavior: Clip.hardEdge,
|
||||
@@ -165,7 +158,7 @@ class MorePanel extends StatelessWidget {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () => Get.back(),
|
||||
onTap: Get.back,
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(28),
|
||||
topRight: Radius.circular(28),
|
||||
@@ -272,9 +265,28 @@ class MorePanel extends StatelessWidget {
|
||||
.titleSmall!
|
||||
.copyWith(color: Theme.of(context).colorScheme.error)),
|
||||
),
|
||||
if (GStorage.isLogin)
|
||||
ListTile(
|
||||
title: Text(
|
||||
'举报',
|
||||
style: Theme.of(context).textTheme.titleSmall!.copyWith(
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
),
|
||||
leading: Icon(
|
||||
Icons.error_outline_outlined,
|
||||
size: 19,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
onTap: () {
|
||||
Get.back();
|
||||
_showReportDynDialog(context);
|
||||
},
|
||||
minLeadingWidth: 0,
|
||||
),
|
||||
const Divider(thickness: 0.1, height: 1),
|
||||
ListTile(
|
||||
onTap: () => Get.back(),
|
||||
onTap: Get.back,
|
||||
minLeadingWidth: 0,
|
||||
dense: true,
|
||||
title: Text(
|
||||
@@ -287,4 +299,175 @@ class MorePanel extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showReportDynDialog(context) {
|
||||
_ReportReasonType? reasonType;
|
||||
String? reasonDesc;
|
||||
late final key = GlobalKey<FormState>();
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text(
|
||||
'举报动态',
|
||||
style: TextStyle(fontSize: 18),
|
||||
),
|
||||
titlePadding: const EdgeInsets.only(left: 22, top: 16, right: 22),
|
||||
contentPadding: const EdgeInsets.only(top: 5),
|
||||
actionsPadding:
|
||||
const EdgeInsets.only(left: 16, right: 16, bottom: 10),
|
||||
content: Builder(builder: (context) {
|
||||
return SingleChildScrollView(
|
||||
child: AnimatedSize(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 22,
|
||||
right: 22,
|
||||
bottom: 5,
|
||||
),
|
||||
child: const Text('请选择举报的理由:'),
|
||||
),
|
||||
...List.generate(
|
||||
_ReportReasonType.values.length ~/ 2,
|
||||
(index) => Row(
|
||||
children: List.generate(2, (index2) {
|
||||
return Expanded(
|
||||
child: radioWidget<_ReportReasonType>(
|
||||
paddingStart: index2 == 0 ? 10 : 0,
|
||||
value: _ReportReasonType
|
||||
.values[index * 2 + index2],
|
||||
groupValue: reasonType,
|
||||
title: _ReportReasonType
|
||||
.values[index * 2 + index2].title,
|
||||
onChanged: (value) {
|
||||
reasonType = value;
|
||||
if (context.mounted) {
|
||||
(context as Element?)?.markNeedsBuild();
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
if (reasonType == _ReportReasonType.s10) ...[
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 22),
|
||||
child: const Text('为帮助审核人员更快处理,请补充问题类型和出现位置等详细信息'),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 22,
|
||||
top: 5,
|
||||
right: 22,
|
||||
),
|
||||
child: Form(
|
||||
key: key,
|
||||
child: TextFormField(
|
||||
minLines: 4,
|
||||
maxLines: 4,
|
||||
initialValue: reasonDesc,
|
||||
inputFormatters: [
|
||||
LengthLimitingTextInputFormatter(60),
|
||||
],
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
contentPadding: EdgeInsets.all(10),
|
||||
),
|
||||
onChanged: (value) => reasonDesc = value,
|
||||
validator: (value) {
|
||||
if (value.isNullOrEmpty) {
|
||||
return '理由不能为空';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: Get.back,
|
||||
child: Text(
|
||||
'取消',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
if (reasonType == null) {
|
||||
return;
|
||||
}
|
||||
if (reasonType == _ReportReasonType.s10 &&
|
||||
key.currentState?.validate() != true) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
SmartDialog.showLoading();
|
||||
Request()
|
||||
.post(
|
||||
'https://api.bilibili.com/x/dynamic/feed/dynamic_report/add',
|
||||
queryParameters: {
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
data: {
|
||||
"accused_uid": item.modules.moduleAuthor.mid,
|
||||
"dynamic_id": item.idStr,
|
||||
"reason_type": reasonType!.code,
|
||||
"reason_desc": reasonType == _ReportReasonType.s10
|
||||
? reasonDesc
|
||||
: null,
|
||||
},
|
||||
options: Options(
|
||||
contentType: Headers.formUrlEncodedContentType,
|
||||
),
|
||||
)
|
||||
.then((res) {
|
||||
SmartDialog.dismiss();
|
||||
if (res.data['code'] == 0) {
|
||||
Get.back();
|
||||
SmartDialog.showToast('举报成功');
|
||||
} else {
|
||||
SmartDialog.showToast(res.data['message']);
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
debugPrint('failed to report dyn: $e');
|
||||
}
|
||||
},
|
||||
child: const Text('确定'),
|
||||
),
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
enum _ReportReasonType { s1, s2, s3, s4, s5, s6, s7, s8, s9, s10 }
|
||||
|
||||
extension _ReportReasonTypeExt on _ReportReasonType {
|
||||
String get title => [
|
||||
'垃圾广告',
|
||||
'引战',
|
||||
'色情',
|
||||
'人身攻击',
|
||||
'违法信息',
|
||||
'涉政谣言',
|
||||
'涉社会事件谣言',
|
||||
'虚假不实信息',
|
||||
'违法信息外链',
|
||||
'其他',
|
||||
][index];
|
||||
int get code => [4, 8, 1, 5, 3, 9, 10, 12, 13, 0][index];
|
||||
}
|
||||
|
||||
@@ -58,8 +58,8 @@ Widget content(context, item, source, callback) {
|
||||
fontSize: source == 'detail' ? 16 : 15,
|
||||
),
|
||||
richNodes,
|
||||
maxLines: source == 'detail' ? 999 : 6,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: source == 'detail' ? null : 6,
|
||||
overflow: source == 'detail' ? null : TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -65,8 +65,8 @@ class ContentGrpc extends StatelessWidget {
|
||||
/// fix 默认20px高度
|
||||
style: const TextStyle(height: 0),
|
||||
richNodes,
|
||||
maxLines: source == 'detail' ? 999 : 6,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: source == 'detail' ? null : 6,
|
||||
overflow: source == 'detail' ? null : TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:PiliPlus/common/widgets/image_save.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/index.dart';
|
||||
import 'action_panel.dart';
|
||||
import 'author_panel.dart';
|
||||
import 'content_panel.dart';
|
||||
@@ -12,7 +12,7 @@ class DynamicPanel extends StatelessWidget {
|
||||
final Function? onRemove;
|
||||
final Function(List<String>, int)? callback;
|
||||
|
||||
DynamicPanel({
|
||||
const DynamicPanel({
|
||||
required this.item,
|
||||
this.source,
|
||||
this.onRemove,
|
||||
@@ -20,11 +20,9 @@ class DynamicPanel extends StatelessWidget {
|
||||
super.key,
|
||||
});
|
||||
|
||||
final DynamicsController _dynamicsController = Get.put(DynamicsController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
return Padding(
|
||||
padding: source == 'detail'
|
||||
? const EdgeInsets.only(bottom: 12)
|
||||
: EdgeInsets.zero,
|
||||
@@ -46,7 +44,29 @@ class DynamicPanel extends StatelessWidget {
|
||||
child: InkWell(
|
||||
onTap: source == 'detail' && item.type != 'DYNAMIC_TYPE_AV'
|
||||
? null
|
||||
: () => _dynamicsController.pushDetail(item, 1),
|
||||
: () => Utils.pushDynDetail(item, 1),
|
||||
onLongPress: () {
|
||||
if (item.type == 'DYNAMIC_TYPE_AV') {
|
||||
imageSaveDialog(
|
||||
context: context,
|
||||
title: item.modules.moduleDynamic.major.archive.title,
|
||||
cover: item.modules.moduleDynamic.major.archive.cover,
|
||||
);
|
||||
} else if (item.type == 'DYNAMIC_TYPE_UGC_SEASON') {
|
||||
imageSaveDialog(
|
||||
context: context,
|
||||
title: item.modules.moduleDynamic.major.ugcSeason.title,
|
||||
cover: item.modules.moduleDynamic.major.ugcSeason.cover,
|
||||
);
|
||||
} else if (item.type == 'DYNAMIC_TYPE_PGC' ||
|
||||
item.type == 'DYNAMIC_TYPE_PGC_UNION') {
|
||||
imageSaveDialog(
|
||||
context: context,
|
||||
title: item.modules.moduleDynamic.major.pgc.title,
|
||||
cover: item.modules.moduleDynamic.major.pgc.cover,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
@@ -61,7 +81,7 @@ class DynamicPanel extends StatelessWidget {
|
||||
if (item!.modules!.moduleDynamic!.desc != null ||
|
||||
item!.modules!.moduleDynamic!.major != null)
|
||||
content(context, item, source, callback),
|
||||
forWard(item, context, _dynamicsController, source, callback),
|
||||
forWard(item, context, source, callback),
|
||||
const SizedBox(height: 2),
|
||||
if (source == null) ActionPanel(item: item),
|
||||
],
|
||||
|
||||
@@ -1,24 +1,21 @@
|
||||
import 'package:PiliPlus/grpc/app/dynamic/v2/dynamic.pb.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/widgets/author_panel_grpc.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/widgets/content_panel_grpc.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/index.dart';
|
||||
|
||||
class DynamicPanelGrpc extends StatelessWidget {
|
||||
final DynamicItem item;
|
||||
final String? source;
|
||||
final Function? onRemove;
|
||||
|
||||
DynamicPanelGrpc({
|
||||
const DynamicPanelGrpc({
|
||||
required this.item,
|
||||
this.source,
|
||||
this.onRemove,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final DynamicsController _dynamicsController = Get.put(DynamicsController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
@@ -43,7 +40,7 @@ class DynamicPanelGrpc extends StatelessWidget {
|
||||
child: InkWell(
|
||||
onTap: source == 'detail' && item.itemType == DynamicType.draw
|
||||
? null
|
||||
: () => _dynamicsController.pushDetail(item, 1),
|
||||
: () => Utils.pushDynDetail(item, 1),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// 转发
|
||||
import 'package:PiliPlus/common/widgets/image_save.dart';
|
||||
import 'package:PiliPlus/common/widgets/imageview.dart';
|
||||
import 'package:PiliPlus/common/widgets/network_img_layer.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -35,7 +36,7 @@ InlineSpan picsNodes(List<OpusPicsModel> pics, callback) {
|
||||
);
|
||||
}
|
||||
|
||||
Widget forWard(item, context, ctr, source, callback, {floor = 1}) {
|
||||
Widget forWard(item, context, source, callback, {floor = 1}) {
|
||||
TextStyle authorStyle =
|
||||
TextStyle(color: Theme.of(context).colorScheme.primary);
|
||||
|
||||
@@ -96,14 +97,18 @@ Widget forWard(item, context, ctr, source, callback, {floor = 1}) {
|
||||
Text.rich(
|
||||
richNodes,
|
||||
// 被转发状态(floor=2) 隐藏
|
||||
maxLines: source == 'detail' && floor != 2 ? 999 : 4,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: source == 'detail' && floor != 2 ? null : 4,
|
||||
overflow: source == 'detail' && floor != 2
|
||||
? null
|
||||
: TextOverflow.ellipsis,
|
||||
),
|
||||
if (hasPics) ...[
|
||||
Text.rich(
|
||||
picsNodes(pics, callback),
|
||||
// semanticsLabel: '动态图片',
|
||||
),
|
||||
if (item.modules.moduleDynamic.additional != null)
|
||||
const SizedBox(height: 4),
|
||||
],
|
||||
const SizedBox(height: 4),
|
||||
],
|
||||
@@ -140,13 +145,35 @@ Widget forWard(item, context, ctr, source, callback, {floor = 1}) {
|
||||
// 转发
|
||||
case 'DYNAMIC_TYPE_FORWARD':
|
||||
return InkWell(
|
||||
onTap: () => ctr.pushDetail(item.orig, floor + 1),
|
||||
onTap: () => Utils.pushDynDetail(item.orig, floor + 1),
|
||||
onLongPress: () {
|
||||
if (item.orig.type == 'DYNAMIC_TYPE_AV') {
|
||||
imageSaveDialog(
|
||||
context: context,
|
||||
title: item.orig.modules.moduleDynamic.major.archive.title,
|
||||
cover: item.orig.modules.moduleDynamic.major.archive.cover,
|
||||
);
|
||||
} else if (item.orig.type == 'DYNAMIC_TYPE_UGC_SEASON') {
|
||||
imageSaveDialog(
|
||||
context: context,
|
||||
title: item.orig.modules.moduleDynamic.major.ugcSeason.title,
|
||||
cover: item.orig.modules.moduleDynamic.major.ugcSeason.cover,
|
||||
);
|
||||
} else if (item.orig.type == 'DYNAMIC_TYPE_PGC' ||
|
||||
item.orig.type == 'DYNAMIC_TYPE_PGC_UNION') {
|
||||
imageSaveDialog(
|
||||
context: context,
|
||||
title: item.orig.modules.moduleDynamic.major.pgc.title,
|
||||
cover: item.orig.modules.moduleDynamic.major.pgc.cover,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 15, top: 10, right: 15, bottom: 8),
|
||||
color: Theme.of(context).dividerColor.withOpacity(0.08),
|
||||
child: forWard(item.orig, context, ctr, source, callback,
|
||||
floor: floor + 1),
|
||||
child:
|
||||
forWard(item.orig, context, source, callback, floor: floor + 1),
|
||||
),
|
||||
);
|
||||
// 直播
|
||||
@@ -189,8 +216,10 @@ Widget forWard(item, context, ctr, source, callback, {floor = 1}) {
|
||||
Text.rich(
|
||||
richNodes,
|
||||
// 被转发状态(floor=2) 隐藏
|
||||
maxLines: source == 'detail' && floor != 2 ? 999 : 4,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: source == 'detail' && floor != 2 ? null : 4,
|
||||
overflow: source == 'detail' && floor != 2
|
||||
? null
|
||||
: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -4,12 +4,10 @@ import 'package:PiliPlus/common/constants.dart';
|
||||
import 'package:PiliPlus/common/widgets/badge.dart';
|
||||
import 'package:PiliPlus/common/widgets/network_img_layer.dart';
|
||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/index.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
|
||||
import 'rich_node_panel.dart';
|
||||
|
||||
final DynamicsController _dynamicsController = Get.put(DynamicsController());
|
||||
Widget liveRcmdPanel(item, context, {floor = 1}) {
|
||||
TextStyle authorStyle =
|
||||
TextStyle(color: Theme.of(context).colorScheme.primary);
|
||||
@@ -65,7 +63,7 @@ Widget liveRcmdPanel(item, context, {floor = 1}) {
|
||||
const EdgeInsets.symmetric(horizontal: StyleString.safeSpace),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
_dynamicsController.pushDetail(item, floor);
|
||||
Utils.pushDynDetail(item, floor);
|
||||
},
|
||||
child: LayoutBuilder(builder: (context, box) {
|
||||
double width = box.maxWidth;
|
||||
@@ -74,8 +72,6 @@ Widget liveRcmdPanel(item, context, {floor = 1}) {
|
||||
Hero(
|
||||
tag: liveRcmd.roomId.toString(),
|
||||
child: NetworkImgLayer(
|
||||
radius: 12,
|
||||
type: floor == 1 ? 'emote' : null,
|
||||
width: width,
|
||||
height: width / StyleString.aspectRatio,
|
||||
src: item.modules.moduleDynamic.major.liveRcmd.cover,
|
||||
@@ -114,7 +110,7 @@ Widget liveRcmdPanel(item, context, {floor = 1}) {
|
||||
],
|
||||
),
|
||||
borderRadius: floor == 1
|
||||
? const BorderRadius.all(Radius.circular(12))
|
||||
? StyleString.mdRadius
|
||||
: const BorderRadius.all(Radius.circular(6))),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
|
||||
@@ -46,7 +46,7 @@ InlineSpan? richNode(item, context) {
|
||||
TextSpan(text: i.origText, style: const TextStyle(height: 1.65)));
|
||||
}
|
||||
// @用户
|
||||
if (i.type == 'RICH_TEXT_NODE_TYPE_AT') {
|
||||
else if (i.type == 'RICH_TEXT_NODE_TYPE_AT') {
|
||||
spanChildren.add(
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
@@ -67,7 +67,7 @@ InlineSpan? richNode(item, context) {
|
||||
);
|
||||
}
|
||||
// 话题
|
||||
if (i.type == 'RICH_TEXT_NODE_TYPE_TOPIC') {
|
||||
else if (i.type == 'RICH_TEXT_NODE_TYPE_TOPIC') {
|
||||
spanChildren.add(
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
@@ -82,7 +82,7 @@ InlineSpan? richNode(item, context) {
|
||||
);
|
||||
}
|
||||
// 网页链接
|
||||
if (i.type == 'RICH_TEXT_NODE_TYPE_WEB') {
|
||||
else if (i.type == 'RICH_TEXT_NODE_TYPE_WEB') {
|
||||
spanChildren.add(
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
@@ -121,7 +121,7 @@ InlineSpan? richNode(item, context) {
|
||||
);
|
||||
}
|
||||
// 投票
|
||||
if (i.type == 'RICH_TEXT_NODE_TYPE_VOTE') {
|
||||
else if (i.type == 'RICH_TEXT_NODE_TYPE_VOTE') {
|
||||
spanChildren.add(
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
@@ -149,7 +149,7 @@ InlineSpan? richNode(item, context) {
|
||||
);
|
||||
}
|
||||
// 表情
|
||||
if (i.type == 'RICH_TEXT_NODE_TYPE_EMOJI' && i.emoji != null) {
|
||||
else if (i.type == 'RICH_TEXT_NODE_TYPE_EMOJI' && i.emoji != null) {
|
||||
spanChildren.add(
|
||||
WidgetSpan(
|
||||
child: NetworkImgLayer(
|
||||
@@ -162,7 +162,7 @@ InlineSpan? richNode(item, context) {
|
||||
);
|
||||
}
|
||||
// 抽奖
|
||||
if (i.type == 'RICH_TEXT_NODE_TYPE_LOTTERY') {
|
||||
else if (i.type == 'RICH_TEXT_NODE_TYPE_LOTTERY') {
|
||||
spanChildren.add(
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
@@ -196,7 +196,7 @@ InlineSpan? richNode(item, context) {
|
||||
}
|
||||
|
||||
/// TODO 商品
|
||||
if (i.type == 'RICH_TEXT_NODE_TYPE_GOODS') {
|
||||
else if (i.type == 'RICH_TEXT_NODE_TYPE_GOODS') {
|
||||
spanChildren.add(
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
@@ -221,7 +221,7 @@ InlineSpan? richNode(item, context) {
|
||||
);
|
||||
}
|
||||
// 投稿
|
||||
if (i.type == 'RICH_TEXT_NODE_TYPE_BV') {
|
||||
else if (i.type == 'RICH_TEXT_NODE_TYPE_BV') {
|
||||
spanChildren.add(
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// 视频or合集
|
||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPlus/common/constants.dart';
|
||||
@@ -25,6 +26,88 @@ Widget videoSeasonWidget(item, context, type, {floor = 1}) {
|
||||
};
|
||||
dynamic content = dynamicProperty[type];
|
||||
InlineSpan? richNodes = richNode(item, context);
|
||||
|
||||
Widget buildCover() {
|
||||
return LayoutBuilder(builder: (context, box) {
|
||||
double width = box.maxWidth;
|
||||
return Stack(
|
||||
children: [
|
||||
// Hero(
|
||||
// tag: content.bvid,
|
||||
// child:
|
||||
NetworkImgLayer(
|
||||
width: width,
|
||||
height: width / StyleString.aspectRatio,
|
||||
src: content.cover,
|
||||
semanticsLabel: content.title,
|
||||
),
|
||||
// ),
|
||||
if (content?.badge?['text'] != null)
|
||||
PBadge(
|
||||
text: content.badge['text'],
|
||||
top: 8.0,
|
||||
right: 10.0,
|
||||
bottom: null,
|
||||
left: null,
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
child: Container(
|
||||
height: 70,
|
||||
padding: const EdgeInsets.fromLTRB(10, 0, 8, 8),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: <Color>[
|
||||
Colors.transparent,
|
||||
Colors.black54,
|
||||
],
|
||||
),
|
||||
borderRadius: StyleString.mdRadius,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
DefaultTextStyle.merge(
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||
color: Colors.white),
|
||||
child: Row(
|
||||
children: [
|
||||
if (content.durationText != null)
|
||||
Text(
|
||||
content.durationText,
|
||||
semanticsLabel:
|
||||
'时长${Utils.durationReadFormat(content.durationText)}',
|
||||
),
|
||||
if (content.durationText != null)
|
||||
const SizedBox(width: 6),
|
||||
Text(content.stat.play + '次围观'),
|
||||
const SizedBox(width: 6),
|
||||
Text(content.stat.danmu + '条弹幕')
|
||||
],
|
||||
),
|
||||
),
|
||||
Image.asset(
|
||||
'assets/images/play.png',
|
||||
width: 50,
|
||||
height: 50,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
@@ -76,89 +159,13 @@ Widget videoSeasonWidget(item, context, type, {floor = 1}) {
|
||||
if (richNodes != null) Text.rich(richNodes),
|
||||
const SizedBox(height: 6),
|
||||
],
|
||||
Padding(
|
||||
if (item is ItemOrigModel)
|
||||
buildCover()
|
||||
else
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: StyleString.safeSpace),
|
||||
child: LayoutBuilder(builder: (context, box) {
|
||||
double width = box.maxWidth;
|
||||
return Stack(
|
||||
children: [
|
||||
// Hero(
|
||||
// tag: content.bvid,
|
||||
// child:
|
||||
NetworkImgLayer(
|
||||
type: null,
|
||||
width: width,
|
||||
height: width / StyleString.aspectRatio,
|
||||
src: content.cover,
|
||||
semanticsLabel: content.title,
|
||||
),
|
||||
// ),
|
||||
if (content.badge != null && type == 'pgc')
|
||||
PBadge(
|
||||
text: content.badge['text'],
|
||||
top: 8.0,
|
||||
right: 10.0,
|
||||
bottom: null,
|
||||
left: null,
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
child: Container(
|
||||
height: 70,
|
||||
padding: const EdgeInsets.fromLTRB(10, 0, 8, 8),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: <Color>[
|
||||
Colors.transparent,
|
||||
Colors.black54,
|
||||
],
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(StyleString.imgRadius.x)),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
DefaultTextStyle.merge(
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context)
|
||||
.textTheme
|
||||
.labelMedium!
|
||||
.fontSize,
|
||||
color: Colors.white),
|
||||
child: Row(
|
||||
children: [
|
||||
if (content.durationText != null)
|
||||
Text(
|
||||
content.durationText,
|
||||
semanticsLabel:
|
||||
'时长${Utils.durationReadFormat(content.durationText)}',
|
||||
),
|
||||
if (content.durationText != null)
|
||||
const SizedBox(width: 6),
|
||||
Text(content.stat.play + '次围观'),
|
||||
const SizedBox(width: 6),
|
||||
Text(content.stat.danmu + '条弹幕')
|
||||
],
|
||||
),
|
||||
),
|
||||
Image.asset(
|
||||
'assets/images/play.png',
|
||||
width: 50,
|
||||
height: 50,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
})),
|
||||
child: buildCover(),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Padding(
|
||||
padding: floor == 1
|
||||
|
||||
@@ -70,8 +70,8 @@ class _LivePageState extends State<LivePage>
|
||||
clipBehavior: Clip.hardEdge,
|
||||
margin: const EdgeInsets.only(
|
||||
left: StyleString.safeSpace, right: StyleString.safeSpace),
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(StyleString.imgRadius),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: StyleString.mdRadius,
|
||||
),
|
||||
child: refreshIndicator(
|
||||
onRefresh: () async {
|
||||
|
||||
@@ -33,7 +33,7 @@ class LiveCardV extends StatelessWidget {
|
||||
child: Column(
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: const BorderRadius.all(StyleString.imgRadius),
|
||||
borderRadius: StyleString.mdRadius,
|
||||
child: AspectRatio(
|
||||
aspectRatio: StyleString.aspectRatio,
|
||||
child: LayoutBuilder(builder: (context, boxConstraints) {
|
||||
|
||||
@@ -33,7 +33,7 @@ class LiveCardVFollow extends StatelessWidget {
|
||||
child: Column(
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: const BorderRadius.all(StyleString.imgRadius),
|
||||
borderRadius: StyleString.mdRadius,
|
||||
child: AspectRatio(
|
||||
aspectRatio: StyleString.aspectRatio,
|
||||
child: LayoutBuilder(builder: (context, boxConstraints) {
|
||||
|
||||
@@ -77,6 +77,37 @@ class _BottomControlState extends State<BottomControl> {
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(width: 4),
|
||||
Obx(
|
||||
() => Container(
|
||||
height: 30,
|
||||
margin: const EdgeInsets.symmetric(horizontal: 10),
|
||||
alignment: Alignment.center,
|
||||
child: PopupMenuButton<BoxFit>(
|
||||
onSelected: widget.controller.toggleVideoFit,
|
||||
initialValue: widget.controller.videoFit.value,
|
||||
color: Colors.black.withOpacity(0.8),
|
||||
itemBuilder: (BuildContext context) {
|
||||
return BoxFit.values.map((BoxFit boxFit) {
|
||||
return PopupMenuItem<BoxFit>(
|
||||
height: 35,
|
||||
padding: const EdgeInsets.only(left: 30),
|
||||
value: boxFit,
|
||||
child: Text(
|
||||
"${PlPlayerController.videoFitType[boxFit.index]['desc']}",
|
||||
style:
|
||||
const TextStyle(color: Colors.white, fontSize: 13),
|
||||
),
|
||||
);
|
||||
}).toList();
|
||||
},
|
||||
child: Text(
|
||||
"${PlPlayerController.videoFitType[widget.controller.videoFit.value.index]['desc']}",
|
||||
style: const TextStyle(color: Colors.white, fontSize: 13),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
if (Platform.isAndroid) ...[
|
||||
SizedBox(
|
||||
width: 34,
|
||||
@@ -103,7 +134,7 @@ class _BottomControlState extends State<BottomControl> {
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
const SizedBox(width: 10),
|
||||
],
|
||||
Obx(
|
||||
() => SizedBox(
|
||||
|
||||
@@ -581,13 +581,13 @@ class _ReportPanelState extends State<ReportPanel> {
|
||||
const Text('举报理由(单选,非必选)'),
|
||||
...List.generate(
|
||||
5,
|
||||
(index) => _radioWidget(
|
||||
index,
|
||||
_reasonV2,
|
||||
(value) {
|
||||
(index) => radioWidget<int>(
|
||||
value: index,
|
||||
groupValue: _reasonV2,
|
||||
onChanged: (value) {
|
||||
setState(() => _reasonV2 = value);
|
||||
},
|
||||
['色情低俗', '不实信息', '违禁', '人身攻击', '赌博诈骗'][index],
|
||||
title: const ['色情低俗', '不实信息', '违禁', '人身攻击', '赌博诈骗'][index],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
@@ -650,16 +650,18 @@ Widget _checkBoxWidget(
|
||||
);
|
||||
}
|
||||
|
||||
Widget _radioWidget(
|
||||
int value,
|
||||
int? groupValue,
|
||||
ValueChanged onChanged,
|
||||
String title,
|
||||
) {
|
||||
Widget radioWidget<T>({
|
||||
required T value,
|
||||
T? groupValue,
|
||||
required ValueChanged onChanged,
|
||||
required String title,
|
||||
double? paddingStart,
|
||||
}) {
|
||||
return InkWell(
|
||||
onTap: () => onChanged(value),
|
||||
child: Row(
|
||||
children: [
|
||||
if (paddingStart != null) SizedBox(width: paddingStart),
|
||||
Radio(
|
||||
value: value,
|
||||
groupValue: groupValue,
|
||||
|
||||
@@ -64,8 +64,8 @@ class _RcmdPageState extends State<RcmdPage>
|
||||
clipBehavior: Clip.hardEdge,
|
||||
margin: const EdgeInsets.only(
|
||||
left: StyleString.safeSpace, right: StyleString.safeSpace),
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(StyleString.imgRadius),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: StyleString.mdRadius,
|
||||
),
|
||||
child: refreshIndicator(
|
||||
onRefresh: () async {
|
||||
|
||||
@@ -391,22 +391,27 @@ class VideoIntroController extends GetxController
|
||||
// 收藏至默认文件夹
|
||||
if (type == 'default') {
|
||||
SmartDialog.showLoading(msg: '请求中');
|
||||
await queryVideoInFolder();
|
||||
int defaultFolderId = favFolderData.value.list!.first.id!;
|
||||
int favStatus = favFolderData.value.list!.first.favState!;
|
||||
var result = await VideoHttp.favVideo(
|
||||
aid: IdUtils.bv2av(bvid),
|
||||
addIds: favStatus == 0 ? '$defaultFolderId' : '',
|
||||
delIds: favStatus == 1 ? '$defaultFolderId' : '',
|
||||
);
|
||||
SmartDialog.dismiss();
|
||||
if (result['status']) {
|
||||
// 重新获取收藏状态
|
||||
await queryHasFavVideo();
|
||||
SmartDialog.showToast('✅ 快速收藏/取消收藏成功');
|
||||
} else {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
}
|
||||
queryVideoInFolder().then((res) async {
|
||||
if (res['status']) {
|
||||
int defaultFolderId = favFolderData.value.list!.first.id!;
|
||||
int favStatus = favFolderData.value.list!.first.favState!;
|
||||
var result = await VideoHttp.favVideo(
|
||||
aid: IdUtils.bv2av(bvid),
|
||||
addIds: favStatus == 0 ? '$defaultFolderId' : '',
|
||||
delIds: favStatus == 1 ? '$defaultFolderId' : '',
|
||||
);
|
||||
SmartDialog.dismiss();
|
||||
if (result['status']) {
|
||||
// 重新获取收藏状态
|
||||
await queryHasFavVideo();
|
||||
SmartDialog.showToast('✅ 快速收藏/取消收藏成功');
|
||||
} else {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
}
|
||||
} else {
|
||||
SmartDialog.dismiss();
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
try {
|
||||
|
||||
@@ -15,6 +15,8 @@ import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/models/bangumi/info.dart';
|
||||
import 'package:PiliPlus/models/common/dynamics_type.dart';
|
||||
import 'package:PiliPlus/models/common/search_type.dart';
|
||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||
import 'package:PiliPlus/models/live/item.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/controller.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/tab/controller.dart';
|
||||
import 'package:PiliPlus/pages/home/controller.dart';
|
||||
@@ -24,7 +26,9 @@ import 'package:PiliPlus/pages/mine/controller.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/introduction/widgets/group_panel.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/id_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/url_utils.dart';
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -43,6 +47,165 @@ class Utils {
|
||||
|
||||
static const channel = MethodChannel("PiliPlus");
|
||||
|
||||
static void pushDynDetail(item, floor, {action = 'all'}) async {
|
||||
feedBack();
|
||||
|
||||
/// 点击评论action 直接查看评论
|
||||
if (action == 'comment') {
|
||||
Utils.toDupNamed('/dynamicDetail',
|
||||
arguments: {'item': item, 'floor': floor, 'action': action});
|
||||
return;
|
||||
}
|
||||
switch (item!.type) {
|
||||
/// 转发的动态
|
||||
case 'DYNAMIC_TYPE_FORWARD':
|
||||
Utils.toDupNamed('/dynamicDetail',
|
||||
arguments: {'item': item, 'floor': floor});
|
||||
break;
|
||||
|
||||
/// 图文动态查看
|
||||
case 'DYNAMIC_TYPE_DRAW':
|
||||
Utils.toDupNamed('/dynamicDetail',
|
||||
arguments: {'item': item, 'floor': floor});
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_AV':
|
||||
if (item.modules.moduleDynamic.major.archive.type == 2) {
|
||||
if (item.modules.moduleDynamic.major.archive.jumpUrl
|
||||
.startsWith('//')) {
|
||||
item.modules.moduleDynamic.major.archive.jumpUrl =
|
||||
'https:${item.modules.moduleDynamic.major.archive.jumpUrl}';
|
||||
}
|
||||
String? redirectUrl = await UrlUtils.parseRedirectUrl(
|
||||
item.modules.moduleDynamic.major.archive.jumpUrl, false);
|
||||
if (redirectUrl != null) {
|
||||
Utils.viewPgcFromUri(redirectUrl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
String bvid = item.modules.moduleDynamic.major.archive.bvid;
|
||||
String cover = item.modules.moduleDynamic.major.archive.cover;
|
||||
try {
|
||||
int cid = await SearchHttp.ab2c(bvid: bvid);
|
||||
Utils.toDupNamed(
|
||||
'/video?bvid=$bvid&cid=$cid',
|
||||
arguments: {
|
||||
'pic': cover,
|
||||
'heroTag': Utils.makeHeroTag(bvid),
|
||||
},
|
||||
);
|
||||
} catch (err) {
|
||||
SmartDialog.showToast(err.toString());
|
||||
}
|
||||
break;
|
||||
|
||||
/// 专栏文章查看
|
||||
case 'DYNAMIC_TYPE_ARTICLE':
|
||||
String title = item.modules.moduleDynamic.major.opus.title;
|
||||
String url = item.modules.moduleDynamic.major.opus.jumpUrl;
|
||||
if (url.contains('opus') || url.contains('read')) {
|
||||
RegExp digitRegExp = RegExp(r'\d+');
|
||||
Iterable<Match> matches = digitRegExp.allMatches(url);
|
||||
String number = matches.first.group(0)!;
|
||||
if (url.contains('read')) {
|
||||
number = 'cv$number';
|
||||
}
|
||||
Utils.toDupNamed('/htmlRender', parameters: {
|
||||
'url': url.startsWith('//') ? url.split('//').last : url,
|
||||
'title': title,
|
||||
'id': number,
|
||||
'dynamicType': url.split('//').last.split('/')[1]
|
||||
});
|
||||
} else {
|
||||
Utils.handleWebview('https:$url');
|
||||
}
|
||||
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_PGC':
|
||||
debugPrint('番剧');
|
||||
SmartDialog.showToast('暂未支持的类型,请联系开发者');
|
||||
break;
|
||||
|
||||
/// 纯文字动态查看
|
||||
case 'DYNAMIC_TYPE_WORD':
|
||||
debugPrint('纯文本');
|
||||
Utils.toDupNamed('/dynamicDetail',
|
||||
arguments: {'item': item, 'floor': floor});
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
||||
DynamicLiveModel liveRcmd = item.modules.moduleDynamic.major.liveRcmd;
|
||||
ModuleAuthorModel author = item.modules.moduleAuthor;
|
||||
LiveItemModel liveItem = LiveItemModel.fromJson({
|
||||
'title': liveRcmd.title,
|
||||
'uname': author.name,
|
||||
'cover': liveRcmd.cover,
|
||||
'mid': author.mid,
|
||||
'face': author.face,
|
||||
'roomid': liveRcmd.roomId,
|
||||
'watched_show': liveRcmd.watchedShow,
|
||||
});
|
||||
Utils.toDupNamed('/liveRoom?roomid=${liveItem.roomId}');
|
||||
break;
|
||||
|
||||
/// 合集查看
|
||||
case 'DYNAMIC_TYPE_UGC_SEASON':
|
||||
DynamicArchiveModel ugcSeason =
|
||||
item.modules.moduleDynamic.major.ugcSeason;
|
||||
int aid = ugcSeason.aid!;
|
||||
String bvid = IdUtils.av2bv(aid);
|
||||
String cover = ugcSeason.cover!;
|
||||
int cid = await SearchHttp.ab2c(bvid: bvid);
|
||||
Utils.toDupNamed(
|
||||
'/video?bvid=$bvid&cid=$cid',
|
||||
arguments: {
|
||||
'pic': cover,
|
||||
'heroTag': Utils.makeHeroTag(bvid),
|
||||
},
|
||||
);
|
||||
break;
|
||||
|
||||
/// 番剧查看
|
||||
case 'DYNAMIC_TYPE_PGC_UNION':
|
||||
debugPrint('DYNAMIC_TYPE_PGC_UNION 番剧');
|
||||
DynamicArchiveModel pgc = item.modules.moduleDynamic.major.pgc;
|
||||
if (pgc.epid != null) {
|
||||
Utils.viewBangumi(epId: pgc.epid);
|
||||
// SmartDialog.showLoading(msg: '获取中...');
|
||||
// var res = await SearchHttp.bangumiInfo(epId: pgc.epid);
|
||||
// SmartDialog.dismiss();
|
||||
// if (res['status']) {
|
||||
// // dynamic episode -> progress episode -> first episode
|
||||
// EpisodeItem episode = (res['data'].episodes as List)
|
||||
// .firstWhereOrNull(
|
||||
// (item) => item.epId == pgc.epid,
|
||||
// ) ??
|
||||
// (res['data'].episodes as List).firstWhereOrNull(
|
||||
// (item) =>
|
||||
// item.epId == res['data'].userStatus?.progress?.lastEpId,
|
||||
// ) ??
|
||||
// res['data'].episodes.first;
|
||||
// dynamic epId = episode.epId;
|
||||
// dynamic bvid = episode.bvid;
|
||||
// dynamic cid = episode.cid;
|
||||
// dynamic pic = episode.cover;
|
||||
// dynamic heroTag = Utils.makeHeroTag(cid);
|
||||
// Utils.toDupNamed(
|
||||
// '/video?bvid=$bvid&cid=$cid&seasonId=${res['data'].seasonId}&epId=$epId',
|
||||
// arguments: {
|
||||
// 'pic': pic,
|
||||
// 'heroTag': heroTag,
|
||||
// 'videoType': SearchType.media_bangumi,
|
||||
// 'bangumiItem': res['data'],
|
||||
// },
|
||||
// );
|
||||
// } else {
|
||||
// SmartDialog.showToast(res['msg']);
|
||||
// }
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void onHorizontalPreview(GlobalKey<ScaffoldState> key,
|
||||
transitionAnimationController, ctr, imgList, index, onClose) {
|
||||
key.currentState?.showBottomSheet(
|
||||
|
||||
@@ -27,7 +27,7 @@ class VideoUtils {
|
||||
}
|
||||
}
|
||||
if (defaultCDNService == CDNService.baseUrl.code) {
|
||||
return item.baseUrl.isNullOrEmpty.not
|
||||
return (item.baseUrl as String?).isNullOrEmpty.not
|
||||
? item.baseUrl
|
||||
: item.backupUrl ?? "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user