mod: 字符替换、跳转播放

This commit is contained in:
guozhigq
2023-06-24 16:54:39 +08:00
parent f522886dc2
commit 7174eef890
8 changed files with 43 additions and 26 deletions

View File

@ -1,6 +1,7 @@
class Api {
// 推荐视频
// http://app.bilibili.com/x/v2/feed/index
// static const String recommendList =
// 'https://app.bilibili.com/x/v2/feed/index?appkey=27eb53fc9058f8c3';
static const String recommendList = '/x/web-interface/index/top/feed/rcmd';
// 热门视频

View File

@ -82,9 +82,14 @@ class Request {
//响应流上前后两次接受到数据的间隔,单位为毫秒。
receiveTimeout: const Duration(milliseconds: 12000),
//Http请求头.
// headers: {
headers: {
// 'cookie': '',
// },
"env": 'prod',
"app-key": 'android',
"x-bili-aurora-eid": 'UlMFQVcABlAH',
"x-bili-aurora-zone": 'sh001',
// "x-bili-mid": ''
},
);
dio.options = options;

View File

@ -1,4 +1,5 @@
import 'package:pilipala/utils/em.dart';
import 'package:pilipala/utils/utils.dart';
class SearchVideoModel {
SearchVideoModel({this.list});
@ -86,25 +87,12 @@ class SearchVideoItemModel {
videoReview = json['video_review'];
pubdate = json['pubdate'];
senddate = json['senddate'];
duration = _dutation(json['duration']);
duration = Utils.duration(json['duration']);
owner = Owner.fromJson(json);
stat = Stat.fromJson(json);
}
}
_dutation(String duration) {
List timeList = duration.split(':');
int len = timeList.length;
if (len == 2) {
return int.parse(timeList[0]) * 60 + int.parse(timeList[1]);
}
if (len == 3) {
return int.parse(timeList[0]) * 3600 +
int.parse(timeList[1]) * 60 +
timeList[2];
}
}
class Stat {
Stat({
this.view,

View File

@ -73,6 +73,7 @@ class HomeAppBar extends StatelessWidget {
src: userInfoCache.get('userInfoCache').face,
),
),
const SizedBox(width: 10),
] else ...[
IconButton(
onPressed: () => showModalBottomSheet(

View File

@ -42,7 +42,7 @@ class MediaController extends GetxController {
}
Future<dynamic> queryFavFolder() async {
if (!userLogin.value) {
if (!userLogin.value || GStrorage.user.get(UserBoxKey.userMid) == null) {
return {'status': false, 'data': [], 'msg': '未登录'};
}
var res = await await UserHttp.userfavFolder(

View File

@ -119,8 +119,8 @@ class MediaPage extends StatelessWidget {
mediaController.favFolderData.value.count!;
bool flag = favFolderCount > favFolderList.length;
return Obx(() => ListView.builder(
itemCount: mediaController
.favFolderData.value.list!.length +
itemCount:
mediaController.favFolderData.value.list!.length +
(flag ? 1 : 0),
itemBuilder: (context, index) {
if (flag && index == favFolderList.length) {

View File

@ -2,6 +2,7 @@ import 'dart:developer';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_meedu_media_kit/meedu_player.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:get/get.dart';
import 'package:pilipala/common/widgets/network_img_layer.dart';
@ -467,6 +468,9 @@ InlineSpan buildContent(BuildContext context, content) {
});
}
// content.message = content.message.replaceAll(RegExp(r"\{vote:.*?\}"), ' ');
if (content.message.contains('&amp;')) {
content.message = content.message.replaceAll('&amp;', '&');
}
// 匹配表情
content.message.splitMapJoin(
RegExp(r"\[.*?\]"),
@ -584,10 +588,14 @@ InlineSpan buildContent(BuildContext context, content) {
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
),
// recognizer: TapGestureRecognizer()
// ..onTap = () => {
// print('time 点击'),
// },
recognizer: TapGestureRecognizer()
..onTap = () {
Get.find<VideoDetailController>(tag: Get.arguments['heroTag'])
.meeduPlayerController
.seekTo(
Duration(seconds: Utils.duration(matchStr)),
);
},
),
);
return '';

View File

@ -142,4 +142,18 @@ class Utils {
static String makeHeroTag(v) {
return v.toString() + Random().nextInt(9999).toString();
}
static int duration(String duration) {
List timeList = duration.split(':');
int len = timeList.length;
if (len == 2) {
return int.parse(timeList[0]) * 60 + int.parse(timeList[1]);
}
if (len == 3) {
return int.parse(timeList[0]) * 3600 +
int.parse(timeList[1]) * 60 +
int.parse(timeList[2]);
}
return 0;
}
}