logo和名称替换

This commit is contained in:
谢宇宁
2026-10-14 11:23:36 +07:00
parent 1cb514cd02
commit c5c04a7967
478 changed files with 8990 additions and 4948 deletions
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/hj_utils/api_service/drama_service.dart';
import 'package:hgmj/hj_utils/const.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/hj_utils/api_service/drama_service.dart';
import 'package:wydj/hj_utils/const.dart';
import 'package:wydj/hj_utils/screen.dart';
import '../../../hj_model/video_model.dart';
import '../../../tools_base/toast.dart';
@@ -171,7 +171,8 @@ class _VideoCacheCellState extends State<VideoCacheCell> {
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: const TextStyle(fontSize: 11, color: Color(0xffd43f61), height: 1.5),
style: const TextStyle(
fontSize: 11, color: Color(0xffd43f61), height: 1.5),
),
),
// 仅下载完成且非动漫显示"保存到相册",避免下载中误触 + 右侧溢出
@@ -218,7 +219,8 @@ class _VideoCacheCellState extends State<VideoCacheCell> {
child: Text(
"${(model.progress * 100).toStringAsFixed(1)}%",
textAlign: TextAlign.right,
style: const TextStyle(fontSize: 11, color: Color(0xffaab2b7), height: 1.2),
style: const TextStyle(
fontSize: 11, color: Color(0xffaab2b7), height: 1.2),
),
),
],
@@ -282,7 +284,8 @@ class _VideoCacheCellState extends State<VideoCacheCell> {
mainAxisSize: MainAxisSize.min, // 按内容收窄,不再固定 120 宽
children: [
Image.asset(
(isDownloading ? "cache_stop.webp" : "cache_start.webp").videoPath,
(isDownloading ? "cache_stop.webp" : "cache_start.webp")
.videoPath,
width: 10,
fit: BoxFit.cover,
),
@@ -323,7 +326,8 @@ class _VideoCacheCellState extends State<VideoCacheCell> {
),
),
child: Image.asset(
(selected ? "cache_selected.webp" : "cache_unselected.webp").videoPath,
(selected ? "cache_selected.webp" : "cache_unselected.webp")
.videoPath,
key: ValueKey(selected),
width: 40,
height: 40,
@@ -366,7 +370,8 @@ class VideoACGCacheCell extends StatelessWidget {
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 12,
color: model.updateStatus == 2 ? Color(0xff757575) : Color(0xffFFC000),
color:
model.updateStatus == 2 ? Color(0xff757575) : Color(0xffFFC000),
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/hj_utils/const.dart';
import 'package:hgmj/tools_base/debug_log.dart';
import 'package:hgmj/tools_base/toast.dart';
import 'package:wydj/hj_utils/const.dart';
import 'package:wydj/tools_base/debug_log.dart';
import 'package:wydj/tools_base/toast.dart';
import '../../../hj_model/video_model.dart';
import '../../../tools_base/video_download/video_cache_store.dart';
@@ -13,7 +13,12 @@ class VideoCacheLogic extends GetxController with GetTickerProviderStateMixin {
static const removeAnimDuration = Duration(milliseconds: 260);
//顺序与 _cacheMap 一致
final tabStyles = const [MediaStyle.Video, MediaStyle.ShortVideo, MediaStyle.Drama, MediaStyle.Cartoon];
final tabStyles = const [
MediaStyle.Video,
MediaStyle.ShortVideo,
MediaStyle.Drama,
MediaStyle.Cartoon
];
late final tabTitles = tabStyles.map((e) => e.cacheTabTitle).toList();
@@ -31,7 +36,8 @@ class VideoCacheLogic extends GetxController with GetTickerProviderStateMixin {
List<VideoModel> listOf(MediaStyle style) => _cacheMap[style] ?? const [];
List<VideoModel> get allVideos => [for (final list in _cacheMap.values) ...list];
List<VideoModel> get allVideos =>
[for (final list in _cacheMap.values) ...list];
bool isLoading = true;
bool isEditing = false;
@@ -73,7 +79,9 @@ class VideoCacheLogic extends GetxController with GetTickerProviderStateMixin {
/// cell 挂载时注册自己的局部刷新回调
void registerCellRefresher(VideoModel model, VoidCallback refresh) {
_cellRefreshers.putIfAbsent(VideoDownloadManager.taskKey(model.realVideoUrl), () => {}).add(refresh);
_cellRefreshers
.putIfAbsent(VideoDownloadManager.taskKey(model.realVideoUrl), () => {})
.add(refresh);
}
/// cell 卸载 / 换绑视频时注销
@@ -115,7 +123,8 @@ class VideoCacheLogic extends GetxController with GetTickerProviderStateMixin {
for (final entry in _cacheMap.entries) {
entry.value
..clear()
..addAll(await VideoCacheStore.instance.getMovieCacheVideoList(entry.key));
..addAll(
await VideoCacheStore.instance.getMovieCacheVideoList(entry.key));
}
// 本地记录只有 url,进度/暂停态要逐条问下载器;顺带把 _callback 挂上去
for (final item in allVideos) {
@@ -223,7 +232,8 @@ class VideoCacheLogic extends GetxController with GetTickerProviderStateMixin {
// 表现为「短视频页点下载 → 来缓存页看一眼 → 退回去,那个按钮的进度就再也不动了」。
// _callback 是同一个实例注册在多个 url 上(_loadData 逐个 searchInfo 都传了它),故逐个摘除
for (final item in allVideos) {
VideoDownloadManager.instance.removeCallback(item.realVideoUrl, _callback);
VideoDownloadManager.instance
.removeCallback(item.realVideoUrl, _callback);
}
_cellRefreshers.clear();
tabCtr.dispose();
@@ -1,10 +1,10 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/hj_utils/const.dart';
import 'package:hgmj/routers/jump_router.dart';
import 'package:hgmj/tools_base/loading/loading_center_widget.dart';
import 'package:hgmj/tools_base/widget/keep_alive_widget.dart';
import 'package:hgmj/tools_base/widget/stagger_in_item.dart';
import 'package:wydj/hj_utils/const.dart';
import 'package:wydj/routers/jump_router.dart';
import 'package:wydj/tools_base/loading/loading_center_widget.dart';
import 'package:wydj/tools_base/widget/keep_alive_widget.dart';
import 'package:wydj/tools_base/widget/stagger_in_item.dart';
import '../../../hj_model/drama_media_info.dart';
import '../../../hj_model/video_model.dart';
@@ -32,7 +32,8 @@ class VideoCachePage extends StatelessWidget {
enableFeedback: false,
onTap: () => logic.editEvent(),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 12),
padding:
const EdgeInsets.symmetric(horizontal: 6, vertical: 12),
alignment: Alignment.centerRight,
child: Text(
logic.isEditing ? "删除" : "编辑",
@@ -58,7 +59,8 @@ class VideoCachePage extends StatelessWidget {
indicatorWeight: 1,
unselectedLabelColor: Color(0x8CFFFFFF),
unselectedLabelStyle: TextStyle(fontSize: 14),
labelStyle: TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
labelStyle: TextStyle(
fontSize: 14, fontWeight: FontWeight.w500),
labelColor: Color(0xE5FFFFFF),
tabs: logic.tabTitles
.map(
@@ -76,7 +78,8 @@ class VideoCachePage extends StatelessWidget {
controller: logic.tabCtr,
children: [
// keepAlive:切 tab 不重建,保留滚动位置,也避免入场动画反复重播
for (final style in logic.tabStyles) _buildGrid(logic, style).keepAlive,
for (final style in logic.tabStyles)
_buildGrid(logic, style).keepAlive,
],
),
)
@@ -96,7 +99,10 @@ class VideoCachePage extends StatelessWidget {
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
//短剧跟「热门短剧」橱窗同规格:2 列 168/266
crossAxisCount: style == MediaStyle.ShortVideo || style == MediaStyle.Cartoon ? 3 : 2,
crossAxisCount:
style == MediaStyle.ShortVideo || style == MediaStyle.Cartoon
? 3
: 2,
crossAxisSpacing: 6,
mainAxisSpacing: 12,
childAspectRatio: switch (style) {
@@ -123,7 +129,8 @@ class VideoCachePage extends StatelessWidget {
}
/// 单个缓存 cell:被标记删除时缩放 + 淡出(时长与 logic 一致,播完 logic 才真删数据)
Widget _buildCell(VideoCacheLogic logic, VideoModel videoModel, MediaStyle style) {
Widget _buildCell(
VideoCacheLogic logic, VideoModel videoModel, MediaStyle style) {
final isRemoving = logic.isRemoving(videoModel);
// 退场中屏蔽点击:opacity 到 0 也照样命中手势,否则那 260 毫秒里
// 点到看不见的 cell 会跳进播放页
@@ -159,7 +166,8 @@ class VideoCachePage extends StatelessWidget {
//下载就是为了离线看:有本地文件就直接放,不进二级页——二级页是纯网络播放器
//(VideoPlayerBaseLogic.initPlayer 只认 network),进那儿等于没用上下好的文件,断网还打不开
if (style == MediaStyle.Drama && videoModel.localPath?.isNotEmpty == true) {
_playLocal(videoModel, '${videoModel.title ?? ""} 第${videoModel.episodeNo ?? 1}集');
_playLocal(videoModel,
'${videoModel.title ?? ""} 第${videoModel.episodeNo ?? 1}集');
return;
}
//没下完(或只有下载态没落到文件)的没有本地文件可放,进二级页在线看这一集:
@@ -179,11 +187,13 @@ class VideoCachePage extends StatelessWidget {
_playLocal(videoModel, videoModel.title ?? "");
return;
}
pushToVideoPage(videoModel: videoModel, isCartoon: videoModel.videoType == 1);
pushToVideoPage(
videoModel: videoModel, isCartoon: videoModel.videoType == 1);
}
/// 用本地文件播([SimpleVideoPlayerLogic] 拿到 localPath 就走 PlayerFactory.file)
void _playLocal(VideoModel videoModel, String title) => Get.to(SimpleVideoPlayerPage(
void _playLocal(VideoModel videoModel, String title) =>
Get.to(SimpleVideoPlayerPage(
localPath: videoModel.localPath,
videoUrl: videoModel.realVideoUrl,
title: title,