Merge branch 'main' into feature-updateVideoDetailStructure
This commit is contained in:
2
.github/workflows/beta_ci.yml
vendored
2
.github/workflows/beta_ci.yml
vendored
@ -206,4 +206,4 @@ jobs:
|
|||||||
method: sendFile
|
method: sendFile
|
||||||
path: Pilipala-Beta/*
|
path: Pilipala-Beta/*
|
||||||
parse_mode: Markdown
|
parse_mode: Markdown
|
||||||
context: "*Beta版本: v${{ needs.update_version.outputs.new_version }}*\n更新内容: [${{ needs.update_version.outputs.last_commit }}](${{ github.event.head_commit.url }})"
|
context: "*Beta版本: v${{ needs.update_version.outputs.new_version }}*\n更新内容: [${{ needs.update_version.outputs.last_commit }}]"
|
||||||
|
|||||||
@ -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();
|
||||||
|
|
||||||
|
|||||||
@ -511,4 +511,13 @@ class Api {
|
|||||||
|
|
||||||
/// 取消订阅
|
/// 取消订阅
|
||||||
static const String cancelSub = '/x/v3/fav/season/unfav';
|
static const String cancelSub = '/x/v3/fav/season/unfav';
|
||||||
|
|
||||||
|
/// 动态转发
|
||||||
|
static const String dynamicForwardUrl = '/x/dynamic/feed/create/submit_check';
|
||||||
|
|
||||||
|
/// 创建动态
|
||||||
|
static const String dynamicCreate = '/x/dynamic/feed/create/dyn';
|
||||||
|
|
||||||
|
/// 删除收藏夹
|
||||||
|
static const String delFavFolder = '/x/v3/fav/folder/del';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import 'dart:math';
|
||||||
import '../models/dynamics/result.dart';
|
import '../models/dynamics/result.dart';
|
||||||
import '../models/dynamics/up.dart';
|
import '../models/dynamics/up.dart';
|
||||||
import 'index.dart';
|
import 'index.dart';
|
||||||
@ -117,4 +118,94 @@ class DynamicsHttp {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future dynamicForward() async {
|
||||||
|
var res = await Request().post(
|
||||||
|
Api.dynamicForwardUrl,
|
||||||
|
queryParameters: {
|
||||||
|
'csrf': await Request.getCsrf(),
|
||||||
|
'x-bili-device-req-json': {'platform': 'web', 'device': 'pc'},
|
||||||
|
'x-bili-web-req-json': {'spm_id': '333.999'},
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
'attach_card': null,
|
||||||
|
'scene': 4,
|
||||||
|
'content': {
|
||||||
|
'conetents': [
|
||||||
|
{'raw_text': "2", 'type': 1, 'biz_id': ""}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': res.data['data'],
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'data': [],
|
||||||
|
'msg': res.data['message'],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future dynamicCreate({
|
||||||
|
required int mid,
|
||||||
|
required int scene,
|
||||||
|
int? oid,
|
||||||
|
String? dynIdStr,
|
||||||
|
String? rawText,
|
||||||
|
}) async {
|
||||||
|
DateTime now = DateTime.now();
|
||||||
|
int timestamp = now.millisecondsSinceEpoch ~/ 1000;
|
||||||
|
Random random = Random();
|
||||||
|
int randomNumber = random.nextInt(9000) + 1000;
|
||||||
|
String uploadId = '${mid}_${timestamp}_$randomNumber';
|
||||||
|
|
||||||
|
Map<String, dynamic> webRepostSrc = {
|
||||||
|
'dyn_id_str': dynIdStr ?? '',
|
||||||
|
};
|
||||||
|
|
||||||
|
/// 投稿转发
|
||||||
|
if (scene == 5) {
|
||||||
|
webRepostSrc = {
|
||||||
|
'revs_id': {'dyn_type': 8, 'rid': oid}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
var res = await Request().post(Api.dynamicCreate, queryParameters: {
|
||||||
|
'platform': 'web',
|
||||||
|
'csrf': await Request.getCsrf(),
|
||||||
|
'x-bili-device-req-json': {'platform': 'web', 'device': 'pc'},
|
||||||
|
'x-bili-web-req-json': {'spm_id': '333.999'},
|
||||||
|
}, data: {
|
||||||
|
'dyn_req': {
|
||||||
|
'content': {
|
||||||
|
'contents': [
|
||||||
|
{'raw_text': rawText ?? '', 'type': 1, 'biz_id': ''}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
'scene': scene,
|
||||||
|
'attach_card': null,
|
||||||
|
'upload_id': uploadId,
|
||||||
|
'meta': {
|
||||||
|
'app_meta': {'from': 'create.dynamic.web', 'mobi_app': 'web'}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'web_repost_src': webRepostSrc
|
||||||
|
});
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': res.data['data'],
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'data': [],
|
||||||
|
'msg': res.data['message'],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -395,4 +395,21 @@ class UserHttp {
|
|||||||
return {'status': false, 'msg': res.data['message']};
|
return {'status': false, 'msg': res.data['message']};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 删除文件夹
|
||||||
|
static Future delFavFolder({required int mediaIds}) async {
|
||||||
|
var res = await Request().post(
|
||||||
|
Api.delFavFolder,
|
||||||
|
queryParameters: {
|
||||||
|
'media_ids': mediaIds,
|
||||||
|
'platform': 'web',
|
||||||
|
'csrf': await Request.getCsrf(),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {'status': true};
|
||||||
|
} else {
|
||||||
|
return {'status': false, 'msg': res.data['message']};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -130,27 +130,10 @@ class MyApp extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final SnackBarThemeData snackBarThemeData = SnackBarThemeData(
|
|
||||||
actionTextColor: darkColorScheme.primary,
|
|
||||||
backgroundColor: darkColorScheme.secondaryContainer,
|
|
||||||
closeIconColor: darkColorScheme.secondary,
|
|
||||||
contentTextStyle: TextStyle(color: darkColorScheme.secondary),
|
|
||||||
elevation: 20,
|
|
||||||
);
|
|
||||||
|
|
||||||
ThemeData themeData = ThemeData(
|
ThemeData themeData = ThemeData(
|
||||||
// fontFamily: 'HarmonyOS',
|
|
||||||
colorScheme: currentThemeValue == ThemeType.dark
|
colorScheme: currentThemeValue == ThemeType.dark
|
||||||
? darkColorScheme
|
? darkColorScheme
|
||||||
: lightColorScheme,
|
: lightColorScheme,
|
||||||
snackBarTheme: snackBarThemeData,
|
|
||||||
pageTransitionsTheme: const PageTransitionsTheme(
|
|
||||||
builders: <TargetPlatform, PageTransitionsBuilder>{
|
|
||||||
TargetPlatform.android: ZoomPageTransitionsBuilder(
|
|
||||||
allowEnterRouteSnapshotting: false,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// 小白条、导航栏沉浸
|
// 小白条、导航栏沉浸
|
||||||
@ -171,9 +154,38 @@ class MyApp extends StatelessWidget {
|
|||||||
// 图片缓存
|
// 图片缓存
|
||||||
// PaintingBinding.instance.imageCache.maximumSizeBytes = 1000 << 20;
|
// PaintingBinding.instance.imageCache.maximumSizeBytes = 1000 << 20;
|
||||||
return GetMaterialApp(
|
return GetMaterialApp(
|
||||||
title: 'PiLiPaLa',
|
title: 'PiliPala',
|
||||||
theme: themeData,
|
theme: ThemeData(
|
||||||
darkTheme: themeData,
|
colorScheme: currentThemeValue == ThemeType.dark
|
||||||
|
? darkColorScheme
|
||||||
|
: lightColorScheme,
|
||||||
|
snackBarTheme: SnackBarThemeData(
|
||||||
|
actionTextColor: lightColorScheme.primary,
|
||||||
|
backgroundColor: lightColorScheme.secondaryContainer,
|
||||||
|
closeIconColor: lightColorScheme.secondary,
|
||||||
|
contentTextStyle: TextStyle(color: lightColorScheme.secondary),
|
||||||
|
elevation: 20,
|
||||||
|
),
|
||||||
|
pageTransitionsTheme: const PageTransitionsTheme(
|
||||||
|
builders: <TargetPlatform, PageTransitionsBuilder>{
|
||||||
|
TargetPlatform.android: ZoomPageTransitionsBuilder(
|
||||||
|
allowEnterRouteSnapshotting: false,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
darkTheme: ThemeData(
|
||||||
|
colorScheme: currentThemeValue == ThemeType.light
|
||||||
|
? lightColorScheme
|
||||||
|
: darkColorScheme,
|
||||||
|
snackBarTheme: SnackBarThemeData(
|
||||||
|
actionTextColor: darkColorScheme.primary,
|
||||||
|
backgroundColor: darkColorScheme.secondaryContainer,
|
||||||
|
closeIconColor: darkColorScheme.secondary,
|
||||||
|
contentTextStyle: TextStyle(color: darkColorScheme.secondary),
|
||||||
|
elevation: 20,
|
||||||
|
),
|
||||||
|
),
|
||||||
localizationsDelegates: const [
|
localizationsDelegates: const [
|
||||||
GlobalCupertinoLocalizations.delegate,
|
GlobalCupertinoLocalizations.delegate,
|
||||||
GlobalMaterialLocalizations.delegate,
|
GlobalMaterialLocalizations.delegate,
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:pilipala/pages/rank/zone/index.dart';
|
import 'package:pilipala/pages/rank/zone/index.dart';
|
||||||
|
|
||||||
enum RandType {
|
enum RandType {
|
||||||
@ -74,7 +73,6 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '全站',
|
'label': '全站',
|
||||||
'type': RandType.all,
|
'type': RandType.all,
|
||||||
'ctr': Get.put<ZoneController>,
|
|
||||||
'page': const ZonePage(rid: 0),
|
'page': const ZonePage(rid: 0),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -84,7 +82,6 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '国创相关',
|
'label': '国创相关',
|
||||||
'type': RandType.creation,
|
'type': RandType.creation,
|
||||||
'ctr': Get.put<ZoneController>,
|
|
||||||
'page': const ZonePage(rid: 168),
|
'page': const ZonePage(rid: 168),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -94,7 +91,6 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '动画',
|
'label': '动画',
|
||||||
'type': RandType.animation,
|
'type': RandType.animation,
|
||||||
'ctr': Get.put<ZoneController>,
|
|
||||||
'page': const ZonePage(rid: 1),
|
'page': const ZonePage(rid: 1),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -104,7 +100,6 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '音乐',
|
'label': '音乐',
|
||||||
'type': RandType.music,
|
'type': RandType.music,
|
||||||
'ctr': Get.put<ZoneController>,
|
|
||||||
'page': const ZonePage(rid: 3),
|
'page': const ZonePage(rid: 3),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -114,7 +109,6 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '舞蹈',
|
'label': '舞蹈',
|
||||||
'type': RandType.dance,
|
'type': RandType.dance,
|
||||||
'ctr': Get.put<ZoneController>,
|
|
||||||
'page': const ZonePage(rid: 129),
|
'page': const ZonePage(rid: 129),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -124,7 +118,6 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '游戏',
|
'label': '游戏',
|
||||||
'type': RandType.game,
|
'type': RandType.game,
|
||||||
'ctr': Get.put<ZoneController>,
|
|
||||||
'page': const ZonePage(rid: 4),
|
'page': const ZonePage(rid: 4),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -134,7 +127,6 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '知识',
|
'label': '知识',
|
||||||
'type': RandType.knowledge,
|
'type': RandType.knowledge,
|
||||||
'ctr': Get.put<ZoneController>,
|
|
||||||
'page': const ZonePage(rid: 36),
|
'page': const ZonePage(rid: 36),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -144,7 +136,6 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '科技',
|
'label': '科技',
|
||||||
'type': RandType.technology,
|
'type': RandType.technology,
|
||||||
'ctr': Get.put<ZoneController>,
|
|
||||||
'page': const ZonePage(rid: 188),
|
'page': const ZonePage(rid: 188),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -154,7 +145,6 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '运动',
|
'label': '运动',
|
||||||
'type': RandType.sport,
|
'type': RandType.sport,
|
||||||
'ctr': Get.put<ZoneController>,
|
|
||||||
'page': const ZonePage(rid: 234),
|
'page': const ZonePage(rid: 234),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -164,7 +154,6 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '汽车',
|
'label': '汽车',
|
||||||
'type': RandType.car,
|
'type': RandType.car,
|
||||||
'ctr': Get.put<ZoneController>,
|
|
||||||
'page': const ZonePage(rid: 223),
|
'page': const ZonePage(rid: 223),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -174,7 +163,6 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '生活',
|
'label': '生活',
|
||||||
'type': RandType.life,
|
'type': RandType.life,
|
||||||
'ctr': Get.put<ZoneController>,
|
|
||||||
'page': const ZonePage(rid: 160),
|
'page': const ZonePage(rid: 160),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -184,7 +172,6 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '美食',
|
'label': '美食',
|
||||||
'type': RandType.food,
|
'type': RandType.food,
|
||||||
'ctr': Get.put<ZoneController>,
|
|
||||||
'page': const ZonePage(rid: 211),
|
'page': const ZonePage(rid: 211),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -194,7 +181,6 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '动物圈',
|
'label': '动物圈',
|
||||||
'type': RandType.animal,
|
'type': RandType.animal,
|
||||||
'ctr': Get.put<ZoneController>,
|
|
||||||
'page': const ZonePage(rid: 217),
|
'page': const ZonePage(rid: 217),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -204,7 +190,6 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '鬼畜',
|
'label': '鬼畜',
|
||||||
'type': RandType.madness,
|
'type': RandType.madness,
|
||||||
'ctr': Get.put<ZoneController>,
|
|
||||||
'page': const ZonePage(rid: 119),
|
'page': const ZonePage(rid: 119),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -214,7 +199,6 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '时尚',
|
'label': '时尚',
|
||||||
'type': RandType.fashion,
|
'type': RandType.fashion,
|
||||||
'ctr': Get.put<ZoneController>,
|
|
||||||
'page': const ZonePage(rid: 155),
|
'page': const ZonePage(rid: 155),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -224,7 +208,6 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '娱乐',
|
'label': '娱乐',
|
||||||
'type': RandType.entertainment,
|
'type': RandType.entertainment,
|
||||||
'ctr': Get.put<ZoneController>,
|
|
||||||
'page': const ZonePage(rid: 5),
|
'page': const ZonePage(rid: 5),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -234,7 +217,6 @@ List tabsConfig = [
|
|||||||
),
|
),
|
||||||
'label': '影视',
|
'label': '影视',
|
||||||
'type': RandType.film,
|
'type': RandType.film,
|
||||||
'ctr': Get.put<ZoneController>,
|
|
||||||
'page': const ZonePage(rid: 181),
|
'page': const ZonePage(rid: 181),
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@ -5,6 +5,10 @@ enum SubtitleType {
|
|||||||
aizh,
|
aizh,
|
||||||
// 英语(自动生成)
|
// 英语(自动生成)
|
||||||
aien,
|
aien,
|
||||||
|
// 中文(简体)
|
||||||
|
zhHans,
|
||||||
|
// 英文(美国)
|
||||||
|
enUS,
|
||||||
}
|
}
|
||||||
|
|
||||||
extension SubtitleTypeExtension on SubtitleType {
|
extension SubtitleTypeExtension on SubtitleType {
|
||||||
@ -16,6 +20,10 @@ extension SubtitleTypeExtension on SubtitleType {
|
|||||||
return '中文(自动翻译)';
|
return '中文(自动翻译)';
|
||||||
case SubtitleType.aien:
|
case SubtitleType.aien:
|
||||||
return '英语(自动生成)';
|
return '英语(自动生成)';
|
||||||
|
case SubtitleType.zhHans:
|
||||||
|
return '中文(简体)';
|
||||||
|
case SubtitleType.enUS:
|
||||||
|
return '英文(美国)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -29,6 +37,10 @@ extension SubtitleIdExtension on SubtitleType {
|
|||||||
return 'ai-zh';
|
return 'ai-zh';
|
||||||
case SubtitleType.aien:
|
case SubtitleType.aien:
|
||||||
return 'ai-en';
|
return 'ai-en';
|
||||||
|
case SubtitleType.zhHans:
|
||||||
|
return 'zh-Hans';
|
||||||
|
case SubtitleType.enUS:
|
||||||
|
return 'en-US';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -42,6 +54,10 @@ extension SubtitleCodeExtension on SubtitleType {
|
|||||||
return 2;
|
return 2;
|
||||||
case SubtitleType.aien:
|
case SubtitleType.aien:
|
||||||
return 3;
|
return 3;
|
||||||
|
case SubtitleType.zhHans:
|
||||||
|
return 4;
|
||||||
|
case SubtitleType.enUS:
|
||||||
|
return 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,6 +56,7 @@ class BangumiIntroController extends GetxController {
|
|||||||
RxMap followStatus = {}.obs;
|
RxMap followStatus = {}.obs;
|
||||||
int _tempThemeValue = -1;
|
int _tempThemeValue = -1;
|
||||||
var userInfo;
|
var userInfo;
|
||||||
|
PersistentBottomSheetController? bottomSheetController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@ -320,4 +321,8 @@ class BangumiIntroController extends GetxController {
|
|||||||
).buildShowContent(Get.context!),
|
).buildShowContent(Get.context!),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hiddenEpisodeBottomSheet() {
|
||||||
|
bottomSheetController?.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -325,6 +325,7 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
|||||||
changeFuc: (bvid, cid, aid) =>
|
changeFuc: (bvid, cid, aid) =>
|
||||||
bangumiIntroController.changeSeasonOrbangu(bvid, cid, aid),
|
bangumiIntroController.changeSeasonOrbangu(bvid, cid, aid),
|
||||||
bangumiDetail: bangumiIntroController.bangumiDetail.value,
|
bangumiDetail: bangumiIntroController.bangumiDetail.value,
|
||||||
|
bangumiIntroController: bangumiIntroController,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import 'package:pilipala/utils/storage.dart';
|
|||||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
||||||
import '../../../common/pages_bottom_sheet.dart';
|
import '../../../common/pages_bottom_sheet.dart';
|
||||||
import '../../../models/common/video_episode_type.dart';
|
import '../../../models/common/video_episode_type.dart';
|
||||||
|
import '../introduction/controller.dart';
|
||||||
|
|
||||||
class BangumiPanel extends StatefulWidget {
|
class BangumiPanel extends StatefulWidget {
|
||||||
const BangumiPanel({
|
const BangumiPanel({
|
||||||
@ -19,6 +20,7 @@ class BangumiPanel extends StatefulWidget {
|
|||||||
this.sheetHeight,
|
this.sheetHeight,
|
||||||
this.changeFuc,
|
this.changeFuc,
|
||||||
this.bangumiDetail,
|
this.bangumiDetail,
|
||||||
|
this.bangumiIntroController,
|
||||||
});
|
});
|
||||||
|
|
||||||
final List<EpisodeItem> pages;
|
final List<EpisodeItem> pages;
|
||||||
@ -26,6 +28,7 @@ class BangumiPanel extends StatefulWidget {
|
|||||||
final double? sheetHeight;
|
final double? sheetHeight;
|
||||||
final Function? changeFuc;
|
final Function? changeFuc;
|
||||||
final BangumiInfoModel? bangumiDetail;
|
final BangumiInfoModel? bangumiDetail;
|
||||||
|
final BangumiIntroController? bangumiIntroController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<BangumiPanel> createState() => _BangumiPanelState();
|
State<BangumiPanel> createState() => _BangumiPanelState();
|
||||||
@ -92,11 +95,15 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
// 在回调函数中获取更新后的状态
|
// 在回调函数中获取更新后的状态
|
||||||
final double offset = min((currentIndex * 150) - 75,
|
final double offset = min((currentIndex * 150) - 75,
|
||||||
listViewScrollCtr.position.maxScrollExtent);
|
listViewScrollCtr.position.maxScrollExtent);
|
||||||
listViewScrollCtr.animateTo(
|
if (currentIndex.value == 0) {
|
||||||
offset,
|
listViewScrollCtr.jumpTo(0);
|
||||||
duration: const Duration(milliseconds: 300),
|
} else {
|
||||||
curve: Curves.easeInOut,
|
listViewScrollCtr.animateTo(
|
||||||
);
|
offset,
|
||||||
|
duration: const Duration(milliseconds: 300),
|
||||||
|
curve: Curves.easeInOut,
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,7 +139,8 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_bottomSheetController = EpisodeBottomSheet(
|
widget.bangumiIntroController?.bottomSheetController =
|
||||||
|
_bottomSheetController = EpisodeBottomSheet(
|
||||||
currentCid: cid,
|
currentCid: cid,
|
||||||
episodes: widget.pages,
|
episodes: widget.pages,
|
||||||
changeFucCall: changeFucCall,
|
changeFucCall: changeFucCall,
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import 'package:pilipala/pages/video/detail/reply_reply/index.dart';
|
|||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import 'package:pilipala/utils/id_utils.dart';
|
import 'package:pilipala/utils/id_utils.dart';
|
||||||
|
|
||||||
|
import '../../../models/video/reply/item.dart';
|
||||||
import '../widgets/dynamic_panel.dart';
|
import '../widgets/dynamic_panel.dart';
|
||||||
|
|
||||||
class DynamicDetailPage extends StatefulWidget {
|
class DynamicDetailPage extends StatefulWidget {
|
||||||
@ -182,6 +183,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
|||||||
scrollController.removeListener(() {});
|
scrollController.removeListener(() {});
|
||||||
fabAnimationCtr.dispose();
|
fabAnimationCtr.dispose();
|
||||||
scrollController.dispose();
|
scrollController.dispose();
|
||||||
|
titleStreamC.close();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,208 +212,194 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
|||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
await _dynamicDetailController.queryReplyList();
|
await _dynamicDetailController.queryReplyList();
|
||||||
},
|
},
|
||||||
child: Stack(
|
child: CustomScrollView(
|
||||||
children: [
|
controller: scrollController,
|
||||||
CustomScrollView(
|
slivers: [
|
||||||
controller: scrollController,
|
if (action != 'comment')
|
||||||
slivers: [
|
SliverToBoxAdapter(
|
||||||
if (action != 'comment')
|
child: DynamicPanel(
|
||||||
SliverToBoxAdapter(
|
item: _dynamicDetailController.item,
|
||||||
child: DynamicPanel(
|
source: 'detail',
|
||||||
item: _dynamicDetailController.item,
|
),
|
||||||
source: 'detail',
|
),
|
||||||
|
SliverPersistentHeader(
|
||||||
|
delegate: _MySliverPersistentHeaderDelegate(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).colorScheme.surface,
|
||||||
|
border: Border(
|
||||||
|
top: BorderSide(
|
||||||
|
width: 0.6,
|
||||||
|
color: Theme.of(context).dividerColor.withOpacity(0.05),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SliverPersistentHeader(
|
height: 45,
|
||||||
delegate: _MySliverPersistentHeaderDelegate(
|
padding: const EdgeInsets.only(left: 12, right: 6),
|
||||||
child: Container(
|
child: Row(
|
||||||
decoration: BoxDecoration(
|
children: [
|
||||||
color: Theme.of(context).colorScheme.surface,
|
Obx(
|
||||||
border: Border(
|
() => AnimatedSwitcher(
|
||||||
top: BorderSide(
|
duration: const Duration(milliseconds: 400),
|
||||||
width: 0.6,
|
transitionBuilder:
|
||||||
color: Theme.of(context)
|
(Widget child, Animation<double> animation) {
|
||||||
.dividerColor
|
return ScaleTransition(
|
||||||
.withOpacity(0.05),
|
scale: animation, child: child);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'${_dynamicDetailController.acount.value}',
|
||||||
|
key: ValueKey<int>(
|
||||||
|
_dynamicDetailController.acount.value),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
height: 45,
|
const Text('条回复'),
|
||||||
padding: const EdgeInsets.only(left: 12, right: 6),
|
const Spacer(),
|
||||||
child: Row(
|
SizedBox(
|
||||||
children: [
|
height: 35,
|
||||||
Obx(
|
child: TextButton.icon(
|
||||||
() => AnimatedSwitcher(
|
onPressed: () =>
|
||||||
duration: const Duration(milliseconds: 400),
|
_dynamicDetailController.queryBySort(),
|
||||||
transitionBuilder:
|
icon: const Icon(Icons.sort, size: 16),
|
||||||
(Widget child, Animation<double> animation) {
|
label: Obx(() => Text(
|
||||||
return ScaleTransition(
|
_dynamicDetailController.sortTypeLabel.value,
|
||||||
scale: animation, child: child);
|
style: const TextStyle(fontSize: 13),
|
||||||
},
|
)),
|
||||||
child: Text(
|
),
|
||||||
'${_dynamicDetailController.acount.value}',
|
)
|
||||||
key: ValueKey<int>(
|
],
|
||||||
_dynamicDetailController.acount.value),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const Text('条回复'),
|
|
||||||
const Spacer(),
|
|
||||||
SizedBox(
|
|
||||||
height: 35,
|
|
||||||
child: TextButton.icon(
|
|
||||||
onPressed: () =>
|
|
||||||
_dynamicDetailController.queryBySort(),
|
|
||||||
icon: const Icon(Icons.sort, size: 16),
|
|
||||||
label: Obx(() => Text(
|
|
||||||
_dynamicDetailController
|
|
||||||
.sortTypeLabel.value,
|
|
||||||
style: const TextStyle(fontSize: 13),
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
pinned: true,
|
|
||||||
),
|
|
||||||
FutureBuilder(
|
|
||||||
future: _futureBuilderFuture,
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
|
||||||
Map data = snapshot.data as Map;
|
|
||||||
if (snapshot.data['status']) {
|
|
||||||
// 请求成功
|
|
||||||
return Obx(
|
|
||||||
() => _dynamicDetailController.replyList.isEmpty &&
|
|
||||||
_dynamicDetailController.isLoadingMore
|
|
||||||
? SliverList(
|
|
||||||
delegate: SliverChildBuilderDelegate(
|
|
||||||
(context, index) {
|
|
||||||
return const VideoReplySkeleton();
|
|
||||||
}, childCount: 8),
|
|
||||||
)
|
|
||||||
: SliverList(
|
|
||||||
delegate: SliverChildBuilderDelegate(
|
|
||||||
(context, index) {
|
|
||||||
if (index ==
|
|
||||||
_dynamicDetailController
|
|
||||||
.replyList.length) {
|
|
||||||
return Container(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
bottom: MediaQuery.of(context)
|
|
||||||
.padding
|
|
||||||
.bottom),
|
|
||||||
height: MediaQuery.of(context)
|
|
||||||
.padding
|
|
||||||
.bottom +
|
|
||||||
100,
|
|
||||||
child: Center(
|
|
||||||
child: Obx(
|
|
||||||
() => Text(
|
|
||||||
_dynamicDetailController
|
|
||||||
.noMore.value,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.outline,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return ReplyItem(
|
|
||||||
replyItem: _dynamicDetailController
|
|
||||||
.replyList[index],
|
|
||||||
showReplyRow: true,
|
|
||||||
replyLevel: '1',
|
|
||||||
replyReply: (replyItem) =>
|
|
||||||
replyReply(replyItem),
|
|
||||||
replyType:
|
|
||||||
ReplyType.values[replyType],
|
|
||||||
addReply: (replyItem) {
|
|
||||||
_dynamicDetailController
|
|
||||||
.replyList[index].replies!
|
|
||||||
.add(replyItem);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
childCount: _dynamicDetailController
|
|
||||||
.replyList.length +
|
|
||||||
1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
// 请求错误
|
|
||||||
return HttpError(
|
|
||||||
errMsg: data['msg'],
|
|
||||||
fn: () => setState(() {}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 骨架屏
|
|
||||||
return SliverList(
|
|
||||||
delegate: SliverChildBuilderDelegate((context, index) {
|
|
||||||
return const VideoReplySkeleton();
|
|
||||||
}, childCount: 8),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
bottom: MediaQuery.of(context).padding.bottom + 14,
|
|
||||||
right: 14,
|
|
||||||
child: SlideTransition(
|
|
||||||
position: Tween<Offset>(
|
|
||||||
begin: const Offset(0, 2),
|
|
||||||
end: const Offset(0, 0),
|
|
||||||
).animate(CurvedAnimation(
|
|
||||||
parent: fabAnimationCtr,
|
|
||||||
curve: Curves.easeInOut,
|
|
||||||
)),
|
|
||||||
child: FloatingActionButton(
|
|
||||||
heroTag: null,
|
|
||||||
onPressed: () {
|
|
||||||
feedBack();
|
|
||||||
showModalBottomSheet(
|
|
||||||
context: context,
|
|
||||||
isScrollControlled: true,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return VideoReplyNewDialog(
|
|
||||||
oid: _dynamicDetailController.oid ??
|
|
||||||
IdUtils.bv2av(Get.parameters['bvid']!),
|
|
||||||
root: 0,
|
|
||||||
parent: 0,
|
|
||||||
replyType: ReplyType.values[replyType],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
).then(
|
|
||||||
(value) => {
|
|
||||||
// 完成评论,数据添加
|
|
||||||
if (value != null && value['data'] != null)
|
|
||||||
{
|
|
||||||
_dynamicDetailController.replyList
|
|
||||||
.add(value['data']),
|
|
||||||
_dynamicDetailController.acount.value++
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
tooltip: '评论动态',
|
|
||||||
child: const Icon(Icons.reply),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
pinned: true,
|
||||||
),
|
),
|
||||||
|
FutureBuilder(
|
||||||
|
future: _futureBuilderFuture,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
|
Map data = snapshot.data as Map;
|
||||||
|
if (snapshot.data['status']) {
|
||||||
|
RxList<ReplyItemModel> replyList =
|
||||||
|
_dynamicDetailController.replyList;
|
||||||
|
// 请求成功
|
||||||
|
return Obx(
|
||||||
|
() => replyList.isEmpty &&
|
||||||
|
_dynamicDetailController.isLoadingMore
|
||||||
|
? SliverList(
|
||||||
|
delegate:
|
||||||
|
SliverChildBuilderDelegate((context, index) {
|
||||||
|
return const VideoReplySkeleton();
|
||||||
|
}, childCount: 8),
|
||||||
|
)
|
||||||
|
: SliverList(
|
||||||
|
delegate: SliverChildBuilderDelegate(
|
||||||
|
(context, index) {
|
||||||
|
if (index == replyList.length) {
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
bottom: MediaQuery.of(context)
|
||||||
|
.padding
|
||||||
|
.bottom),
|
||||||
|
height: MediaQuery.of(context)
|
||||||
|
.padding
|
||||||
|
.bottom +
|
||||||
|
100,
|
||||||
|
child: Center(
|
||||||
|
child: Obx(
|
||||||
|
() => Text(
|
||||||
|
_dynamicDetailController
|
||||||
|
.noMore.value,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.outline,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return ReplyItem(
|
||||||
|
replyItem: replyList[index],
|
||||||
|
showReplyRow: true,
|
||||||
|
replyLevel: '1',
|
||||||
|
replyReply: (replyItem) =>
|
||||||
|
replyReply(replyItem),
|
||||||
|
replyType: ReplyType.values[replyType],
|
||||||
|
addReply: (replyItem) {
|
||||||
|
replyList[index]
|
||||||
|
.replies!
|
||||||
|
.add(replyItem);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
childCount: replyList.length + 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// 请求错误
|
||||||
|
return HttpError(
|
||||||
|
errMsg: data['msg'],
|
||||||
|
fn: () => setState(() {}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 骨架屏
|
||||||
|
return SliverList(
|
||||||
|
delegate: SliverChildBuilderDelegate((context, index) {
|
||||||
|
return const VideoReplySkeleton();
|
||||||
|
}, childCount: 8),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
floatingActionButton: SlideTransition(
|
||||||
|
position: Tween<Offset>(
|
||||||
|
begin: const Offset(0, 2),
|
||||||
|
end: const Offset(0, 0),
|
||||||
|
).animate(
|
||||||
|
CurvedAnimation(
|
||||||
|
parent: fabAnimationCtr,
|
||||||
|
curve: Curves.easeInOut,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: FloatingActionButton(
|
||||||
|
heroTag: null,
|
||||||
|
onPressed: () {
|
||||||
|
feedBack();
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
isScrollControlled: true,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return VideoReplyNewDialog(
|
||||||
|
oid: _dynamicDetailController.oid ??
|
||||||
|
IdUtils.bv2av(Get.parameters['bvid']!),
|
||||||
|
root: 0,
|
||||||
|
parent: 0,
|
||||||
|
replyType: ReplyType.values[replyType],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
).then(
|
||||||
|
(value) => {
|
||||||
|
// 完成评论,数据添加
|
||||||
|
if (value != null && value['data'] != null)
|
||||||
|
{
|
||||||
|
_dynamicDetailController.replyList.add(value['data']),
|
||||||
|
_dynamicDetailController.acount.value++
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
tooltip: '评论动态',
|
||||||
|
child: const Icon(Icons.reply),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,38 +3,58 @@ 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:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
import 'package:pilipala/http/dynamics.dart';
|
import 'package:pilipala/http/dynamics.dart';
|
||||||
import 'package:pilipala/models/dynamics/result.dart';
|
import 'package:pilipala/models/dynamics/result.dart';
|
||||||
import 'package:pilipala/pages/dynamics/index.dart';
|
import 'package:pilipala/pages/dynamics/index.dart';
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
|
import 'package:status_bar_control/status_bar_control.dart';
|
||||||
|
import 'rich_node_panel.dart';
|
||||||
|
|
||||||
class ActionPanel extends StatefulWidget {
|
class ActionPanel extends StatefulWidget {
|
||||||
const ActionPanel({
|
const ActionPanel({
|
||||||
super.key,
|
super.key,
|
||||||
this.item,
|
required this.item,
|
||||||
});
|
});
|
||||||
// ignore: prefer_typing_uninitialized_variables
|
// ignore: prefer_typing_uninitialized_variables
|
||||||
final item;
|
final DynamicItemModel item;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ActionPanel> createState() => _ActionPanelState();
|
State<ActionPanel> createState() => _ActionPanelState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ActionPanelState extends State<ActionPanel> {
|
class _ActionPanelState extends State<ActionPanel>
|
||||||
|
with TickerProviderStateMixin {
|
||||||
final DynamicsController _dynamicsController = Get.put(DynamicsController());
|
final DynamicsController _dynamicsController = Get.put(DynamicsController());
|
||||||
late ModuleStatModel stat;
|
late ModuleStatModel stat;
|
||||||
bool isProcessing = false;
|
bool isProcessing = false;
|
||||||
|
double defaultHeight = 260;
|
||||||
|
RxDouble height = 0.0.obs;
|
||||||
|
RxBool isExpand = false.obs;
|
||||||
|
late double statusHeight;
|
||||||
|
TextEditingController _inputController = TextEditingController();
|
||||||
|
FocusNode myFocusNode = FocusNode();
|
||||||
|
String _inputText = '';
|
||||||
|
|
||||||
void Function()? handleState(Future Function() action) {
|
void Function()? handleState(Future Function() action) {
|
||||||
return isProcessing ? null : () async {
|
return isProcessing
|
||||||
setState(() => isProcessing = true);
|
? null
|
||||||
await action();
|
: () async {
|
||||||
setState(() => isProcessing = false);
|
isProcessing = true;
|
||||||
};
|
await action();
|
||||||
|
isProcessing = false;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
stat = widget.item!.modules.moduleStat;
|
stat = widget.item.modules!.moduleStat!;
|
||||||
|
onInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
onInit() async {
|
||||||
|
statusHeight = await StatusBarControl.getHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 动态点赞
|
// 动态点赞
|
||||||
@ -43,7 +63,7 @@ class _ActionPanelState extends State<ActionPanel> {
|
|||||||
var item = widget.item!;
|
var item = widget.item!;
|
||||||
String dynamicId = item.idStr!;
|
String dynamicId = item.idStr!;
|
||||||
// 1 已点赞 2 不喜欢 0 未操作
|
// 1 已点赞 2 不喜欢 0 未操作
|
||||||
Like like = item.modules.moduleStat.like;
|
Like like = item.modules!.moduleStat!.like!;
|
||||||
int count = like.count == '点赞' ? 0 : int.parse(like.count ?? '0');
|
int count = like.count == '点赞' ? 0 : int.parse(like.count ?? '0');
|
||||||
bool status = like.status!;
|
bool status = like.status!;
|
||||||
int up = status ? 2 : 1;
|
int up = status ? 2 : 1;
|
||||||
@ -51,15 +71,15 @@ class _ActionPanelState extends State<ActionPanel> {
|
|||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
SmartDialog.showToast(!status ? '点赞成功' : '取消赞');
|
SmartDialog.showToast(!status ? '点赞成功' : '取消赞');
|
||||||
if (up == 1) {
|
if (up == 1) {
|
||||||
item.modules.moduleStat.like.count = (count + 1).toString();
|
item.modules!.moduleStat!.like!.count = (count + 1).toString();
|
||||||
item.modules.moduleStat.like.status = true;
|
item.modules!.moduleStat!.like!.status = true;
|
||||||
} else {
|
} else {
|
||||||
if (count == 1) {
|
if (count == 1) {
|
||||||
item.modules.moduleStat.like.count = '点赞';
|
item.modules!.moduleStat!.like!.count = '点赞';
|
||||||
} else {
|
} else {
|
||||||
item.modules.moduleStat.like.count = (count - 1).toString();
|
item.modules!.moduleStat!.like!.count = (count - 1).toString();
|
||||||
}
|
}
|
||||||
item.modules.moduleStat.like.status = false;
|
item.modules!.moduleStat!.like!.status = false;
|
||||||
}
|
}
|
||||||
setState(() {});
|
setState(() {});
|
||||||
} else {
|
} else {
|
||||||
@ -67,17 +87,307 @@ class _ActionPanelState extends State<ActionPanel> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 转发动态预览
|
||||||
|
Widget dynamicPreview() {
|
||||||
|
ItemModulesModel? modules = widget.item.modules;
|
||||||
|
final String type = widget.item.type!;
|
||||||
|
String? cover = modules?.moduleAuthor?.face;
|
||||||
|
switch (type) {
|
||||||
|
/// 图文动态
|
||||||
|
case 'DYNAMIC_TYPE_DRAW':
|
||||||
|
cover = modules?.moduleDynamic?.major?.opus?.pics?.first.url;
|
||||||
|
|
||||||
|
/// 投稿
|
||||||
|
case 'DYNAMIC_TYPE_AV':
|
||||||
|
cover = modules?.moduleDynamic?.major?.archive?.cover;
|
||||||
|
|
||||||
|
/// 转发的动态
|
||||||
|
case 'DYNAMIC_TYPE_FORWARD':
|
||||||
|
String forwardType = widget.item.orig!.type!;
|
||||||
|
switch (forwardType) {
|
||||||
|
/// 图文动态
|
||||||
|
case 'DYNAMIC_TYPE_DRAW':
|
||||||
|
cover = modules?.moduleDynamic?.major?.opus?.pics?.first.url;
|
||||||
|
|
||||||
|
/// 投稿
|
||||||
|
case 'DYNAMIC_TYPE_AV':
|
||||||
|
cover = modules?.moduleDynamic?.major?.archive?.cover;
|
||||||
|
|
||||||
|
/// 专栏文章
|
||||||
|
case 'DYNAMIC_TYPE_ARTICLE':
|
||||||
|
cover = '';
|
||||||
|
|
||||||
|
/// 番剧
|
||||||
|
case 'DYNAMIC_TYPE_PGC':
|
||||||
|
cover = '';
|
||||||
|
|
||||||
|
/// 纯文字动态
|
||||||
|
case 'DYNAMIC_TYPE_WORD':
|
||||||
|
cover = '';
|
||||||
|
|
||||||
|
/// 直播
|
||||||
|
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
||||||
|
cover = '';
|
||||||
|
|
||||||
|
/// 合集查看
|
||||||
|
case 'DYNAMIC_TYPE_UGC_SEASON':
|
||||||
|
cover = '';
|
||||||
|
|
||||||
|
/// 番剧
|
||||||
|
case 'DYNAMIC_TYPE_PGC_UNION':
|
||||||
|
cover = modules?.moduleDynamic?.major?.pgc?.cover;
|
||||||
|
|
||||||
|
default:
|
||||||
|
cover = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 专栏文章
|
||||||
|
case 'DYNAMIC_TYPE_ARTICLE':
|
||||||
|
cover = '';
|
||||||
|
|
||||||
|
/// 番剧
|
||||||
|
case 'DYNAMIC_TYPE_PGC':
|
||||||
|
cover = '';
|
||||||
|
|
||||||
|
/// 纯文字动态
|
||||||
|
case 'DYNAMIC_TYPE_WORD':
|
||||||
|
cover = '';
|
||||||
|
|
||||||
|
/// 直播
|
||||||
|
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
||||||
|
cover = '';
|
||||||
|
|
||||||
|
/// 合集查看
|
||||||
|
case 'DYNAMIC_TYPE_UGC_SEASON':
|
||||||
|
cover = '';
|
||||||
|
|
||||||
|
/// 番剧查看
|
||||||
|
case 'DYNAMIC_TYPE_PGC_UNION':
|
||||||
|
cover = '';
|
||||||
|
|
||||||
|
default:
|
||||||
|
cover = '';
|
||||||
|
}
|
||||||
|
return Container(
|
||||||
|
width: double.infinity,
|
||||||
|
height: 95,
|
||||||
|
margin: const EdgeInsets.fromLTRB(12, 0, 12, 14),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color:
|
||||||
|
Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.4),
|
||||||
|
borderRadius: BorderRadius.circular(6),
|
||||||
|
border: Border(
|
||||||
|
left: BorderSide(
|
||||||
|
width: 4,
|
||||||
|
color: Theme.of(context).colorScheme.primary.withOpacity(0.8)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 14),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'@${widget.item.modules!.moduleAuthor!.name}',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
NetworkImgLayer(
|
||||||
|
src: cover ?? '',
|
||||||
|
width: 34,
|
||||||
|
height: 34,
|
||||||
|
type: 'emote',
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
Expanded(
|
||||||
|
child: Text.rich(
|
||||||
|
style: const TextStyle(height: 0),
|
||||||
|
richNode(widget.item, context),
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Text(data)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 动态转发
|
||||||
|
void forwardHandler() async {
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
enableDrag: false,
|
||||||
|
useRootNavigator: true,
|
||||||
|
isScrollControlled: true,
|
||||||
|
builder: (context) {
|
||||||
|
return Obx(
|
||||||
|
() => AnimatedContainer(
|
||||||
|
duration: Durations.medium1,
|
||||||
|
onEnd: () async {
|
||||||
|
if (isExpand.value) {
|
||||||
|
await Future.delayed(const Duration(milliseconds: 80));
|
||||||
|
myFocusNode.requestFocus();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
height: height.value + MediaQuery.of(context).padding.bottom,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
AnimatedContainer(
|
||||||
|
duration: Durations.medium1,
|
||||||
|
height: isExpand.value ? statusHeight : 0,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.fromLTRB(
|
||||||
|
isExpand.value ? 10 : 16,
|
||||||
|
10,
|
||||||
|
isExpand.value ? 14 : 12,
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
if (isExpand.value) ...[
|
||||||
|
IconButton(
|
||||||
|
onPressed: () => togglePanelState(false),
|
||||||
|
icon: const Icon(Icons.close),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'转发动态',
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.titleMedium!
|
||||||
|
.copyWith(fontWeight: FontWeight.bold),
|
||||||
|
)
|
||||||
|
] else ...[
|
||||||
|
const Text(
|
||||||
|
'转发动态',
|
||||||
|
style: TextStyle(fontWeight: FontWeight.bold),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
isExpand.value
|
||||||
|
? FilledButton(
|
||||||
|
onPressed: () => dynamicForward('forward'),
|
||||||
|
child: const Text('转发'),
|
||||||
|
)
|
||||||
|
: TextButton(
|
||||||
|
onPressed: () {},
|
||||||
|
child: const Text('立即转发'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (!isExpand.value) ...[
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () => togglePanelState(true),
|
||||||
|
behavior: HitTestBehavior.translucent,
|
||||||
|
child: Container(
|
||||||
|
width: double.infinity,
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
padding: const EdgeInsets.fromLTRB(16, 0, 10, 14),
|
||||||
|
child: Text(
|
||||||
|
'说点什么吧',
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).colorScheme.outline),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
] else ...[
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(16, 10, 16, 0),
|
||||||
|
child: TextField(
|
||||||
|
maxLines: 5,
|
||||||
|
focusNode: myFocusNode,
|
||||||
|
controller: _inputController,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
_inputText = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: InputBorder.none,
|
||||||
|
hintText: '说点什么吧',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
dynamicPreview(),
|
||||||
|
if (!isExpand.value) ...[
|
||||||
|
const Divider(thickness: 0.1, height: 1),
|
||||||
|
ListTile(
|
||||||
|
onTap: () => Get.back(),
|
||||||
|
minLeadingWidth: 0,
|
||||||
|
dense: true,
|
||||||
|
title: Text(
|
||||||
|
'取消',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).colorScheme.outline),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
togglePanelState(status) {
|
||||||
|
if (!status) {
|
||||||
|
Get.back();
|
||||||
|
height.value = defaultHeight;
|
||||||
|
_inputText = '';
|
||||||
|
_inputController.clear();
|
||||||
|
} else {
|
||||||
|
height.value = Get.size.height;
|
||||||
|
}
|
||||||
|
isExpand.value = !(isExpand.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamicForward(String type) async {
|
||||||
|
String dynamicId = widget.item.idStr!;
|
||||||
|
var res = await DynamicsHttp.dynamicCreate(
|
||||||
|
dynIdStr: dynamicId,
|
||||||
|
mid: _dynamicsController.userInfo.mid,
|
||||||
|
rawText: _inputText,
|
||||||
|
scene: 4,
|
||||||
|
);
|
||||||
|
if (res['status']) {
|
||||||
|
SmartDialog.showToast(type == 'forward' ? '转发成功' : '发布成功');
|
||||||
|
togglePanelState(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
myFocusNode.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var color = Theme.of(context).colorScheme.outline;
|
var color = Theme.of(context).colorScheme.outline;
|
||||||
var primary = Theme.of(context).colorScheme.primary;
|
var primary = Theme.of(context).colorScheme.primary;
|
||||||
|
height.value = defaultHeight;
|
||||||
|
print('height.value: ${height.value}');
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 1,
|
flex: 1,
|
||||||
child: TextButton.icon(
|
child: TextButton.icon(
|
||||||
onPressed: () {},
|
onPressed: forwardHandler,
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
FontAwesomeIcons.shareFromSquare,
|
FontAwesomeIcons.shareFromSquare,
|
||||||
size: 16,
|
size: 16,
|
||||||
|
|||||||
@ -1,15 +1,16 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/pages/dynamics/index.dart';
|
import 'package:pilipala/pages/dynamics/index.dart';
|
||||||
|
import '../../../models/dynamics/result.dart';
|
||||||
import 'action_panel.dart';
|
import 'action_panel.dart';
|
||||||
import 'author_panel.dart';
|
import 'author_panel.dart';
|
||||||
import 'content_panel.dart';
|
import 'content_panel.dart';
|
||||||
import 'forward_panel.dart';
|
import 'forward_panel.dart';
|
||||||
|
|
||||||
class DynamicPanel extends StatelessWidget {
|
class DynamicPanel extends StatelessWidget {
|
||||||
final dynamic item;
|
final DynamicItemModel item;
|
||||||
final String? source;
|
final String? source;
|
||||||
DynamicPanel({this.item, this.source, Key? key}) : super(key: key);
|
DynamicPanel({required this.item, this.source, Key? key}) : super(key: key);
|
||||||
final DynamicsController _dynamicsController = Get.put(DynamicsController());
|
final DynamicsController _dynamicsController = Get.put(DynamicsController());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -41,8 +42,8 @@ class DynamicPanel extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.fromLTRB(12, 12, 12, 8),
|
padding: const EdgeInsets.fromLTRB(12, 12, 12, 8),
|
||||||
child: AuthorPanel(item: item),
|
child: AuthorPanel(item: item),
|
||||||
),
|
),
|
||||||
if (item!.modules!.moduleDynamic!.desc != null ||
|
if (item.modules!.moduleDynamic!.desc != null ||
|
||||||
item!.modules!.moduleDynamic!.major != null)
|
item.modules!.moduleDynamic!.major != null)
|
||||||
Content(item: item, source: source),
|
Content(item: item, source: source),
|
||||||
forWard(item, context, _dynamicsController, source),
|
forWard(item, context, _dynamicsController, source),
|
||||||
const SizedBox(height: 2),
|
const SizedBox(height: 2),
|
||||||
|
|||||||
@ -10,10 +10,11 @@ import 'package:pilipala/utils/storage.dart';
|
|||||||
class FavController extends GetxController {
|
class FavController extends GetxController {
|
||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
Rx<FavFolderData> favFolderData = FavFolderData().obs;
|
Rx<FavFolderData> favFolderData = FavFolderData().obs;
|
||||||
|
RxList<FavFolderItemData> favFolderList = <FavFolderItemData>[].obs;
|
||||||
Box userInfoCache = GStrorage.userInfo;
|
Box userInfoCache = GStrorage.userInfo;
|
||||||
UserInfoData? userInfo;
|
UserInfoData? userInfo;
|
||||||
int currentPage = 1;
|
int currentPage = 1;
|
||||||
int pageSize = 10;
|
int pageSize = 60;
|
||||||
RxBool hasMore = true.obs;
|
RxBool hasMore = true.obs;
|
||||||
|
|
||||||
Future<dynamic> queryFavFolder({type = 'init'}) async {
|
Future<dynamic> queryFavFolder({type = 'init'}) async {
|
||||||
@ -32,9 +33,10 @@ class FavController extends GetxController {
|
|||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
if (type == 'init') {
|
if (type == 'init') {
|
||||||
favFolderData.value = res['data'];
|
favFolderData.value = res['data'];
|
||||||
|
favFolderList.value = res['data'].list;
|
||||||
} else {
|
} else {
|
||||||
if (res['data'].list.isNotEmpty) {
|
if (res['data'].list.isNotEmpty) {
|
||||||
favFolderData.value.list!.addAll(res['data'].list);
|
favFolderList.addAll(res['data'].list);
|
||||||
favFolderData.update((val) {});
|
favFolderData.update((val) {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -49,4 +51,13 @@ class FavController extends GetxController {
|
|||||||
Future onLoad() async {
|
Future onLoad() async {
|
||||||
queryFavFolder(type: 'onload');
|
queryFavFolder(type: 'onload');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
removeFavFolder({required int mediaIds}) async {
|
||||||
|
for (var i in favFolderList) {
|
||||||
|
if (i.id == mediaIds) {
|
||||||
|
favFolderList.remove(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,11 +62,10 @@ class _FavPageState extends State<FavPage> {
|
|||||||
return Obx(
|
return Obx(
|
||||||
() => ListView.builder(
|
() => ListView.builder(
|
||||||
controller: scrollController,
|
controller: scrollController,
|
||||||
itemCount: _favController.favFolderData.value.list!.length,
|
itemCount: _favController.favFolderList.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return FavItem(
|
return FavItem(
|
||||||
favFolderItem:
|
favFolderItem: _favController.favFolderList[index]);
|
||||||
_favController.favFolderData.value.list![index]);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -13,14 +13,16 @@ class FavItem extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
String heroTag = Utils.makeHeroTag(favFolderItem.fid);
|
String heroTag = Utils.makeHeroTag(favFolderItem.fid);
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () => Get.toNamed(
|
onTap: () async {
|
||||||
'/favDetail',
|
Get.toNamed(
|
||||||
arguments: favFolderItem,
|
'/favDetail',
|
||||||
parameters: {
|
arguments: favFolderItem,
|
||||||
'heroTag': heroTag,
|
parameters: {
|
||||||
'mediaId': favFolderItem.id.toString(),
|
'heroTag': heroTag,
|
||||||
},
|
'mediaId': favFolderItem.id.toString(),
|
||||||
),
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(12, 7, 12, 7),
|
padding: const EdgeInsets.fromLTRB(12, 7, 12, 7),
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
|
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/http/user.dart';
|
import 'package:pilipala/http/user.dart';
|
||||||
import 'package:pilipala/http/video.dart';
|
import 'package:pilipala/http/video.dart';
|
||||||
import 'package:pilipala/models/user/fav_detail.dart';
|
import 'package:pilipala/models/user/fav_detail.dart';
|
||||||
import 'package:pilipala/models/user/fav_folder.dart';
|
import 'package:pilipala/models/user/fav_folder.dart';
|
||||||
|
import 'package:pilipala/pages/fav/index.dart';
|
||||||
|
|
||||||
class FavDetailController extends GetxController {
|
class FavDetailController extends GetxController {
|
||||||
FavFolderItemData? item;
|
FavFolderItemData? item;
|
||||||
@ -74,4 +76,41 @@ class FavDetailController extends GetxController {
|
|||||||
onLoad() {
|
onLoad() {
|
||||||
queryUserFavFolderDetail(type: 'onLoad');
|
queryUserFavFolderDetail(type: 'onLoad');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onDelFavFolder() async {
|
||||||
|
SmartDialog.show(
|
||||||
|
useSystem: true,
|
||||||
|
animationType: SmartAnimationType.centerFade_otherSlide,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('提示'),
|
||||||
|
content: const Text('确定删除这个收藏夹吗?'),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
SmartDialog.dismiss();
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'点错了',
|
||||||
|
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
var res = await UserHttp.delFavFolder(mediaIds: mediaId!);
|
||||||
|
SmartDialog.dismiss();
|
||||||
|
SmartDialog.showToast(res['status'] ? '操作成功' : res['msg']);
|
||||||
|
if (res['status']) {
|
||||||
|
FavController favController = Get.find<FavController>();
|
||||||
|
await favController.removeFavFolder(mediaIds: mediaId!);
|
||||||
|
Get.back();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: const Text('确认'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,6 +53,7 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
|||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_controller.dispose();
|
_controller.dispose();
|
||||||
|
titleStreamC.close();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,11 +101,19 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
|||||||
Get.toNamed('/favSearch?searchType=0&mediaId=$mediaId'),
|
Get.toNamed('/favSearch?searchType=0&mediaId=$mediaId'),
|
||||||
icon: const Icon(Icons.search_outlined),
|
icon: const Icon(Icons.search_outlined),
|
||||||
),
|
),
|
||||||
// IconButton(
|
PopupMenuButton<String>(
|
||||||
// onPressed: () {},
|
icon: const Icon(Icons.more_vert_outlined),
|
||||||
// icon: const Icon(Icons.more_vert),
|
position: PopupMenuPosition.under,
|
||||||
// ),
|
onSelected: (String type) {},
|
||||||
const SizedBox(width: 6),
|
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
|
||||||
|
PopupMenuItem<String>(
|
||||||
|
onTap: () => _favDetailController.onDelFavFolder(),
|
||||||
|
value: 'pause',
|
||||||
|
child: const Text('删除收藏夹'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(width: 14),
|
||||||
],
|
],
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
flexibleSpace: FlexibleSpaceBar(
|
||||||
background: Container(
|
background: Container(
|
||||||
|
|||||||
@ -114,4 +114,10 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
|
|||||||
defaultSearch.value = res.data['data']['name'];
|
defaultSearch.value = res.data['data']['name'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
searchBarStream.close();
|
||||||
|
super.onClose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,4 +101,10 @@ class MainController extends GetxController {
|
|||||||
selectedIndex = defaultIndex != -1 ? defaultIndex : 0;
|
selectedIndex = defaultIndex != -1 ? defaultIndex : 0;
|
||||||
pages = navigationBars.map<Widget>((e) => e['page']).toList();
|
pages = navigationBars.map<Widget>((e) => e['page']).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
bottomBarStream.close();
|
||||||
|
super.onClose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,13 +28,11 @@ class _MediaPageState extends State<MediaPage>
|
|||||||
super.initState();
|
super.initState();
|
||||||
mediaController = Get.put(MediaController());
|
mediaController = Get.put(MediaController());
|
||||||
_futureBuilderFuture = mediaController.queryFavFolder();
|
_futureBuilderFuture = mediaController.queryFavFolder();
|
||||||
ScrollController scrollController = mediaController.scrollController;
|
|
||||||
mediaController.userLogin.listen((status) {
|
mediaController.userLogin.listen((status) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_futureBuilderFuture = mediaController.queryFavFolder();
|
_futureBuilderFuture = mediaController.queryFavFolder();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
handleScrollEvent(scrollController);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -54,6 +54,7 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_extendNestCtr.removeListener(() {});
|
_extendNestCtr.removeListener(() {});
|
||||||
|
appbarStream.close();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import 'package:pilipala/pages/member_dynamics/index.dart';
|
|||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
import '../../common/widgets/http_error.dart';
|
import '../../common/widgets/http_error.dart';
|
||||||
|
import '../../models/dynamics/result.dart';
|
||||||
import '../dynamics/widgets/dynamic_panel.dart';
|
import '../dynamics/widgets/dynamic_panel.dart';
|
||||||
|
|
||||||
class MemberDynamicsPage extends StatefulWidget {
|
class MemberDynamicsPage extends StatefulWidget {
|
||||||
@ -66,7 +67,8 @@ class _MemberDynamicsPageState extends State<MemberDynamicsPage> {
|
|||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
if (snapshot.data != null) {
|
if (snapshot.data != null) {
|
||||||
Map data = snapshot.data as Map;
|
Map data = snapshot.data as Map;
|
||||||
List list = _memberDynamicController.dynamicsList;
|
RxList<DynamicItemModel> list =
|
||||||
|
_memberDynamicController.dynamicsList;
|
||||||
if (data['status']) {
|
if (data['status']) {
|
||||||
return Obx(
|
return Obx(
|
||||||
() => list.isNotEmpty
|
() => list.isNotEmpty
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/models/common/rank_type.dart';
|
import 'package:pilipala/models/common/rank_type.dart';
|
||||||
|
import 'package:pilipala/pages/rank/zone/index.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
class RankController extends GetxController with GetTickerProviderStateMixin {
|
class RankController extends GetxController with GetTickerProviderStateMixin {
|
||||||
@ -29,20 +30,22 @@ class RankController extends GetxController with GetTickerProviderStateMixin {
|
|||||||
|
|
||||||
void onRefresh() {
|
void onRefresh() {
|
||||||
int index = tabController.index;
|
int index = tabController.index;
|
||||||
var ctr = tabsCtrList[index];
|
final ZoneController ctr = tabsCtrList[index];
|
||||||
ctr().onRefresh();
|
ctr.onRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void animateToTop() {
|
void animateToTop() {
|
||||||
int index = tabController.index;
|
int index = tabController.index;
|
||||||
var ctr = tabsCtrList[index];
|
final ZoneController ctr = tabsCtrList[index];
|
||||||
ctr().animateToTop();
|
ctr.animateToTop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTabConfig() async {
|
void setTabConfig() async {
|
||||||
tabs.value = tabsConfig;
|
tabs.value = tabsConfig;
|
||||||
initialIndex.value = 0;
|
initialIndex.value = 0;
|
||||||
tabsCtrList = tabs.map((e) => e['ctr']).toList();
|
tabsCtrList = tabs
|
||||||
|
.map((e) => Get.put(ZoneController(), tag: e['rid'].toString()))
|
||||||
|
.toList();
|
||||||
tabsPageList = tabs.map<Widget>((e) => e['page']).toList();
|
tabsPageList = tabs.map<Widget>((e) => e['page']).toList();
|
||||||
|
|
||||||
tabController = TabController(
|
tabController = TabController(
|
||||||
@ -51,4 +54,10 @@ class RankController extends GetxController with GetTickerProviderStateMixin {
|
|||||||
vsync: this,
|
vsync: this,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
searchBarStream.close();
|
||||||
|
super.onClose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -102,7 +102,7 @@ class _RankPageState extends State<RankPage>
|
|||||||
onTap: (value) {
|
onTap: (value) {
|
||||||
feedBack();
|
feedBack();
|
||||||
if (_rankController.initialIndex.value == value) {
|
if (_rankController.initialIndex.value == value) {
|
||||||
_rankController.tabsCtrList[value]().animateToTop();
|
_rankController.tabsCtrList[value].animateToTop();
|
||||||
}
|
}
|
||||||
_rankController.initialIndex.value = value;
|
_rankController.initialIndex.value = value;
|
||||||
},
|
},
|
||||||
|
|||||||
@ -42,12 +42,15 @@ class ZoneController extends GetxController {
|
|||||||
|
|
||||||
// 返回顶部并刷新
|
// 返回顶部并刷新
|
||||||
void animateToTop() async {
|
void animateToTop() async {
|
||||||
if (scrollController.offset >=
|
if (scrollController.hasClients) {
|
||||||
MediaQuery.of(Get.context!).size.height * 5) {
|
if (scrollController.offset >=
|
||||||
scrollController.jumpTo(0);
|
MediaQuery.of(Get.context!).size.height * 5) {
|
||||||
} else {
|
scrollController.jumpTo(0);
|
||||||
await scrollController.animateTo(0,
|
} else {
|
||||||
duration: const Duration(milliseconds: 500), curve: Curves.easeInOut);
|
await scrollController.animateTo(0,
|
||||||
|
duration: const Duration(milliseconds: 500),
|
||||||
|
curve: Curves.easeInOut);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,6 +53,7 @@ class _SubDetailPageState extends State<SubDetailPage> {
|
|||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_controller.dispose();
|
_controller.dispose();
|
||||||
|
titleStreamC.close();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -58,6 +58,7 @@ class VideoIntroController extends GetxController {
|
|||||||
String heroTag = '';
|
String heroTag = '';
|
||||||
late ModelResult modelResult;
|
late ModelResult modelResult;
|
||||||
PersistentBottomSheetController? bottomSheetController;
|
PersistentBottomSheetController? bottomSheetController;
|
||||||
|
late bool enableRelatedVideo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@ -74,6 +75,8 @@ class VideoIntroController extends GetxController {
|
|||||||
queryOnlineTotal();
|
queryOnlineTotal();
|
||||||
startTimer(); // 在页面加载时启动定时器
|
startTimer(); // 在页面加载时启动定时器
|
||||||
}
|
}
|
||||||
|
enableRelatedVideo =
|
||||||
|
setting.get(SettingBoxKey.enableRelatedVideo, defaultValue: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取视频简介&分p
|
// 获取视频简介&分p
|
||||||
@ -447,15 +450,18 @@ class VideoIntroController extends GetxController {
|
|||||||
// 重新获取视频资源
|
// 重新获取视频资源
|
||||||
final VideoDetailController videoDetailCtr =
|
final VideoDetailController videoDetailCtr =
|
||||||
Get.find<VideoDetailController>(tag: heroTag);
|
Get.find<VideoDetailController>(tag: heroTag);
|
||||||
final ReleatedController releatedCtr =
|
if (enableRelatedVideo) {
|
||||||
Get.find<ReleatedController>(tag: heroTag);
|
final ReleatedController releatedCtr =
|
||||||
|
Get.find<ReleatedController>(tag: heroTag);
|
||||||
|
releatedCtr.bvid = bvid;
|
||||||
|
releatedCtr.queryRelatedVideo();
|
||||||
|
}
|
||||||
|
|
||||||
videoDetailCtr.bvid = bvid;
|
videoDetailCtr.bvid = bvid;
|
||||||
videoDetailCtr.oid.value = aid ?? IdUtils.bv2av(bvid);
|
videoDetailCtr.oid.value = aid ?? IdUtils.bv2av(bvid);
|
||||||
videoDetailCtr.cid.value = cid;
|
videoDetailCtr.cid.value = cid;
|
||||||
videoDetailCtr.danmakuCid.value = cid;
|
videoDetailCtr.danmakuCid.value = cid;
|
||||||
videoDetailCtr.queryVideoUrl();
|
videoDetailCtr.queryVideoUrl();
|
||||||
releatedCtr.bvid = bvid;
|
|
||||||
releatedCtr.queryRelatedVideo();
|
|
||||||
// 重新请求评论
|
// 重新请求评论
|
||||||
try {
|
try {
|
||||||
/// 未渲染回复组件时可能异常
|
/// 未渲染回复组件时可能异常
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import 'package:get/get.dart';
|
|||||||
import 'package:pilipala/models/video_detail_res.dart';
|
import 'package:pilipala/models/video_detail_res.dart';
|
||||||
import 'package:pilipala/pages/video/detail/index.dart';
|
import 'package:pilipala/pages/video/detail/index.dart';
|
||||||
import 'package:pilipala/pages/video/detail/introduction/index.dart';
|
import 'package:pilipala/pages/video/detail/introduction/index.dart';
|
||||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
|
||||||
import '../../../../../common/pages_bottom_sheet.dart';
|
import '../../../../../common/pages_bottom_sheet.dart';
|
||||||
import '../../../../../models/common/video_episode_type.dart';
|
import '../../../../../models/common/video_episode_type.dart';
|
||||||
|
|
||||||
@ -35,7 +34,6 @@ class _PagesPanelState extends State<PagesPanel> {
|
|||||||
final String heroTag = Get.arguments['heroTag'];
|
final String heroTag = Get.arguments['heroTag'];
|
||||||
late VideoDetailController _videoDetailController;
|
late VideoDetailController _videoDetailController;
|
||||||
final ScrollController listViewScrollCtr = ScrollController();
|
final ScrollController listViewScrollCtr = ScrollController();
|
||||||
final ItemScrollController itemScrollController = ItemScrollController();
|
|
||||||
late PersistentBottomSheetController? _bottomSheetController;
|
late PersistentBottomSheetController? _bottomSheetController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -60,7 +58,6 @@ class _PagesPanelState extends State<PagesPanel> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void changeFucCall(item, i) async {
|
void changeFucCall(item, i) async {
|
||||||
print('pages changeFucCall');
|
|
||||||
widget.changeFuc?.call(item.cid);
|
widget.changeFuc?.call(item.cid);
|
||||||
currentIndex.value = i;
|
currentIndex.value = i;
|
||||||
_bottomSheetController?.close();
|
_bottomSheetController?.close();
|
||||||
@ -72,11 +69,15 @@ class _PagesPanelState extends State<PagesPanel> {
|
|||||||
// 在回调函数中获取更新后的状态
|
// 在回调函数中获取更新后的状态
|
||||||
final double offset = min((currentIndex * 150) - 75,
|
final double offset = min((currentIndex * 150) - 75,
|
||||||
listViewScrollCtr.position.maxScrollExtent);
|
listViewScrollCtr.position.maxScrollExtent);
|
||||||
listViewScrollCtr.animateTo(
|
if (currentIndex.value == 0) {
|
||||||
offset,
|
listViewScrollCtr.jumpTo(0);
|
||||||
duration: const Duration(milliseconds: 300),
|
} else {
|
||||||
curve: Curves.easeInOut,
|
listViewScrollCtr.animateTo(
|
||||||
);
|
offset,
|
||||||
|
duration: const Duration(milliseconds: 300),
|
||||||
|
curve: Curves.easeInOut,
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import 'package:pilipala/common/pages_bottom_sheet.dart';
|
|||||||
import 'package:pilipala/models/video_detail_res.dart';
|
import 'package:pilipala/models/video_detail_res.dart';
|
||||||
import 'package:pilipala/pages/video/detail/index.dart';
|
import 'package:pilipala/pages/video/detail/index.dart';
|
||||||
import 'package:pilipala/utils/id_utils.dart';
|
import 'package:pilipala/utils/id_utils.dart';
|
||||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
|
||||||
import '../../../../../models/common/video_episode_type.dart';
|
import '../../../../../models/common/video_episode_type.dart';
|
||||||
import '../controller.dart';
|
import '../controller.dart';
|
||||||
|
|
||||||
@ -33,7 +32,6 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
late RxInt currentIndex = (-1).obs;
|
late RxInt currentIndex = (-1).obs;
|
||||||
final String heroTag = Get.arguments['heroTag'];
|
final String heroTag = Get.arguments['heroTag'];
|
||||||
late VideoDetailController _videoDetailController;
|
late VideoDetailController _videoDetailController;
|
||||||
final ItemScrollController itemScrollController = ItemScrollController();
|
|
||||||
late PersistentBottomSheetController? _bottomSheetController;
|
late PersistentBottomSheetController? _bottomSheetController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'dart:async';
|
|||||||
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/http/dynamics.dart';
|
||||||
import 'package:pilipala/http/video.dart';
|
import 'package:pilipala/http/video.dart';
|
||||||
import 'package:pilipala/models/common/reply_type.dart';
|
import 'package:pilipala/models/common/reply_type.dart';
|
||||||
import 'package:pilipala/models/video/reply/emote.dart';
|
import 'package:pilipala/models/video/reply/emote.dart';
|
||||||
@ -40,6 +41,8 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
|
|||||||
double keyboardHeight = 0.0; // 键盘高度
|
double keyboardHeight = 0.0; // 键盘高度
|
||||||
final _debouncer = Debouncer(milliseconds: 200); // 设置延迟时间
|
final _debouncer = Debouncer(milliseconds: 200); // 设置延迟时间
|
||||||
String toolbarType = 'input';
|
String toolbarType = 'input';
|
||||||
|
RxBool isForward = false.obs;
|
||||||
|
RxBool showForward = false.obs;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -52,6 +55,10 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
|
|||||||
_autoFocus();
|
_autoFocus();
|
||||||
// 监听聚焦状态
|
// 监听聚焦状态
|
||||||
_focuslistener();
|
_focuslistener();
|
||||||
|
final String routePath = Get.currentRoute;
|
||||||
|
if (routePath.startsWith('/video')) {
|
||||||
|
showForward.value = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_autoFocus() async {
|
_autoFocus() async {
|
||||||
@ -88,6 +95,16 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
|
|||||||
Get.back(result: {
|
Get.back(result: {
|
||||||
'data': ReplyItemModel.fromJson(result['data']['reply'], ''),
|
'data': ReplyItemModel.fromJson(result['data']['reply'], ''),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// 投稿、番剧页面
|
||||||
|
if (isForward.value) {
|
||||||
|
await DynamicsHttp.dynamicCreate(
|
||||||
|
mid: 0,
|
||||||
|
rawText: message,
|
||||||
|
oid: widget.oid!,
|
||||||
|
scene: 5,
|
||||||
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(result['msg']);
|
SmartDialog.showToast(result['msg']);
|
||||||
}
|
}
|
||||||
@ -145,7 +162,6 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
|
|||||||
double _keyboardHeight = EdgeInsets.fromViewPadding(
|
double _keyboardHeight = EdgeInsets.fromViewPadding(
|
||||||
View.of(context).viewInsets, View.of(context).devicePixelRatio)
|
View.of(context).viewInsets, View.of(context).devicePixelRatio)
|
||||||
.bottom;
|
.bottom;
|
||||||
print('_keyboardHeight: $_keyboardHeight');
|
|
||||||
return Container(
|
return Container(
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -225,9 +241,37 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
|
|||||||
toolbarType: toolbarType,
|
toolbarType: toolbarType,
|
||||||
selected: toolbarType == 'emote',
|
selected: toolbarType == 'emote',
|
||||||
),
|
),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
Obx(
|
||||||
|
() => showForward.value
|
||||||
|
? TextButton.icon(
|
||||||
|
onPressed: () {
|
||||||
|
isForward.value = !isForward.value;
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
isForward.value
|
||||||
|
? Icons.check_box
|
||||||
|
: Icons.check_box_outline_blank,
|
||||||
|
size: 22),
|
||||||
|
label: const Text('转发到动态'),
|
||||||
|
style: ButtonStyle(
|
||||||
|
foregroundColor: MaterialStateProperty.all(
|
||||||
|
isForward.value
|
||||||
|
? Theme.of(context).colorScheme.primary
|
||||||
|
: Theme.of(context).colorScheme.outline,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: const SizedBox(),
|
||||||
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
TextButton(
|
SizedBox(
|
||||||
onPressed: () => submitReplyAdd(), child: const Text('发送'))
|
height: 36,
|
||||||
|
child: FilledButton(
|
||||||
|
onPressed: () => submitReplyAdd(),
|
||||||
|
child: const Text('发送'),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -180,11 +180,20 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
plPlayerController?.isFullScreen.listen((bool isFullScreen) {
|
plPlayerController?.isFullScreen.listen((bool isFullScreen) {
|
||||||
if (isFullScreen) {
|
if (isFullScreen) {
|
||||||
vdCtr.hiddenReplyReplyPanel();
|
vdCtr.hiddenReplyReplyPanel();
|
||||||
videoIntroController.hiddenEpisodeBottomSheet();
|
if (vdCtr.videoType == SearchType.video) {
|
||||||
if (videoIntroController.videoDetail.value.ugcSeason != null ||
|
videoIntroController.hiddenEpisodeBottomSheet();
|
||||||
(videoIntroController.videoDetail.value.pages != null &&
|
if (videoIntroController.videoDetail.value.ugcSeason != null ||
|
||||||
videoIntroController.videoDetail.value.pages!.length > 1)) {
|
(videoIntroController.videoDetail.value.pages != null &&
|
||||||
vdCtr.bottomList.insert(3, BottomControlType.episode);
|
videoIntroController.videoDetail.value.pages!.length > 1)) {
|
||||||
|
vdCtr.bottomList.insert(3, BottomControlType.episode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (vdCtr.videoType == SearchType.media_bangumi) {
|
||||||
|
bangumiIntroController.hiddenEpisodeBottomSheet();
|
||||||
|
if (bangumiIntroController.bangumiDetail.value.episodes != null &&
|
||||||
|
bangumiIntroController.bangumiDetail.value.episodes!.length > 1) {
|
||||||
|
vdCtr.bottomList.insert(3, BottomControlType.episode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (vdCtr.bottomList.contains(BottomControlType.episode)) {
|
if (vdCtr.bottomList.contains(BottomControlType.episode)) {
|
||||||
@ -395,27 +404,41 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
width: 38,
|
width: 38,
|
||||||
height: 38,
|
height: 38,
|
||||||
child: Obx(
|
child: Obx(
|
||||||
() => IconButton(
|
() => !vdCtr.isShowCover.value
|
||||||
onPressed: () {
|
? IconButton(
|
||||||
plPlayerController?.isOpenDanmu.value =
|
onPressed: () {
|
||||||
!(plPlayerController?.isOpenDanmu.value ??
|
plPlayerController?.isOpenDanmu.value =
|
||||||
false);
|
!(plPlayerController
|
||||||
},
|
?.isOpenDanmu.value ??
|
||||||
icon: !(plPlayerController?.isOpenDanmu.value ??
|
false);
|
||||||
false)
|
},
|
||||||
? SvgPicture.asset(
|
icon:
|
||||||
|
!(plPlayerController?.isOpenDanmu.value ??
|
||||||
|
false)
|
||||||
|
? SvgPicture.asset(
|
||||||
|
'assets/images/video/danmu_close.svg',
|
||||||
|
// ignore: deprecated_member_use
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.outline,
|
||||||
|
)
|
||||||
|
: SvgPicture.asset(
|
||||||
|
'assets/images/video/danmu_open.svg',
|
||||||
|
// ignore: deprecated_member_use
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primary,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: IconButton(
|
||||||
|
icon: SvgPicture.asset(
|
||||||
'assets/images/video/danmu_close.svg',
|
'assets/images/video/danmu_close.svg',
|
||||||
// ignore: deprecated_member_use
|
// ignore: deprecated_member_use
|
||||||
color:
|
color:
|
||||||
Theme.of(context).colorScheme.outline,
|
Theme.of(context).colorScheme.outline,
|
||||||
)
|
|
||||||
: SvgPicture.asset(
|
|
||||||
'assets/images/video/danmu_open.svg',
|
|
||||||
// ignore: deprecated_member_use
|
|
||||||
color:
|
|
||||||
Theme.of(context).colorScheme.primary,
|
|
||||||
),
|
),
|
||||||
),
|
onPressed: () {},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 18),
|
const SizedBox(width: 18),
|
||||||
|
|||||||
@ -49,7 +49,7 @@ class AiDetail extends StatelessWidget {
|
|||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
SelectableText(
|
||||||
modelResult!.summary!,
|
modelResult!.summary!,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
@ -60,13 +60,15 @@ class AiDetail extends StatelessWidget {
|
|||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
ListView.builder(
|
ListView.builder(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: modelResult!.outline!.length,
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
itemCount: modelResult!.outline!.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
|
final outline = modelResult!.outline![index];
|
||||||
return Column(
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
SelectableText(
|
||||||
modelResult!.outline![index].title!,
|
outline.title!,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@ -77,76 +79,59 @@ class AiDetail extends StatelessWidget {
|
|||||||
ListView.builder(
|
ListView.builder(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
itemCount: modelResult!
|
itemCount: outline.partOutline!.length,
|
||||||
.outline![index].partOutline!.length,
|
|
||||||
itemBuilder: (context, i) {
|
itemBuilder: (context, i) {
|
||||||
|
final part = outline.partOutline![i];
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Wrap(
|
GestureDetector(
|
||||||
children: [
|
onTap: () {
|
||||||
RichText(
|
try {
|
||||||
text: TextSpan(
|
final controller =
|
||||||
style: TextStyle(
|
Get.find<VideoDetailController>(
|
||||||
fontSize: 13,
|
tag: Get.arguments['heroTag'],
|
||||||
color: Theme.of(context)
|
);
|
||||||
.colorScheme
|
controller.plPlayerController.seekTo(
|
||||||
.onBackground,
|
Duration(
|
||||||
height: 1.5,
|
seconds: Utils.duration(
|
||||||
|
Utils.tampToSeektime(
|
||||||
|
part.timestamp!),
|
||||||
|
).toInt(),
|
||||||
),
|
),
|
||||||
children: [
|
);
|
||||||
TextSpan(
|
} catch (_) {}
|
||||||
text: Utils.tampToSeektime(
|
},
|
||||||
modelResult!
|
child: SelectableText.rich(
|
||||||
.outline![index]
|
TextSpan(
|
||||||
.partOutline![i]
|
style: TextStyle(
|
||||||
.timestamp!),
|
fontSize: 13,
|
||||||
style: TextStyle(
|
color: Theme.of(context)
|
||||||
color: Theme.of(context)
|
.colorScheme
|
||||||
.colorScheme
|
.onBackground,
|
||||||
.primary,
|
height: 1.5,
|
||||||
),
|
|
||||||
recognizer: TapGestureRecognizer()
|
|
||||||
..onTap = () {
|
|
||||||
// 跳转到指定位置
|
|
||||||
try {
|
|
||||||
Get.find<VideoDetailController>(
|
|
||||||
tag: Get.arguments[
|
|
||||||
'heroTag'])
|
|
||||||
.plPlayerController
|
|
||||||
.seekTo(
|
|
||||||
Duration(
|
|
||||||
seconds:
|
|
||||||
Utils.duration(
|
|
||||||
Utils.tampToSeektime(modelResult!
|
|
||||||
.outline![
|
|
||||||
index]
|
|
||||||
.partOutline![
|
|
||||||
i]
|
|
||||||
.timestamp!)
|
|
||||||
.toString(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} catch (_) {}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const TextSpan(text: ' '),
|
|
||||||
TextSpan(
|
|
||||||
text: modelResult!
|
|
||||||
.outline![index]
|
|
||||||
.partOutline![i]
|
|
||||||
.content!),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
children: [
|
||||||
|
TextSpan(
|
||||||
|
text: Utils.tampToSeektime(
|
||||||
|
part.timestamp!),
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const TextSpan(text: ' '),
|
||||||
|
TextSpan(text: part.content!),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1306,20 +1306,6 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
],
|
],
|
||||||
|
|
||||||
/// 字幕
|
/// 字幕
|
||||||
// SizedBox(
|
|
||||||
// width: 34,
|
|
||||||
// height: 34,
|
|
||||||
// child: IconButton(
|
|
||||||
// style: ButtonStyle(
|
|
||||||
// padding: MaterialStateProperty.all(EdgeInsets.zero),
|
|
||||||
// ),
|
|
||||||
// onPressed: () => showSubtitleDialog(),
|
|
||||||
// icon: const Icon(
|
|
||||||
// Icons.closed_caption_off,
|
|
||||||
// size: 22,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
ComBtn(
|
ComBtn(
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.closed_caption_off,
|
Icons.closed_caption_off,
|
||||||
|
|||||||
@ -473,17 +473,17 @@ class PlPlayerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 字幕
|
// 字幕
|
||||||
if (dataSource.subFiles != '' && dataSource.subFiles != null) {
|
// if (dataSource.subFiles != '' && dataSource.subFiles != null) {
|
||||||
await pp.setProperty(
|
// await pp.setProperty(
|
||||||
'sub-files',
|
// 'sub-files',
|
||||||
UniversalPlatform.isWindows
|
// UniversalPlatform.isWindows
|
||||||
? dataSource.subFiles!.replaceAll(';', '\\;')
|
// ? dataSource.subFiles!.replaceAll(';', '\\;')
|
||||||
: dataSource.subFiles!.replaceAll(':', '\\:'),
|
// : dataSource.subFiles!.replaceAll(':', '\\:'),
|
||||||
);
|
// );
|
||||||
await pp.setProperty("subs-with-matching-audio", "no");
|
// await pp.setProperty("subs-with-matching-audio", "no");
|
||||||
await pp.setProperty("sub-forced-only", "yes");
|
// await pp.setProperty("sub-forced-only", "yes");
|
||||||
await pp.setProperty("blend-subtitles", "video");
|
// await pp.setProperty("blend-subtitles", "video");
|
||||||
}
|
// }
|
||||||
|
|
||||||
_videoController = _videoController ??
|
_videoController = _videoController ??
|
||||||
VideoController(
|
VideoController(
|
||||||
@ -522,7 +522,22 @@ class PlPlayerController {
|
|||||||
Duration seekTo = Duration.zero,
|
Duration seekTo = Duration.zero,
|
||||||
Duration? duration,
|
Duration? duration,
|
||||||
}) async {
|
}) async {
|
||||||
// 设置倍速
|
getVideoFit();
|
||||||
|
// if (_looping) {
|
||||||
|
// await setLooping(_looping);
|
||||||
|
// }
|
||||||
|
|
||||||
|
/// 跳转播放
|
||||||
|
if (seekTo != Duration.zero) {
|
||||||
|
await this.seekTo(seekTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 自动播放
|
||||||
|
if (_autoPlay) {
|
||||||
|
await play(duration: duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 设置倍速
|
||||||
if (videoType.value == 'live') {
|
if (videoType.value == 'live') {
|
||||||
await setPlaybackSpeed(1.0);
|
await setPlaybackSpeed(1.0);
|
||||||
} else {
|
} else {
|
||||||
@ -532,20 +547,6 @@ class PlPlayerController {
|
|||||||
await setPlaybackSpeed(1.0);
|
await setPlaybackSpeed(1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getVideoFit();
|
|
||||||
// if (_looping) {
|
|
||||||
// await setLooping(_looping);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 跳转播放
|
|
||||||
if (seekTo != Duration.zero) {
|
|
||||||
await this.seekTo(seekTo);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 自动播放
|
|
||||||
if (_autoPlay) {
|
|
||||||
await play(duration: duration);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<StreamSubscription> subscriptions = [];
|
List<StreamSubscription> subscriptions = [];
|
||||||
@ -603,7 +604,9 @@ class PlPlayerController {
|
|||||||
makeHeartBeat(event.inSeconds);
|
makeHeartBeat(event.inSeconds);
|
||||||
}),
|
}),
|
||||||
videoPlayerController!.stream.duration.listen((event) {
|
videoPlayerController!.stream.duration.listen((event) {
|
||||||
duration.value = event;
|
if (event > Duration.zero) {
|
||||||
|
duration.value = event;
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
videoPlayerController!.stream.buffer.listen((event) {
|
videoPlayerController!.stream.buffer.listen((event) {
|
||||||
_buffered.value = event;
|
_buffered.value = event;
|
||||||
@ -646,32 +649,38 @@ class PlPlayerController {
|
|||||||
|
|
||||||
/// 跳转至指定位置
|
/// 跳转至指定位置
|
||||||
Future<void> seekTo(Duration position, {type = 'seek'}) async {
|
Future<void> seekTo(Duration position, {type = 'seek'}) async {
|
||||||
if (position < Duration.zero) {
|
try {
|
||||||
position = Duration.zero;
|
if (position < Duration.zero) {
|
||||||
}
|
position = Duration.zero;
|
||||||
_position.value = position;
|
|
||||||
updatePositionSecond();
|
|
||||||
_heartDuration = position.inSeconds;
|
|
||||||
if (duration.value.inSeconds != 0) {
|
|
||||||
if (type != 'slider') {
|
|
||||||
/// 拖动进度条调节时,不等待第一帧,防止抖动
|
|
||||||
await _videoPlayerController?.stream.buffer.first;
|
|
||||||
}
|
}
|
||||||
await _videoPlayerController?.seek(position);
|
_position.value = position;
|
||||||
} else {
|
updatePositionSecond();
|
||||||
_timerForSeek?.cancel();
|
_heartDuration = position.inSeconds;
|
||||||
_timerForSeek ??=
|
if (duration.value.inSeconds != 0) {
|
||||||
Timer.periodic(const Duration(milliseconds: 200), (Timer t) async {
|
if (type != 'slider') {
|
||||||
if (duration.value.inSeconds != 0) {
|
await _videoPlayerController?.stream.buffer.first;
|
||||||
await _videoPlayerController!.stream.buffer.first;
|
|
||||||
await _videoPlayerController?.seek(position);
|
|
||||||
t.cancel();
|
|
||||||
_timerForSeek = null;
|
|
||||||
}
|
}
|
||||||
});
|
await _videoPlayerController?.seek(position);
|
||||||
|
} else {
|
||||||
|
_timerForSeek?.cancel();
|
||||||
|
_timerForSeek ??= _startSeekTimer(position);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
print('Error while seeking: $err');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer? _startSeekTimer(Duration position) {
|
||||||
|
return Timer.periodic(const Duration(milliseconds: 200), (Timer t) async {
|
||||||
|
if (duration.value.inSeconds != 0) {
|
||||||
|
await _videoPlayerController!.stream.buffer.first;
|
||||||
|
await _videoPlayerController?.seek(position);
|
||||||
|
t.cancel();
|
||||||
|
_timerForSeek = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// 设置倍速
|
/// 设置倍速
|
||||||
Future<void> setPlaybackSpeed(double speed) async {
|
Future<void> setPlaybackSpeed(double speed) async {
|
||||||
/// TODO _duration.value丢失
|
/// TODO _duration.value丢失
|
||||||
@ -708,11 +717,10 @@ class PlPlayerController {
|
|||||||
await seekTo(Duration.zero);
|
await seekTo(Duration.zero);
|
||||||
}
|
}
|
||||||
await _videoPlayerController?.play();
|
await _videoPlayerController?.play();
|
||||||
|
playerStatus.status.value = PlayerStatus.playing;
|
||||||
await getCurrentVolume();
|
await getCurrentVolume();
|
||||||
await getCurrentBrightness();
|
await getCurrentBrightness();
|
||||||
|
|
||||||
playerStatus.status.value = PlayerStatus.playing;
|
|
||||||
// screenManager.setOverlays(false);
|
// screenManager.setOverlays(false);
|
||||||
|
|
||||||
/// 临时fix _duration.value丢失
|
/// 临时fix _duration.value丢失
|
||||||
|
|||||||
@ -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('个人空间');
|
||||||
|
|||||||
@ -7,11 +7,7 @@ import 'package:get/get.dart';
|
|||||||
import '../pages/home/index.dart';
|
import '../pages/home/index.dart';
|
||||||
import '../pages/main/index.dart';
|
import '../pages/main/index.dart';
|
||||||
|
|
||||||
void handleScrollEvent(
|
void handleScrollEvent(ScrollController scrollController) {
|
||||||
ScrollController scrollController,
|
|
||||||
// StreamController<bool> mainStream,
|
|
||||||
// StreamController<bool>? searchBarStream,
|
|
||||||
) {
|
|
||||||
StreamController<bool> mainStream =
|
StreamController<bool> mainStream =
|
||||||
Get.find<MainController>().bottomBarStream;
|
Get.find<MainController>().bottomBarStream;
|
||||||
StreamController<bool> searchBarStream =
|
StreamController<bool> searchBarStream =
|
||||||
@ -20,15 +16,17 @@ void handleScrollEvent(
|
|||||||
'stream-throttler',
|
'stream-throttler',
|
||||||
const Duration(milliseconds: 300),
|
const Duration(milliseconds: 300),
|
||||||
() {
|
() {
|
||||||
final ScrollDirection direction =
|
try {
|
||||||
scrollController.position.userScrollDirection;
|
final ScrollDirection direction =
|
||||||
if (direction == ScrollDirection.forward) {
|
scrollController.position.userScrollDirection;
|
||||||
mainStream.add(true);
|
if (direction == ScrollDirection.forward) {
|
||||||
searchBarStream.add(true);
|
mainStream.add(true);
|
||||||
} else if (direction == ScrollDirection.reverse) {
|
searchBarStream.add(true);
|
||||||
mainStream.add(false);
|
} else if (direction == ScrollDirection.reverse) {
|
||||||
searchBarStream.add(false);
|
mainStream.add(false);
|
||||||
}
|
searchBarStream.add(false);
|
||||||
|
}
|
||||||
|
} catch (_) {}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,8 +5,8 @@ class SubTitleUtils {
|
|||||||
|
|
||||||
for (int i = 0; i < jsonData.length; i++) {
|
for (int i = 0; i < jsonData.length; i++) {
|
||||||
final item = jsonData[i];
|
final item = jsonData[i];
|
||||||
double from = item['from'] as double;
|
double from = double.parse(item['from'].toString());
|
||||||
double to = item['to'] as double;
|
double to = double.parse(item['to'].toString());
|
||||||
int sid = (item['sid'] ?? 0) as int;
|
int sid = (item['sid'] ?? 0) as int;
|
||||||
String content = item['content'] as String;
|
String content = item['content'] as String;
|
||||||
|
|
||||||
|
|||||||
@ -210,15 +210,18 @@ class Utils {
|
|||||||
int minDiff = 127;
|
int minDiff = 127;
|
||||||
int closestNumber = 0; // 初始化为0,表示没有找到比目标值小的整数
|
int closestNumber = 0; // 初始化为0,表示没有找到比目标值小的整数
|
||||||
|
|
||||||
|
if (numbers.contains(target)) {
|
||||||
|
return target;
|
||||||
|
}
|
||||||
// 向下查找
|
// 向下查找
|
||||||
try {
|
try {
|
||||||
for (int number in numbers) {
|
for (int number in numbers) {
|
||||||
if (number < target) {
|
if (number < target) {
|
||||||
int diff = target - number; // 计算目标值与当前整数的差值
|
int diff = target - number; // 计算目标值与当前整数的差值
|
||||||
|
|
||||||
if (diff < minDiff) {
|
if (diff < minDiff) {
|
||||||
minDiff = diff;
|
minDiff = diff;
|
||||||
closestNumber = number;
|
closestNumber = number;
|
||||||
|
return closestNumber;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user