mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-17 06:40:13 +08:00
opt: push dyn
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
import 'package:PiliPlus/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart'
|
import 'package:PiliPlus/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart'
|
||||||
show SourceModel;
|
show SourceModel;
|
||||||
import 'package:PiliPlus/utils/extension.dart';
|
import 'package:PiliPlus/utils/extension.dart';
|
||||||
|
import 'package:PiliPlus/utils/utils.dart';
|
||||||
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_html/flutter_html.dart';
|
import 'package:flutter_html/flutter_html.dart';
|
||||||
import 'network_img_layer.dart';
|
import 'network_img_layer.dart';
|
||||||
@@ -43,16 +45,16 @@ Widget htmlRender({
|
|||||||
// width: isEmote ? 22 : null,
|
// width: isEmote ? 22 : null,
|
||||||
// height: isEmote ? 22 : null,
|
// height: isEmote ? 22 : null,
|
||||||
// );
|
// );
|
||||||
|
String? clazz = attributes['class'];
|
||||||
String? height = RegExp(r'max-height:(\d+)px')
|
String? height = RegExp(r'max-height:(\d+)px')
|
||||||
.firstMatch('${attributes['style']}')
|
.firstMatch('${attributes['style']}')
|
||||||
?.group(1);
|
?.group(1);
|
||||||
if (height != null) {
|
if (clazz?.contains('cut-off') == true || height != null) {
|
||||||
return NetworkImgLayer(
|
return CachedNetworkImage(
|
||||||
width: constrainedWidth,
|
width: constrainedWidth,
|
||||||
height: double.parse(height),
|
height: height != null ? double.parse(height) : null,
|
||||||
src: imgUrl,
|
imageUrl: Utils.thumbnailImgUrl(imgUrl),
|
||||||
type: 'emote',
|
fit: BoxFit.contain,
|
||||||
boxFit: BoxFit.contain,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Hero(
|
return Hero(
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import 'package:get/get.dart';
|
|||||||
import '../../models/home/rcmd/result.dart';
|
import '../../models/home/rcmd/result.dart';
|
||||||
import '../../models/model_rec_video_item.dart';
|
import '../../models/model_rec_video_item.dart';
|
||||||
import 'stat/stat.dart';
|
import 'stat/stat.dart';
|
||||||
import '../../http/dynamics.dart';
|
|
||||||
import '../../utils/id_utils.dart';
|
import '../../utils/id_utils.dart';
|
||||||
import '../../utils/utils.dart';
|
import '../../utils/utils.dart';
|
||||||
import '../constants.dart';
|
import '../constants.dart';
|
||||||
@@ -67,20 +66,9 @@ class VideoCardV extends StatelessWidget {
|
|||||||
id = 'cv${videoItem.param}';
|
id = 'cv${videoItem.param}';
|
||||||
}
|
}
|
||||||
if (uri.startsWith('http')) {
|
if (uri.startsWith('http')) {
|
||||||
String path = Uri.parse(uri).path;
|
String id = Uri.parse(uri).path.split('/')[1];
|
||||||
if (isStringNumeric(path.split('/')[1])) {
|
if (isStringNumeric(id)) {
|
||||||
// 请求接口
|
Utils.pushDynFromId(id);
|
||||||
var res =
|
|
||||||
await DynamicsHttp.dynamicDetail(id: path.split('/')[1]);
|
|
||||||
if (res['status']) {
|
|
||||||
Get.toNamed('/dynamicDetail', arguments: {
|
|
||||||
'item': res['data'],
|
|
||||||
'floor': 1,
|
|
||||||
'action': 'detail'
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
SmartDialog.showToast(res['msg']);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,14 +116,12 @@ class DynamicsHttp {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
return {
|
return {
|
||||||
'status': false,
|
'status': false,
|
||||||
'data': [],
|
|
||||||
'msg': err.toString(),
|
'msg': err.toString(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
'status': false,
|
'status': false,
|
||||||
'data': [],
|
|
||||||
'msg': res.data['message'],
|
'msg': res.data['message'],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -160,9 +160,7 @@ class HtmlHttp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RegExp digitRegExp = RegExp(r'\d+');
|
String number = RegExp(r'\d+').firstMatch(id)!.group(0)!;
|
||||||
Iterable<Match> matches = digitRegExp.allMatches(id);
|
|
||||||
String number = matches.first.group(0)!;
|
|
||||||
return {
|
return {
|
||||||
'status': true,
|
'status': true,
|
||||||
'avatar': avatar,
|
'avatar': avatar,
|
||||||
|
|||||||
@@ -69,6 +69,9 @@ class HtmlRenderController extends ReplyController {
|
|||||||
late dynamic res;
|
late dynamic res;
|
||||||
if (dynamicType == 'opus' || dynamicType == 'picture') {
|
if (dynamicType == 'opus' || dynamicType == 'picture') {
|
||||||
res = await HtmlHttp.reqHtml(id, dynamicType);
|
res = await HtmlHttp.reqHtml(id, dynamicType);
|
||||||
|
if (res != null) {
|
||||||
|
type = res['commentType'];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
res = await HtmlHttp.reqReadHtml(id, dynamicType);
|
res = await HtmlHttp.reqReadHtml(id, dynamicType);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -216,17 +216,8 @@ class SearchDynamic extends StatelessWidget {
|
|||||||
required String content,
|
required String content,
|
||||||
}) {
|
}) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () async {
|
onTap: () {
|
||||||
SmartDialog.showLoading();
|
Utils.pushDynFromId(id);
|
||||||
dynamic res = await DynamicsHttp.dynamicDetail(id: id);
|
|
||||||
if (res['status']) {
|
|
||||||
SmartDialog.dismiss();
|
|
||||||
Get.toNamed('/dynamicDetail',
|
|
||||||
arguments: {'item': res['data'], 'floor': 1, 'action': 'detail'});
|
|
||||||
} else {
|
|
||||||
SmartDialog.dismiss();
|
|
||||||
SmartDialog.showToast(res['msg']);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||||
|
|||||||
@@ -653,22 +653,7 @@ class PiliScheme {
|
|||||||
static Future<bool> _onPushDynDetail(path, off) async {
|
static Future<bool> _onPushDynDetail(path, off) async {
|
||||||
String? id = uriDigitRegExp.firstMatch(path)?.group(1);
|
String? id = uriDigitRegExp.firstMatch(path)?.group(1);
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
SmartDialog.showLoading();
|
Utils.pushDynFromId(id, off: off);
|
||||||
dynamic res = await DynamicsHttp.dynamicDetail(id: id);
|
|
||||||
SmartDialog.dismiss();
|
|
||||||
if (res['status']) {
|
|
||||||
Utils.toDupNamed(
|
|
||||||
'/dynamicDetail',
|
|
||||||
arguments: {
|
|
||||||
'item': res['data'],
|
|
||||||
'floor': 1,
|
|
||||||
'action': 'detail',
|
|
||||||
},
|
|
||||||
off: off,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
SmartDialog.showToast(res['msg']);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -62,6 +62,39 @@ class Utils {
|
|||||||
|
|
||||||
static final _numRegExp = RegExp(r'([\d\.]+)([千万亿])?');
|
static final _numRegExp = RegExp(r'([\d\.]+)([千万亿])?');
|
||||||
|
|
||||||
|
static Future pushDynFromId(id, {bool off = false}) async {
|
||||||
|
SmartDialog.showLoading();
|
||||||
|
dynamic res = await DynamicsHttp.dynamicDetail(id: id);
|
||||||
|
SmartDialog.dismiss();
|
||||||
|
if (res['status']) {
|
||||||
|
DynamicItemModel data = res['data'];
|
||||||
|
if (data.basic?['comment_type'] == 12) {
|
||||||
|
Utils.toDupNamed(
|
||||||
|
'/htmlRender',
|
||||||
|
parameters: {
|
||||||
|
'url': 'www.bilibili.com/opus/$id',
|
||||||
|
'title': '',
|
||||||
|
'id': id,
|
||||||
|
'dynamicType': 'opus'
|
||||||
|
},
|
||||||
|
off: off,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
Utils.toDupNamed(
|
||||||
|
'/dynamicDetail',
|
||||||
|
arguments: {
|
||||||
|
'item': res['data'],
|
||||||
|
'floor': 1,
|
||||||
|
'action': 'detail',
|
||||||
|
},
|
||||||
|
off: off,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
SmartDialog.showToast(res['msg']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void reportVideo(int aid) {
|
static void reportVideo(int aid) {
|
||||||
Get.toNamed(
|
Get.toNamed(
|
||||||
'/webview',
|
'/webview',
|
||||||
@@ -783,11 +816,14 @@ class Utils {
|
|||||||
|
|
||||||
/// 点击评论action 直接查看评论
|
/// 点击评论action 直接查看评论
|
||||||
if (action == 'comment') {
|
if (action == 'comment') {
|
||||||
Utils.toDupNamed('/dynamicDetail', arguments: {
|
Utils.toDupNamed(
|
||||||
'item': item,
|
'/dynamicDetail',
|
||||||
'floor': floor,
|
arguments: {
|
||||||
'action': action,
|
'item': item,
|
||||||
});
|
'floor': floor,
|
||||||
|
'action': action,
|
||||||
|
},
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -858,8 +894,13 @@ class Utils {
|
|||||||
/// 纯文字动态查看
|
/// 纯文字动态查看
|
||||||
case 'DYNAMIC_TYPE_WORD':
|
case 'DYNAMIC_TYPE_WORD':
|
||||||
debugPrint('纯文本');
|
debugPrint('纯文本');
|
||||||
Utils.toDupNamed('/dynamicDetail',
|
Utils.toDupNamed(
|
||||||
arguments: {'item': item, 'floor': floor});
|
'/dynamicDetail',
|
||||||
|
arguments: {
|
||||||
|
'item': item,
|
||||||
|
'floor': floor,
|
||||||
|
},
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
||||||
DynamicLiveModel liveRcmd = item.modules.moduleDynamic.major.liveRcmd;
|
DynamicLiveModel liveRcmd = item.modules.moduleDynamic.major.liveRcmd;
|
||||||
@@ -928,8 +969,13 @@ class Utils {
|
|||||||
// /// 图文动态查看
|
// /// 图文动态查看
|
||||||
// case 'DYNAMIC_TYPE_DRAW':
|
// case 'DYNAMIC_TYPE_DRAW':
|
||||||
default:
|
default:
|
||||||
Utils.toDupNamed('/dynamicDetail',
|
Utils.toDupNamed(
|
||||||
arguments: {'item': item, 'floor': floor});
|
'/dynamicDetail',
|
||||||
|
arguments: {
|
||||||
|
'item': item,
|
||||||
|
'floor': floor,
|
||||||
|
},
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user