Merge branch 'fix' into alpha

This commit is contained in:
guozhigq
2023-08-31 09:56:15 +08:00
6 changed files with 31 additions and 17 deletions

View File

@ -128,7 +128,8 @@ class VideoItem {
VideoItem.fromJson(Map<String, dynamic> json) { VideoItem.fromJson(Map<String, dynamic> json) {
id = json['id']; id = json['id'];
baseUrl = json['baseUrl']; baseUrl = json['baseUrl'];
backupUrl = json['backupUrl'].toList().first; backupUrl =
json['backupUrl'] != null ? json['backupUrl'].toList().first : '';
bandWidth = json['bandWidth']; bandWidth = json['bandWidth'];
mimeType = json['mime_type']; mimeType = json['mime_type'];
codecs = json['codecs']; codecs = json['codecs'];
@ -179,7 +180,8 @@ class AudioItem {
AudioItem.fromJson(Map<String, dynamic> json) { AudioItem.fromJson(Map<String, dynamic> json) {
id = json['id']; id = json['id'];
baseUrl = json['baseUrl']; baseUrl = json['baseUrl'];
backupUrl = json['backupUrl'].toList().first; backupUrl =
json['backupUrl'] != null ? json['backupUrl'].toList().first : '';
bandWidth = json['bandWidth']; bandWidth = json['bandWidth'];
mimeType = json['mime_type']; mimeType = json['mime_type'];
codecs = json['codecs']; codecs = json['codecs'];

View File

@ -42,13 +42,17 @@ Widget articlePanel(item, context, {floor = 1}) {
.copyWith(fontWeight: FontWeight.bold), .copyWith(fontWeight: FontWeight.bold),
), ),
const SizedBox(height: 2), const SizedBox(height: 2),
if (item.modules.moduleDynamic.major.opus.summary.text != 'undefined') if (item.modules.moduleDynamic.major.opus.summary.text !=
'undefined') ...[
Text( Text(
item.modules.moduleDynamic.major.opus.summary.richTextNodes.first item.modules.moduleDynamic.major.opus.summary.richTextNodes.first
.text, .text,
maxLines: 4, maxLines: 4,
style: const TextStyle(height: 1.55),
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
const SizedBox(height: 2),
],
picWidget(item, context) picWidget(item, context)
], ],
), ),

View File

@ -44,27 +44,25 @@ Widget picWidget(item, context) {
double maxWidth = box.maxWidth; double maxWidth = box.maxWidth;
double aspectRatio = 1.0; double aspectRatio = 1.0;
double origAspectRatio = 0.0; double origAspectRatio = 0.0;
double crossCount = len == 1 double crossCount = 3;
? 1
: len < 3
? 2
: 3;
double height = 0.0; double height = 0.0;
if (len == 1) { if (len == 1) {
origAspectRatio = try {
aspectRatio = pictures.first.width / pictures.first.height; origAspectRatio =
aspectRatio = pictures.first.width / pictures.first.height;
} catch (_) {}
if (aspectRatio < 0.4) { if (aspectRatio < 0.4) {
aspectRatio = 0.4; aspectRatio = 0.4;
} }
height = pictures.first.height * maxWidth / pictures.first.width;
if (origAspectRatio < 0.5 || pictures.first.width < 1920) { if (origAspectRatio < 0.5 || pictures.first.width < 1920) {
crossCount = 2; crossCount = 2;
height = maxWidth / 2 / aspectRatio; height = maxWidth / 2 / aspectRatio;
} }
} else { } else {
aspectRatio = 1; aspectRatio = 1;
height = maxWidth / crossCount * ((len / crossCount).ceil()) + 6; height =
maxWidth / crossCount * ((len + crossCount - 1) ~/ crossCount) + 6;
} }
return Container( return Container(
padding: const EdgeInsets.only(top: 4), padding: const EdgeInsets.only(top: 4),

View File

@ -56,9 +56,19 @@ class SearchPanelController extends GetxController {
// 匹配输入内容如果是AV、BV号且有结果 直接跳转详情页 // 匹配输入内容如果是AV、BV号且有结果 直接跳转详情页
Map matchRes = IdUtils.matchAvorBv(input: keyword); Map matchRes = IdUtils.matchAvorBv(input: keyword);
List matchKeys = matchRes.keys.toList(); List matchKeys = matchRes.keys.toList();
String bvid = resultList.first.bvid; String? bvid;
try {
bvid = resultList.first.bvid;
} catch (_) {
bvid = null;
}
// keyword 可能输入纯数字 // keyword 可能输入纯数字
int aid = resultList.first.aid; int? aid;
try {
aid = resultList.first.aid;
} catch (_) {
aid = null;
}
if (matchKeys.isNotEmpty && searchType == SearchType.video || if (matchKeys.isNotEmpty && searchType == SearchType.video ||
aid.toString() == keyword) { aid.toString() == keyword) {
String heroTag = Utils.makeHeroTag(bvid); String heroTag = Utils.makeHeroTag(bvid);

View File

@ -55,7 +55,7 @@ class VideoIntroController extends GetxController {
// 同时观看 // 同时观看
bool isShowOnlineTotal = false; bool isShowOnlineTotal = false;
RxInt totel = 1.obs; RxString total = '1'.obs;
Timer? timer; Timer? timer;
bool isPaused = false; bool isPaused = false;
@ -474,7 +474,7 @@ class VideoIntroController extends GetxController {
cid: lastPlayCid.value, cid: lastPlayCid.value,
); );
if (result['status']) { if (result['status']) {
totel.value = int.parse(result['data']['total']); total.value = result['data']['total'];
} }
} }

View File

@ -312,7 +312,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
if (videoIntroController.isShowOnlineTotal) if (videoIntroController.isShowOnlineTotal)
Obx( Obx(
() => Text( () => Text(
'${videoIntroController.totel.value}人在看', '${videoIntroController.total.value}人在看',
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
color: t.colorScheme.outline, color: t.colorScheme.outline,