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
+16 -8
View File
@@ -2,9 +2,9 @@ import 'dart:ui';
import 'package:easy_rich_text/easy_rich_text.dart';
import 'package:flutter/material.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/config/config.dart';
import 'package:hgmj/routers/jump_router.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/config/config.dart';
import 'package:wydj/routers/jump_router.dart';
import '../hj_utils/screen.dart';
import '../tools_base/widget/net_image_widget.dart';
@@ -19,7 +19,9 @@ class AwPermissionAlert extends StatelessWidget {
color: Colors.black.withValues(alpha: .4),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20),
child: Config.darkWebImg?.isNotEmpty == true ? _imageView() : _normalView(),
child: Config.darkWebImg?.isNotEmpty == true
? _imageView()
: _normalView(),
),
);
}
@@ -60,20 +62,25 @@ class AwPermissionAlert extends StatelessWidget {
'乌/中东战争,血腥缅北,呦呦破处,变态\n'
'恐怖,暗网交易,等稀缺资源!',
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500),
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontWeight: FontWeight.w500),
),
18.sizeBoxH,
//会员卡名标红
EasyRichText(
'马上开通\n$vipName\n进入世界的黑暗面!',
textAlign: TextAlign.center,
defaultStyle: const TextStyle(color: Colors.white, fontSize: 14, height: 1.5),
defaultStyle: const TextStyle(
color: Colors.white, fontSize: 14, height: 1.5),
patternList: [
if (vipName.isNotEmpty)
EasyRichTextPattern(
targetString: vipName,
matchWordBoundaries: false, // 纯中文无 \b 词边界,关掉才能匹配上
hasSpecialCharacters: true, // 卡名是服务端下发的,带 ()+ 等正则符会构造出非法正则崩掉
hasSpecialCharacters:
true, // 卡名是服务端下发的,带 ()+ 等正则符会构造出非法正则崩掉
style: const TextStyle(color: Color(0xffC40F0B)),
),
],
@@ -88,7 +95,8 @@ class AwPermissionAlert extends StatelessWidget {
'此板块为黑客破解内容,真实稀缺资源,\n'
'可能会引起极度不适,请谨慎进入!\n',
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white.withValues(alpha: .6), fontSize: 12),
style: TextStyle(
color: Colors.white.withValues(alpha: .6), fontSize: 12),
),
],
),
+6 -4
View File
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/widget/common_dialog.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/widget/common_dialog.dart';
import '../../routers/jump_router.dart';
@@ -36,7 +36,8 @@ Future<int?> showVipLevelDialog(
child: Text(
content,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 16, color: Color(0x73FFFFFF), height: 1.5),
style: TextStyle(
fontSize: 16, color: Color(0x73FFFFFF), height: 1.5),
),
),
if (desc != null && desc.isNotEmpty)
@@ -49,7 +50,8 @@ Future<int?> showVipLevelDialog(
),
),
24.sizeBoxH,
InkWell(enableFeedback: false,
InkWell(
enableFeedback: false,
onTap: () {
if (vipEvent != null) {
vipEvent.call();
+5 -3
View File
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:wydj/assets_tool/images.dart';
import '../../hj_model/splash/ads_model.dart';
import '../../hj_utils/screen.dart';
@@ -70,7 +70,8 @@ class _AppCenterDialogState extends State<AppCenterDialog> {
shrinkWrap: true, //不足 4 行时按内容收,不留空
physics: const ClampingScrollPhysics(),
itemCount: _appList.length,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
crossAxisSpacing: 12,
mainAxisSpacing: 16,
@@ -93,7 +94,8 @@ class _AppCenterDialogState extends State<AppCenterDialog> {
ignoring: !_showClose,
child: GestureDetector(
onTap: () => Get.back(),
child: Image.asset("close_button.png".commonImgPath, width: 32, height: 32),
child: Image.asset("close_button.png".commonImgPath,
width: 32, height: 32),
),
),
),
+11 -7
View File
@@ -2,11 +2,11 @@ import 'package:easy_rich_text/easy_rich_text.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/config/config.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/routers/jump_router.dart';
import 'package:hgmj/tools_base/widget/common_dialog.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/config/config.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/routers/jump_router.dart';
import 'package:wydj/tools_base/widget/common_dialog.dart';
class LineErrorDialog extends StatelessWidget {
static Future show({Function? callback}) {
@@ -58,7 +58,10 @@ class LineErrorDialog extends StatelessWidget {
alignment: Alignment.centerLeft,
child: const Text(
"解决方案:",
style: TextStyle(color: Color(0xff656565), fontSize: 12, fontWeight: FontWeight.w500),
style: TextStyle(
color: Color(0xff656565),
fontSize: 12,
fontWeight: FontWeight.w500),
),
),
12.sizeBoxH,
@@ -67,7 +70,8 @@ class LineErrorDialog extends StatelessWidget {
2.前往官网地址 $officialUrl下载最新版。
3.前往Telegram${Config.appName}官方交流群
''',
defaultStyle: TextStyle(fontSize: 12, color: Color(0xff656565), height: 1.8),
defaultStyle:
TextStyle(fontSize: 12, color: Color(0xff656565), height: 1.8),
patternList: [
EasyRichTextPattern(
targetString: officialUrl,
+7 -5
View File
@@ -3,9 +3,9 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/hj_model/splash/ads_model.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/hj_model/splash/ads_model.dart';
import 'package:wydj/hj_utils/screen.dart';
import '../../tools_base/banner/ads_item.dart';
@@ -31,7 +31,8 @@ class NoticeImageDialog extends StatelessWidget {
aspectRatio: 6 / 8,
),
20.sizeBoxH,
InkWell(enableFeedback: false,
InkWell(
enableFeedback: false,
onTap: () => Get.back(result: false),
child: Image.asset("close_button.png".commonImgPath, width: 32),
)
@@ -76,7 +77,8 @@ class SystemImagesDialog extends StatelessWidget {
itemCount: ads?.length ?? 0,
),
20.sizeBoxH,
InkWell(enableFeedback: false,
InkWell(
enableFeedback: false,
onTap: () => Get.back(result: false),
child: Image.asset("close_button.png".commonImgPath, width: 32),
)
+14 -7
View File
@@ -3,9 +3,9 @@
import 'package:easy_rich_text/easy_rich_text.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/widget/common_dialog.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/widget/common_dialog.dart';
import '../../hj_model/splash/ads_model.dart';
@@ -43,7 +43,8 @@ class NoticeTextDialog extends StatelessWidget {
child: SingleChildScrollView(
child: EasyRichText(
content ?? "",
defaultStyle: TextStyle(color: Color(0xff656565), fontSize: 12, height: 25 / 12),
defaultStyle: TextStyle(
color: Color(0xff656565), fontSize: 12, height: 25 / 12),
patternList: [
EasyRichTextPattern(
targetString:
@@ -59,15 +60,21 @@ class NoticeTextDialog extends StatelessWidget {
),
),
12.sizeBoxH,
InkWell(enableFeedback: false,
InkWell(
enableFeedback: false,
onTap: () => Get.back(),
child: Container(
alignment: Alignment.center,
height: 44,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(3), color: AppColors.actionRed),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
color: AppColors.actionRed),
child: Text(
"我知道了",
style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500),
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontWeight: FontWeight.w500),
),
),
),
+12 -8
View File
@@ -5,11 +5,11 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/hj_utils/install_util.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/toast.dart';
import 'package:hgmj/tools_base/widget/common_dialog.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/hj_utils/install_util.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/toast.dart';
import 'package:wydj/tools_base/widget/common_dialog.dart';
import 'package:path/path.dart' as path;
import 'package:path_provider/path_provider.dart';
@@ -118,7 +118,9 @@ class _UpdateDialog extends State<UpdateDialog> {
//Row 不给约束,Text 会按自然宽度排版撑出去,必须 Expanded 收回可用宽度才会换行
Expanded(
child: Text(
widget.updateInfo.description?.replaceAll("|", "\n") ?? "",
widget.updateInfo.description
?.replaceAll("|", "\n") ??
"",
style: TextStyle(
color: Colors.white.withValues(alpha: .55),
fontSize: 12,
@@ -240,8 +242,10 @@ class _UpdateDialog extends State<UpdateDialog> {
///下载 apk(仅 Android,iOS 走商店)
Future<void> _downloadApk(String url) async {
final saveDirectory = path.join((await getExternalStorageDirectory())?.path ?? "", "apk");
DioSliceRetryDownloader(DioCli(), url, null, saveDirectory, "paofu.apk", onReceiveProgress: (count, total) {
final saveDirectory =
path.join((await getExternalStorageDirectory())?.path ?? "", "apk");
DioSliceRetryDownloader(DioCli(), url, null, saveDirectory, "paofu.apk",
onReceiveProgress: (count, total) {
progress = (count / total);
setState(() {});
}, onRetry: (int retryCount) {
+52 -24
View File
@@ -5,9 +5,9 @@ import 'dart:math' as math;
import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/unique_tag_mixin.dart';
import 'package:hgmj/tools_base/widget/sheet_handle_bar.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/unique_tag_mixin.dart';
import 'package:wydj/tools_base/widget/sheet_handle_bar.dart';
import 'package:provider/provider.dart';
import '../../hj_model/splash/domain_source_model.dart';
@@ -26,10 +26,12 @@ import 'buy_vip_alert_logic.dart';
class BuyVipAlert extends StatefulWidget {
final String? vipId; //外部指定卡ID(可选),不传走分层卡/升级卡兜底
final String? videoId; //在看的那条内容 id,下单时透传给服务端做归因
final PayOrderTrackInfo? orderTrack; //整份下单上下文,短剧付费墙要带 mediaId/contentId/checkoutContextId
final PayOrderTrackInfo?
orderTrack; //整份下单上下文,短剧付费墙要带 mediaId/contentId/checkoutContextId
const BuyVipAlert({super.key, this.vipId, this.videoId, this.orderTrack});
static Future show({String? vipId, String? videoId, PayOrderTrackInfo? orderTrack}) {
static Future show(
{String? vipId, String? videoId, PayOrderTrackInfo? orderTrack}) {
return Get.bottomSheet(
BuyVipAlert(vipId: vipId, videoId: videoId, orderTrack: orderTrack),
isScrollControlled: true,
@@ -42,7 +44,10 @@ class BuyVipAlert extends StatefulWidget {
// 可叠弹(试看结束/超时长等多处触发),用 per-实例唯一 tag 隔离 controller
class _BuyVipAlertState extends State<BuyVipAlert> with UniqueTagMixin {
late final logic = BuyVipAlertLogic(vId: widget.vipId, videoId: widget.videoId, orderTrack: widget.orderTrack);
late final logic = BuyVipAlertLogic(
vId: widget.vipId,
videoId: widget.videoId,
orderTrack: widget.orderTrack);
static const _sheetRadius = 26.0;
@@ -109,14 +114,18 @@ class _BuyVipAlertState extends State<BuyVipAlert> with UniqueTagMixin {
_selectionBuilder(
(_) => Text(
_title,
style: const TextStyle(color: Color(0xE5FFFFFF), fontSize: 16, fontWeight: FontWeight.w500),
style: const TextStyle(
color: Color(0xE5FFFFFF),
fontSize: 16,
fontWeight: FontWeight.w500),
),
),
_buildCountdown(),
],
),
14.sizeBoxH,
_selectionBuilder((_) => _buildPriceInfo()), //原价 / 限时特价 / 优惠
_selectionBuilder(
(_) => _buildPriceInfo()), //原价 / 限时特价 / 优惠
16.sizeBoxH,
Expanded(
child: _buildContent(),
@@ -169,7 +178,8 @@ class _BuyVipAlertState extends State<BuyVipAlert> with UniqueTagMixin {
child: CarouselSlider.builder(
carouselController: logic.pageCtr,
itemCount: mgr.vipCards.length + 2,
itemBuilder: (_, index, __) => _selectionBuilder((l) => l.instanceChildItem(index)),
itemBuilder: (_, index, __) => _selectionBuilder(
(l) => l.instanceChildItem(index)),
options: CarouselOptions(
height: logic.cardHeight,
viewportFraction: logic.itemRatio,
@@ -180,7 +190,8 @@ class _BuyVipAlertState extends State<BuyVipAlert> with UniqueTagMixin {
enlargeCenterPage: false,
padEnds: false,
clipBehavior: Clip.none,
onPageChanged: (index, __) => logic.onPageChanged(index),
onPageChanged: (index, __) =>
logic.onPageChanged(index),
scrollDirection: Axis.horizontal,
),
),
@@ -230,7 +241,8 @@ class _BuyVipAlertState extends State<BuyVipAlert> with UniqueTagMixin {
decoration: TextDecoration.lineThrough,
decorationColor: Color(0x8cFFFFFF),
);
const normal = TextStyle(color: Color(0x8cFFFFFF), fontSize: 14, fontWeight: FontWeight.w500);
const normal = TextStyle(
color: Color(0x8cFFFFFF), fontSize: 14, fontWeight: FontWeight.w500);
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@@ -238,16 +250,20 @@ class _BuyVipAlertState extends State<BuyVipAlert> with UniqueTagMixin {
24.sizeBoxW,
_priceItem("限时特价", "¥$discounted", normal),
24.sizeBoxW,
_priceItem("优惠", "¥${(original - discounted).clamp(0, original)}", normal),
_priceItem(
"优惠", "¥${(original - discounted).clamp(0, original)}", normal),
],
);
}
Widget _priceItem(String title, String value, TextStyle valueStyle, {TextStyle? titleStyle}) {
Widget _priceItem(String title, String value, TextStyle valueStyle,
{TextStyle? titleStyle}) {
return Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(title, style: titleStyle ?? const TextStyle(color: Color(0x99FFFFFF), fontSize: 14)),
Text(title,
style: titleStyle ??
const TextStyle(color: Color(0x99FFFFFF), fontSize: 14)),
4.sizeBoxW,
Text(value, style: valueStyle),
],
@@ -260,7 +276,8 @@ class _BuyVipAlertState extends State<BuyVipAlert> with UniqueTagMixin {
valueListenable: MineMsgProvider().tick,
builder: (_, __, ___) {
final c = MineMsgProvider().payTier?.config;
if (c == null || !c.hasDiscountCountdown) return const SizedBox.shrink();
if (c == null || !c.hasDiscountCountdown)
return const SizedBox.shrink();
return Row(
mainAxisSize: MainAxisSize.min,
children: [
@@ -281,27 +298,35 @@ class _BuyVipAlertState extends State<BuyVipAlert> with UniqueTagMixin {
width: 24,
height: 24,
alignment: Alignment.center,
decoration: BoxDecoration(color: const Color(0xffE1351F), borderRadius: BorderRadius.circular(3)),
child: Text(value, style: const TextStyle(color: Colors.white, fontSize: 14, fontWeight: FontWeight.w500)),
decoration: BoxDecoration(
color: const Color(0xffE1351F),
borderRadius: BorderRadius.circular(3)),
child: Text(value,
style: const TextStyle(
color: Colors.white, fontSize: 14, fontWeight: FontWeight.w500)),
);
}
Widget _colon() => const Padding(
padding: EdgeInsets.symmetric(horizontal: 2),
child: Text(":", style: TextStyle(color: Color(0xffDD001B), fontSize: 20)),
child:
Text(":", style: TextStyle(color: Color(0xffDD001B), fontSize: 20)),
);
/// 权益区:与会员中心同实验分支 —— classic=A/DISABLED,改版=ACTIVE+B
Widget _buildPrivilegeSections({required bool classic}) {
return _selectionBuilder((l) {
final privileges = l.currentProductModel?.newPrivilege ?? [];
// final coreList = privileges.where((p) => p.isCore == true).toList();
final moreList = privileges; // privileges.where((p) => p.isCore != true).toList();
// final coreList = privileges.where((p) => p.isCore == true).toList();
final moreList =
privileges; // privileges.where((p) => p.isCore != true).toList();
return Column(
mainAxisSize: MainAxisSize.min,
children: [
// classic ? _buildClassicCorePrivileges(coreList) : _buildCorePrivileges(coreList),
classic ? _buildClassicMorePrivileges(moreList) : _buildMorePrivileges(moreList),
// classic ? _buildClassicCorePrivileges(coreList) : _buildCorePrivileges(coreList),
classic
? _buildClassicMorePrivileges(moreList)
: _buildMorePrivileges(moreList),
],
);
});
@@ -358,7 +383,8 @@ class _BuyVipAlertState extends State<BuyVipAlert> with UniqueTagMixin {
childAspectRatio: 63 / 100,
),
itemCount: list.length,
itemBuilder: (_, i) => VipProductPrivilegeItem(list[i], classic: true),
itemBuilder: (_, i) =>
VipProductPrivilegeItem(list[i], classic: true),
),
],
);
@@ -410,6 +436,8 @@ class _BuyVipTopBorderPainter extends CustomPainter {
@override
bool shouldRepaint(covariant _BuyVipTopBorderPainter oldDelegate) {
return oldDelegate.gradient != gradient || oldDelegate.strokeWidth != strokeWidth || oldDelegate.topRadius != topRadius;
return oldDelegate.gradient != gradient ||
oldDelegate.strokeWidth != strokeWidth ||
oldDelegate.topRadius != topRadius;
}
}
+37 -14
View File
@@ -2,10 +2,10 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/extension/extensions.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/toast.dart';
import 'package:hgmj/tools_base/widget/sheet_handle_bar.dart';
import 'package:wydj/extension/extensions.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/toast.dart';
import 'package:wydj/tools_base/widget/sheet_handle_bar.dart';
import 'package:provider/provider.dart';
import '../../assets_tool/app_colors.dart';
@@ -75,34 +75,48 @@ class _ComicBuyAlertState extends State<ComicBuyAlert> {
18.sizeBoxH,
const Text(
'购买作品',
style: TextStyle(color: Color(0xE5ffffff), fontSize: 20, fontWeight: FontWeight.w500),
style: TextStyle(
color: Color(0xE5ffffff),
fontSize: 20,
fontWeight: FontWeight.w500),
),
36.sizeBoxH,
//作品解锁价
Row(
children: [
const Text('作品解锁', style: TextStyle(color: Color(0xE5ffffff), fontSize: 14)),
const Text('作品解锁',
style:
TextStyle(color: Color(0xE5ffffff), fontSize: 14)),
const Spacer(),
GestureDetector(
onTap: () => pushToWalletPage(tabPosition: 1),
child: Text(
'$_price 金币',
style: const TextStyle(color: Color(0xffFF9000), fontSize: 14, fontWeight: FontWeight.w500),
style: const TextStyle(
color: Color(0xffFF9000),
fontSize: 14,
fontWeight: FontWeight.w500),
),
),
],
),
18.sizeBoxH,
Divider(height: 0.5, color: Colors.white.withValues(alpha: .05)),
Divider(
height: 0.5, color: Colors.white.withValues(alpha: .05)),
18.sizeBoxH,
//我的金币余额 + 充值入口
Row(
children: [
const Text('我的金币', style: TextStyle(color: Color(0xE5ffffff), fontSize: 14)),
const Text('我的金币',
style:
TextStyle(color: Color(0xE5ffffff), fontSize: 14)),
const Spacer(),
Text(
'${store.wallet?.amount?.toDouble().fixed(2) ?? 0}',
style: const TextStyle(color: Color(0xE5ffffff), fontSize: 14, fontWeight: FontWeight.w500),
style: const TextStyle(
color: Color(0xE5ffffff),
fontSize: 14,
fontWeight: FontWeight.w500),
),
12.sizeBoxW,
InkWell(
@@ -125,15 +139,22 @@ class _ComicBuyAlertState extends State<ComicBuyAlert> {
//支付按钮:余额不足直接去充值
GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () => enough ? _buyProduct(true) : pushToWalletPage(tabPosition: 1),
onTap: () => enough
? _buyProduct(true)
: pushToWalletPage(tabPosition: 1),
child: Container(
width: double.infinity,
height: 47,
decoration: BoxDecoration(color: const Color(0xffFFC000), borderRadius: BorderRadius.circular(30)),
decoration: BoxDecoration(
color: const Color(0xffFFC000),
borderRadius: BorderRadius.circular(30)),
alignment: Alignment.center,
child: Text(
enough ? '$_price金币/立即支付' : '余额不足,前往充值',
style: const TextStyle(color: Color(0xff1F2029), fontSize: 16, fontWeight: FontWeight.w500),
style: const TextStyle(
color: Color(0xff1F2029),
fontSize: 16,
fontWeight: FontWeight.w500),
),
),
),
@@ -150,7 +171,9 @@ class _ComicBuyAlertState extends State<ComicBuyAlert> {
if (_isBuying) return; //纯防重入,build 不依赖它,改了不用 setState
_isBuying = true;
final productType = isAll ? ProductType.mediaAll : ProductType.mediaChapter;
final productID = isAll ? (widget.mediaInfo?.id ?? widget.curModel?.mediaId) : widget.curModel?.id;
final productID = isAll
? (widget.mediaInfo?.id ?? widget.curModel?.mediaId)
: widget.curModel?.id;
await PayManager().buy(
productID,
productType,
+33 -16
View File
@@ -2,14 +2,14 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/config/config.dart';
import 'package:hgmj/hj_model/user/user_info_model.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/toast.dart';
import 'package:hgmj/tools_base/widget/common_dialog.dart';
import 'package:hgmj/tools_base/widget/net_image_widget.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/config/config.dart';
import 'package:wydj/hj_model/user/user_info_model.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/toast.dart';
import 'package:wydj/tools_base/widget/common_dialog.dart';
import 'package:wydj/tools_base/widget/net_image_widget.dart';
import 'package:qr_flutter/qr_flutter.dart';
import '../../config/address.dart';
@@ -72,7 +72,8 @@ class _ShareMediaDialogState extends State<ShareMediaDialog> {
//app 图标 + 名称 + 标语
Row(
children: [
Image.asset('ic_launcher.webp'.commonImgPath, width: 48.w, height: 48.w),
Image.asset('ic_launcher.webp'.commonImgPath,
width: 48.w, height: 48.w),
10.w.sizeBoxW,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -80,10 +81,16 @@ class _ShareMediaDialogState extends State<ShareMediaDialog> {
children: [
Text(
Config.appName,
style: TextStyle(color: Colors.white.withValues(alpha: .9), fontWeight: FontWeight.w500, fontSize: 14),
style: TextStyle(
color: Colors.white.withValues(alpha: .9),
fontWeight: FontWeight.w500,
fontSize: 14),
),
4.sizeBoxH,
Text("百万大神短剧原创", style: TextStyle(color: Colors.white.withValues(alpha: .55), fontSize: 10)),
Text("百万大神短剧原创",
style: TextStyle(
color: Colors.white.withValues(alpha: .55),
fontSize: 10)),
],
),
],
@@ -110,7 +117,8 @@ class _ShareMediaDialogState extends State<ShareMediaDialog> {
height: 94,
padding: const EdgeInsets.all(2),
color: Colors.white,
child: QrImageView(data: _shareUrl, padding: EdgeInsets.zero),
child: QrImageView(
data: _shareUrl, padding: EdgeInsets.zero),
),
16.sizeBoxW,
Expanded(
@@ -120,13 +128,18 @@ class _ShareMediaDialogState extends State<ShareMediaDialog> {
children: [
Text(
"邀请码${_me?.promotionCode ?? ""}",
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white.withValues(alpha: .9)),
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Colors.white.withValues(alpha: .9)),
),
20.sizeBoxH,
Text(
'每邀请 1人 送 1天 会员 ${Address.groundUrl}',
maxLines: 2,
style: TextStyle(fontSize: 12, color: Colors.white.withValues(alpha: .55)),
style: TextStyle(
fontSize: 12,
color: Colors.white.withValues(alpha: .55)),
),
],
),
@@ -164,7 +177,10 @@ class _ShareMediaDialogState extends State<ShareMediaDialog> {
);
}
Widget _button(String text, {required Color bgColor, required Color textColor, required VoidCallback onTap}) {
Widget _button(String text,
{required Color bgColor,
required Color textColor,
required VoidCallback onTap}) {
return InkWell(
enableFeedback: false,
onTap: onTap,
@@ -177,7 +193,8 @@ class _ShareMediaDialogState extends State<ShareMediaDialog> {
),
child: Text(
text,
style: TextStyle(fontSize: 16, color: textColor, fontWeight: FontWeight.w500),
style: TextStyle(
fontSize: 16, color: textColor, fontWeight: FontWeight.w500),
),
),
);
+42 -22
View File
@@ -1,15 +1,15 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/extension/extensions.dart';
import 'package:hgmj/hj_model/video_model.dart';
import 'package:hgmj/hj_page/mine/widgets/gradient_text.dart';
import 'package:hgmj/hj_page/mine/mine_vip/widgets/coin_pay_bottom_sheet.dart';
import 'package:hgmj/hj_utils/pay/pay_manager.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/routers/jump_router.dart';
import 'package:hgmj/tools_base/global_store/store.dart';
import 'package:hgmj/tools_base/widget/sheet_handle_bar.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/extension/extensions.dart';
import 'package:wydj/hj_model/video_model.dart';
import 'package:wydj/hj_page/mine/widgets/gradient_text.dart';
import 'package:wydj/hj_page/mine/mine_vip/widgets/coin_pay_bottom_sheet.dart';
import 'package:wydj/hj_utils/pay/pay_manager.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/routers/jump_router.dart';
import 'package:wydj/tools_base/global_store/store.dart';
import 'package:wydj/tools_base/widget/sheet_handle_bar.dart';
import 'package:provider/provider.dart';
///金币购买作品面板
@@ -33,7 +33,8 @@ class _VideoBuyBottomSheetState extends State<VideoBuyBottomSheet> {
bool get _noDiscount => _video.newsType == "PIC" || _isSeedLink;
//实际售价:无折扣品类按原价,其余按折后价
String get _priceText => '${(_noDiscount ? _video.originCoins : _video.coins) ?? 0} 金币';
String get _priceText =>
'${(_noDiscount ? _video.originCoins : _video.coins) ?? 0} 金币';
@override
void initState() {
@@ -61,19 +62,26 @@ class _VideoBuyBottomSheetState extends State<VideoBuyBottomSheet> {
18.sizeBoxH,
const Text(
'购买作品',
style: TextStyle(color: Color(0xE5ffffff), fontSize: 20, fontWeight: FontWeight.w500),
style: TextStyle(
color: Color(0xE5ffffff),
fontSize: 20,
fontWeight: FontWeight.w500),
),
18.sizeBoxH,
//作品解锁价
Row(
children: [
const Text('作品解锁', style: TextStyle(color: Color(0xE5ffffff), fontSize: 14)),
const Text('作品解锁',
style: TextStyle(color: Color(0xE5ffffff), fontSize: 14)),
const Spacer(),
GestureDetector(
onTap: () => CoinPayBottomSheet.show(),
child: Text(
_priceText,
style: const TextStyle(color: Color(0xffFF9000), fontSize: 14, fontWeight: FontWeight.w500),
style: const TextStyle(
color: Color(0xffFF9000),
fontSize: 14,
fontWeight: FontWeight.w500),
),
),
],
@@ -86,11 +94,15 @@ class _VideoBuyBottomSheetState extends State<VideoBuyBottomSheet> {
//我的金币余额 + 充值入口
Row(
children: [
const Text('我的金币', style: TextStyle(color: Color(0xE5ffffff), fontSize: 14)),
const Text('我的金币',
style: TextStyle(color: Color(0xE5ffffff), fontSize: 14)),
const Spacer(),
Text(
'${store.wallet?.amount?.toDouble().fixed(2) ?? 0}',
style: const TextStyle(color: Color(0xE5ffffff), fontSize: 14, fontWeight: FontWeight.w500),
style: const TextStyle(
color: Color(0xE5ffffff),
fontSize: 14,
fontWeight: FontWeight.w500),
),
12.sizeBoxW,
InkWell(
@@ -164,7 +176,8 @@ class _VideoBuyBottomSheetState extends State<VideoBuyBottomSheet> {
return [
Row(
children: [
const Text('作品原价', style: TextStyle(color: Color(0xE5FFFFFF), fontSize: 14)),
const Text('作品原价',
style: TextStyle(color: Color(0xE5FFFFFF), fontSize: 14)),
const Spacer(),
Text(
'${_video.originCoins ?? 0} 金币',
@@ -183,14 +196,16 @@ class _VideoBuyBottomSheetState extends State<VideoBuyBottomSheet> {
GradientText(
discountText,
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w400),
gradient: const LinearGradient(colors: [Color(0xffAC7E6E), Color(0xffA4634D)]),
gradient: const LinearGradient(
colors: [Color(0xffAC7E6E), Color(0xffA4634D)]),
),
const Spacer(),
GestureDetector(
onTap: () => pushToWalletPage(),
child: GradientText(
isVip ? '升级会员免费看' : '购买VIP免费看',
gradient: const LinearGradient(colors: [Color(0xffAC7E6E), Color(0xffA4634D)]),
gradient: const LinearGradient(
colors: [Color(0xffAC7E6E), Color(0xffA4634D)]),
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
@@ -205,7 +220,10 @@ class _VideoBuyBottomSheetState extends State<VideoBuyBottomSheet> {
];
}
Widget _button(String text, {required Color textColor, required BoxDecoration decoration, required VoidCallback onTap}) {
Widget _button(String text,
{required Color textColor,
required BoxDecoration decoration,
required VoidCallback onTap}) {
return GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: onTap,
@@ -215,7 +233,8 @@ class _VideoBuyBottomSheetState extends State<VideoBuyBottomSheet> {
decoration: decoration,
child: Text(
text,
style: TextStyle(color: textColor, fontSize: 16, fontWeight: FontWeight.w500),
style: TextStyle(
color: textColor, fontSize: 16, fontWeight: FontWeight.w500),
),
),
);
@@ -227,7 +246,8 @@ class _VideoBuyBottomSheetState extends State<VideoBuyBottomSheet> {
return;
}
//黄游(SEED_LINK)和普通视频都按单片算,动漫按整部算
final type = (!_isSeedLink && _isCartoon) ? ProductType.mediaAll : ProductType.media;
final type =
(!_isSeedLink && _isCartoon) ? ProductType.mediaAll : ProductType.media;
await PayManager().buy(
_video.id,
type,
+5 -3
View File
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/widget/sheet_handle_bar.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/widget/sheet_handle_bar.dart';
import '../../config/address.dart';
import '../../hj_model/splash/domain_source_model.dart';
@@ -70,7 +70,9 @@ class VideoLineMenuAlert extends StatelessWidget {
domain.desc ?? "",
style: TextStyle(
fontSize: 14,
color: isSelected ? Color(0xffFFC000) : Colors.white.withValues(alpha: 0.45),
color: isSelected
? Color(0xffFFC000)
: Colors.white.withValues(alpha: 0.45),
fontWeight: isSelected ? FontWeight.w500 : FontWeight.w400,
),
),
+19 -8
View File
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/routers/jump_router.dart';
import 'package:hgmj/tools_base/widget/common_dialog.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/routers/jump_router.dart';
import 'package:wydj/tools_base/widget/common_dialog.dart';
/// 动漫/图集的 VIP 门槛提示弹窗:只有文案和一个开通按钮
class VipACGDialog extends StatelessWidget {
@@ -16,13 +16,19 @@ class VipACGDialog extends StatelessWidget {
children: [
Text(
"温馨提示",
style: TextStyle(fontSize: 20, color: Colors.white.withValues(alpha: .9), fontWeight: FontWeight.w500),
style: TextStyle(
fontSize: 20,
color: Colors.white.withValues(alpha: .9),
fontWeight: FontWeight.w500),
),
24.sizeBoxH,
Text(
"本内容需要开通VIP会员\n开通会员 即可解锁查看完整版",
textAlign: TextAlign.center,
style: TextStyle(fontSize: 16, color: Colors.white.withValues(alpha: .45), height: 2),
style: TextStyle(
fontSize: 16,
color: Colors.white.withValues(alpha: .45),
height: 2),
),
24.sizeBoxH,
//开通按钮。margin 留在 InkWell 外,否则左右各 12 的空白会被算进点击热区
@@ -34,10 +40,15 @@ class VipACGDialog extends StatelessWidget {
child: Container(
height: 44,
alignment: Alignment.center,
decoration: BoxDecoration(color: AppColors.actionRed, borderRadius: BorderRadius.circular(30)),
decoration: BoxDecoration(
color: AppColors.actionRed,
borderRadius: BorderRadius.circular(30)),
child: const Text(
"立即开通",
style: TextStyle(fontSize: 16, color: Color(0xff1F2029), fontWeight: FontWeight.w500),
style: TextStyle(
fontSize: 16,
color: Color(0xff1F2029),
fontWeight: FontWeight.w500),
),
),
),
+37 -14
View File
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/widget/net_image_widget.dart';
import 'package:hgmj/tools_base/widget/sheet_handle_bar.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/widget/net_image_widget.dart';
import 'package:wydj/tools_base/widget/sheet_handle_bar.dart';
import '../../hj_page/mine/mine_vip/pay_order_source.dart';
import '../../hj_page/mine/mine_vip/vip_support_model.dart';
@@ -66,14 +66,21 @@ class GuideBottomSheet extends StatelessWidget {
return show(
scene: GuideScene.videoPreviewEnd,
title: Text(
config?.title?.isNotEmpty == true ? config!.title! : '该视频为VIP内容\n只能观看试看内容哦~',
config?.title?.isNotEmpty == true
? config!.title!
: '该视频为VIP内容\n只能观看试看内容哦~',
textAlign: TextAlign.center,
style: const TextStyle(color: Colors.white, fontSize: 17, fontWeight: FontWeight.w600),
style: const TextStyle(
color: Colors.white, fontSize: 17, fontWeight: FontWeight.w600),
),
subtitle: GradientText(
config?.description?.isNotEmpty == true ? config!.description! : '想要查看完整内容,需要开通会员',
gradient: const LinearGradient(colors: [Colors.white, Color(0xffEFD394)]),
style: const TextStyle(color: Colors.white, fontSize: 15, fontWeight: FontWeight.w500),
config?.description?.isNotEmpty == true
? config!.description!
: '想要查看完整内容,需要开通会员',
gradient:
const LinearGradient(colors: [Colors.white, Color(0xffEFD394)]),
style: const TextStyle(
color: Colors.white, fontSize: 15, fontWeight: FontWeight.w500),
),
buttonText: buttonText,
);
@@ -87,8 +94,13 @@ class GuideBottomSheet extends StatelessWidget {
width: double.infinity,
padding: EdgeInsets.fromLTRB(16, 18, 16, 18 + screen.paddingBottom),
decoration: const BoxDecoration(
gradient: LinearGradient(begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [Color(0xff0F0F0F), Colors.black]),
border: Border(top: BorderSide(color: Color(0x4DE4BB6D))), // rgba(228,187,109,0.3)
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Color(0xff0F0F0F), Colors.black]),
border: Border(
top: BorderSide(
color: Color(0x4DE4BB6D))), // rgba(228,187,109,0.3)
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
),
child: Column(
@@ -103,7 +115,8 @@ class GuideBottomSheet extends StatelessWidget {
SizedBox(
width: 270,
height: 122,
child: NetworkImageLoader(imageUrl: cover, fit: BoxFit.fill, borderRadius: 8),
child: NetworkImageLoader(
imageUrl: cover, fit: BoxFit.fill, borderRadius: 8),
),
18.sizeBoxH,
subtitle,
@@ -116,11 +129,21 @@ class GuideBottomSheet extends StatelessWidget {
height: 52,
alignment: Alignment.center,
decoration: BoxDecoration(
gradient: const LinearGradient(colors: [Color(0xffFFB03F), Color(0xffF2680C)]),
gradient: const LinearGradient(
colors: [Color(0xffFFB03F), Color(0xffF2680C)]),
borderRadius: BorderRadius.circular(26),
boxShadow: [BoxShadow(color: const Color(0x73F2680C), blurRadius: 18, offset: const Offset(0, 6))], // rgba(242,104,12,0.45)
boxShadow: [
BoxShadow(
color: const Color(0x73F2680C),
blurRadius: 18,
offset: const Offset(0, 6))
], // rgba(242,104,12,0.45)
),
child: Text(buttonText, style: const TextStyle(color: Colors.white, fontSize: 17, fontWeight: FontWeight.w700)),
child: Text(buttonText,
style: const TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.w700)),
),
),
],
+16 -8
View File
@@ -1,6 +1,6 @@
import 'package:get/get.dart';
import 'package:hgmj/hj_model/splash/domain_source_model.dart';
import 'package:hgmj/tools_base/global_store/store.dart';
import 'package:wydj/hj_model/splash/domain_source_model.dart';
import 'package:wydj/tools_base/global_store/store.dart';
import '../../hj_page/main_page/provider/msg_provider.dart';
import '../../hj_page/mine/mine_vip/mine_charge_vip_page.dart';
@@ -19,13 +19,18 @@ import 'guide_manager.dart';
Future<VipProductModel?> loadGuideCard(GuideScene scene) async {
final config = GuideManager().configOf(scene);
if (config == null) return null; // 开关关着
if (config.productId?.isNotEmpty != true || config.cover?.isNotEmpty != true) {
if (config.productId?.isNotEmpty != true ||
config.cover?.isNotEmpty != true) {
debugLog('paymentGuide', '${scene.value} 缺 productId 或 cover,配置有误不弹');
return null;
}
if (vipProductManager.vipCards.isEmpty) await vipProductManager.loadVipCards();
final card = vipProductManager.vipCards.firstWhereOrNull((e) => e.productID == config.productId);
if (card == null) debugLog('paymentGuide', '${scene.value} 配置的会员卡不在列表里,不弹: ${config.productId}');
if (vipProductManager.vipCards.isEmpty)
await vipProductManager.loadVipCards();
final card = vipProductManager.vipCards
.firstWhereOrNull((e) => e.productID == config.productId);
if (card == null)
debugLog(
'paymentGuide', '${scene.value} 配置的会员卡不在列表里,不弹: ${config.productId}');
return card;
}
@@ -38,7 +43,9 @@ bool isUnpayGuideUser() {
/// 场景 → 下单来源页(透传 /mine/topay 的 sourcePage)
PaySourcePage guideSourcePage(GuideScene scene) => switch (scene) {
GuideScene.homeNewUser || GuideScene.homeOldUser || GuideScene.homeNewUserFreeTrial =>
GuideScene.homeNewUser ||
GuideScene.homeOldUser ||
GuideScene.homeNewUserFreeTrial =>
PaySourcePage.homeUserSegment,
GuideScene.vipCenter => PaySourcePage.vipCenter,
_ => PaySourcePage.videoBottomSheet, //播放页起播引导 / 返回挽留
@@ -47,5 +54,6 @@ PaySourcePage guideSourcePage(GuideScene scene) => switch (scene) {
/// 开通 → 关弹窗 + 进会员页并选中该卡(落地页 VIP_CENTER 开着还会再弹一次,不去重)
void goVipDetail(VipProductModel card, {required PaySourcePage sourcePage}) {
Get.back(result: true); // 带回"去开通了",调用方据此不恢复播放
Get.to(() => MineChargeVipPage(vipID: card.productID, sourcePage: sourcePage));
Get.to(
() => MineChargeVipPage(vipID: card.productID, sourcePage: sourcePage));
}
+54 -16
View File
@@ -2,8 +2,8 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/widget/net_image_widget.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/widget/net_image_widget.dart';
import '../../assets_tool/images.dart';
import '../../hj_page/mine/mine_vip/pay_order_source.dart';
@@ -34,7 +34,8 @@ class PromoCountdown {
/// 长视频返回挽留 / 进会员页时触发
class GuideCountdownDialog extends StatelessWidget {
final VipProductModel card;
final ValueChanged<VipProductModel>? onConfirm; // 默认跳会员页选卡;已在会员页的场景自己处理(关弹窗+就地选中该卡)
final ValueChanged<VipProductModel>?
onConfirm; // 默认跳会员页选卡;已在会员页的场景自己处理(关弹窗+就地选中该卡)
final PaySourcePage sourcePage;
final String cover; // 场景下发的主图,相对路径由 ImageCacheManager 拼域名
const GuideCountdownDialog({
@@ -47,7 +48,9 @@ class GuideCountdownDialog extends StatelessWidget {
/// [scene] 决定主图/卡/下单来源,调用方须先用开关判过能弹
/// 返回 true = 点了「立即开通」(点X/点蒙层/没弹成都是 false),返回挽留场景据此决定要不要放行返回
static Future<bool> show({required GuideScene scene, ValueChanged<VipProductModel>? onConfirm}) async {
static Future<bool> show(
{required GuideScene scene,
ValueChanged<VipProductModel>? onConfirm}) async {
final card = await loadGuideCard(scene);
if (card == null) return false; // 配置有误不弹
final confirmed = await Get.dialog<bool>(
@@ -92,15 +95,29 @@ class GuideCountdownDialog extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: TextBaseline.alphabetic,
children: [
const Text('现在下单获得', style: TextStyle(color: Colors.white, fontSize: 19, fontWeight: FontWeight.w800)),
const Text('现在下单获得',
style: TextStyle(
color: Colors.white,
fontSize: 19,
fontWeight: FontWeight.w800)),
2.sizeBoxW,
const GradientText(
'优惠',
gradient: LinearGradient(colors: [Color(0xffFFE3A0), Color(0xffF0A93C)]),
style: TextStyle(color: Colors.white, fontSize: 26, fontWeight: FontWeight.w800),
gradient: LinearGradient(colors: [
Color(0xffFFE3A0),
Color(0xffF0A93C)
]),
style: TextStyle(
color: Colors.white,
fontSize: 26,
fontWeight: FontWeight.w800),
),
2.sizeBoxW,
const Text('福利', style: TextStyle(color: Colors.white, fontSize: 19, fontWeight: FontWeight.w800)),
const Text('福利',
style: TextStyle(
color: Colors.white,
fontSize: 19,
fontWeight: FontWeight.w800)),
],
),
15.sizeBoxH,
@@ -119,15 +136,24 @@ class GuideCountdownDialog extends StatelessWidget {
height: 52,
alignment: Alignment.center,
decoration: BoxDecoration(
gradient: const LinearGradient(colors: [Color(0xffFFB03F), Color(0xffF2680C)]),
gradient: const LinearGradient(colors: [
Color(0xffFFB03F),
Color(0xffF2680C)
]),
borderRadius: BorderRadius.circular(26),
boxShadow: [
BoxShadow(color: const Color(0x73F2680C), blurRadius: 18, offset: const Offset(0, 6))
BoxShadow(
color: const Color(0x73F2680C),
blurRadius: 18,
offset: const Offset(0, 6))
], // rgba(242,104,12,0.45)
),
child: Text(
'立即开通 · 仅需¥${card.discountedPriceUI}',
style: const TextStyle(color: Colors.white, fontSize: 17, fontWeight: FontWeight.w700),
style: const TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.w700),
),
),
),
@@ -140,7 +166,8 @@ class GuideCountdownDialog extends StatelessWidget {
child: SizedBox(
width: 270,
height: 122,
child: NetworkImageLoader(imageUrl: cover, fit: BoxFit.fill, borderRadius: 8),
child: NetworkImageLoader(
imageUrl: cover, fit: BoxFit.fill, borderRadius: 8),
),
),
],
@@ -193,7 +220,11 @@ class _CountdownRowState extends State<_CountdownRow> {
return Row(
mainAxisSize: MainAxisSize.min,
children: [
const Text('距优惠结束', style: TextStyle(color: Color(0xffB8AE9C), fontSize: 12, fontWeight: FontWeight.w500)),
const Text('距优惠结束',
style: TextStyle(
color: Color(0xffB8AE9C),
fontSize: 12,
fontWeight: FontWeight.w500)),
8.sizeBoxW,
ValueListenableBuilder<Duration>(
valueListenable: _remain,
@@ -215,15 +246,22 @@ class _CountdownRowState extends State<_CountdownRow> {
// 时/分/秒块
Widget _timeCell(int v) => Container(
padding: const EdgeInsets.symmetric(horizontal: 7, vertical: 4),
decoration: BoxDecoration(color: const Color(0xffE23B2E), borderRadius: BorderRadius.circular(6)),
decoration: BoxDecoration(
color: const Color(0xffE23B2E),
borderRadius: BorderRadius.circular(6)),
child: Text(
v.toString().padLeft(2, '0'),
style: const TextStyle(color: Colors.white, fontSize: 14, fontWeight: FontWeight.w700),
style: const TextStyle(
color: Colors.white, fontSize: 14, fontWeight: FontWeight.w700),
),
);
Widget get _colon => const Padding(
padding: EdgeInsets.symmetric(horizontal: 3),
child: Text(':', style: TextStyle(color: Color(0xffE85B4F), fontSize: 14, fontWeight: FontWeight.w700)),
child: Text(':',
style: TextStyle(
color: Color(0xffE85B4F),
fontSize: 14,
fontWeight: FontWeight.w700)),
);
}
+21 -12
View File
@@ -1,12 +1,12 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/hj_model/splash/domain_source_model.dart';
import 'package:hgmj/hj_page/home/activity_float/home_activity_float.dart';
import 'package:hgmj/hj_page/main_page/provider/msg_provider.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/widget/fly_to_overlay.dart';
import 'package:hgmj/tools_base/widget/net_image_widget.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/hj_model/splash/domain_source_model.dart';
import 'package:wydj/hj_page/home/activity_float/home_activity_float.dart';
import 'package:wydj/hj_page/main_page/provider/msg_provider.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/widget/fly_to_overlay.dart';
import 'package:wydj/tools_base/widget/net_image_widget.dart';
/// 支付分层首页弹窗:展示后端 homePage 图,点击跳会员页并选中 config.vipCard。
/// 倒计时读 config.lastDiscountTime,秒级刷新由 MineMsgProvider().tick 驱动,过期自动停
@@ -60,7 +60,8 @@ class _GuideHomeDialogState extends State<GuideHomeDialog> {
if (box == null || !box.hasSize) return null;
final origin = box.localToGlobal(Offset.zero);
const w = 60.0, h = 66.0; // 与 _LayeredFloatView 的尺寸一致
return Rect.fromLTWH(origin.dx + box.size.width - w, origin.dy + box.size.height - h, w, h);
return Rect.fromLTWH(
origin.dx + box.size.width - w, origin.dy + box.size.height - h, w, h);
}
@override
@@ -104,7 +105,8 @@ class _GuideHomeDialogState extends State<GuideHomeDialog> {
imageUrl: config.homePage ?? "",
fit: BoxFit.fill,
borderRadius: 0,
placeHolderWidget: Container(color: const Color(0x00000000)),
placeHolderWidget:
Container(color: const Color(0x00000000)),
),
// 倒计时胶囊:海报右上角,听 tick 每秒刷新,过期自动收起
Positioned(
@@ -112,7 +114,10 @@ class _GuideHomeDialogState extends State<GuideHomeDialog> {
right: 0,
child: ValueListenableBuilder<int>(
valueListenable: MineMsgProvider().tick,
builder: (_, __, ___) => config.hasDiscountCountdown ? _buildCountdownPill() : const SizedBox.shrink(),
builder: (_, __, ___) =>
config.hasDiscountCountdown
? _buildCountdownPill()
: const SizedBox.shrink(),
),
),
],
@@ -123,7 +128,8 @@ class _GuideHomeDialogState extends State<GuideHomeDialog> {
20.sizeBoxH,
GestureDetector(
onTap: _close,
child: Image.asset("close_button.png".commonImgPath, width: 32),
child: Image.asset("close_button.png".commonImgPath,
width: 32),
)
],
),
@@ -149,7 +155,10 @@ class _GuideHomeDialogState extends State<GuideHomeDialog> {
),
child: Text(
'${config.discountHour}:${config.discountMin}:${config.discountSec}',
style: const TextStyle(color: Color(0xffFFF0D1), fontSize: 20, fontWeight: FontWeight.w600),
style: const TextStyle(
color: Color(0xffFFF0D1),
fontSize: 20,
fontWeight: FontWeight.w600),
),
);
}
+7 -3
View File
@@ -1,5 +1,5 @@
import 'package:get/get.dart';
import 'package:hgmj/hj_model/splash/domain_source_model.dart';
import 'package:wydj/hj_model/splash/domain_source_model.dart';
import '../../hj_page/main_page/provider/msg_provider.dart';
import 'guide_config.dart';
@@ -45,8 +45,12 @@ class GuideManager {
/// 请求还没回来,硬判成老用户会让新用户永远错过新人引导,且 _adShown 保证不会再有第二次
GuideScene? get homeScene {
final tier = MineMsgProvider().payTier?.status;
if (tier == null) return [GuideScene.homeNewUser, GuideScene.homeOldUser].firstWhereOrNull(canShow);
final scene = tier == PayTier.newUnpay ? GuideScene.homeNewUser : GuideScene.homeOldUser;
if (tier == null)
return [GuideScene.homeNewUser, GuideScene.homeOldUser]
.firstWhereOrNull(canShow);
final scene = tier == PayTier.newUnpay
? GuideScene.homeNewUser
: GuideScene.homeOldUser;
return canShow(scene) ? scene : null;
}
}
+6 -4
View File
@@ -4,7 +4,7 @@ import '../hj_model/splash/domain_source_model.dart';
/// 全局配置:常量 + 启动时由 /ping/domain 下发并缓存的运营配置
class Config {
// ===== 应用标识 =====
static const appName = '黄果漫剧';
static const appName = '51短剧';
static const appId = 'JHAc-214'; // 埋点app id
static const innerVersion = '2.0.0';
static const isDebug = false;
@@ -21,7 +21,7 @@ class Config {
static const signKey = 'kaFtkDJRcchRMTI9';
// ===== 域名 / 线路 =====
static String dns = 'hgmj.mfcg.it.com'; // 运维提供,返回配置域名(TXT 查询,只填域名不带 https://)
static String dns = 'wydj.mfcg.it.com'; // 运维提供,返回配置域名(TXT 查询,只填域名不带 https://)
/// 本地兜底线路(无本地缓存线路时用)
static const lineList = isDebug
@@ -43,11 +43,12 @@ class Config {
// ===== 首页模块数据 =====
static HomePlateModel? plateModule; // 亚模块数据
static List<JGAreaModel>? jgArea; // 金刚区
static List<MarqueeModel>? marquees; // 新版跑马灯数据
static List<MarqueeModel>? marquees; // 新版跑马灯数据
static List<MarqueeModel>? get marqueesActive {
// 新版跑马灯数据 激活的
return marquees?.where((e) => e.active == true).toList();
}
static List<BannerJumpEntity> bannerJumps = [];
static BannerJump? proxyBanner;
@@ -66,7 +67,8 @@ class Config {
// ===== 短剧 =====
static String? shortDramaCardId; // 短剧卡 id,付费墙拉起会员弹窗时默认选中它
static bool entryPopupEnabled = true; // 「AI爽剧来袭」引导气泡开关,后台置 false 即永久不出现
static bool isDramaEntry = false; // ping 的 defaultEntryPage==drama:启动直接落在短剧 tab
static bool isDramaEntry =
false; // ping 的 defaultEntryPage==drama:启动直接落在短剧 tab
// ===== 开关 / 展示配置 =====
static bool isStoreOpen = false; // 商店模块开关
+34 -14
View File
@@ -1,8 +1,8 @@
import 'package:hgmj/hj_model/actress_info.dart';
import 'package:hgmj/hj_model/video_model.dart';
import 'package:wydj/hj_model/actress_info.dart';
import 'package:wydj/hj_model/video_model.dart';
import '../cartoon_media_info.dart';
import 'package:hgmj/hj_utils/text_util.dart';
import 'package:wydj/hj_utils/text_util.dart';
class AllMediaInfo {
List<Content>? contents;
@@ -21,11 +21,15 @@ class AllMediaInfo {
List<ActressInfo>? allActress;
String? get coverH {
return (horizontalCover?.isNotEmpty == true) ? horizontalCover : verticalCover;
return (horizontalCover?.isNotEmpty == true)
? horizontalCover
: verticalCover;
}
String? get coverV {
return (verticalCover?.isNotEmpty == true) ? verticalCover : horizontalCover;
return (verticalCover?.isNotEmpty == true)
? verticalCover
: horizontalCover;
}
String? id;
@@ -117,7 +121,9 @@ class AllMediaInfo {
}
AllMediaInfo.fromJson(Map<String, dynamic> json) {
contents = json["contents"] == null ? [] : List<Content>.from(json["contents"]!.map((x) => Content.fromJson(x)));
contents = json["contents"] == null
? []
: List<Content>.from(json["contents"]!.map((x) => Content.fromJson(x)));
countBrowse = json["countBrowse"];
countCollect = json["countCollect"];
countComment = json["countComment"];
@@ -130,11 +136,16 @@ class AllMediaInfo {
freeTime = json["freeTime"];
hasFollow = json["hasFollow"];
horizontalCover = json["horizontalCover"];
allActress = json["actresses"] == null ? [] : List<ActressInfo>.from(json["actresses"]!.map((x) => ActressInfo.fromJson(x)));
allActress = json["actresses"] == null
? []
: List<ActressInfo>.from(
json["actresses"]!.map((x) => ActressInfo.fromJson(x)));
id = json["id"];
kind = json["kind"];
mId = json["mId"];
mediaStatus = json["mediaStatus"] == null ? null : VidStatus.fromMap(json["mediaStatus"]);
mediaStatus = json["mediaStatus"] == null
? null
: VidStatus.fromMap(json["mediaStatus"]);
mediaType = json["mediaType"];
moduleName = json["moduleName"];
number = json["number"];
@@ -148,7 +159,10 @@ class AllMediaInfo {
sortCode = json["sortCode"];
status = json["status"];
summary = json["summary"];
tagDetails = json["tagDetails"] == null ? [] : List<TagsBean>.from(json["tagDetails"]!.map((x) => TagsBean.fromMap(x)));
tagDetails = json["tagDetails"] == null
? []
: List<TagsBean>.from(
json["tagDetails"]!.map((x) => TagsBean.fromMap(x)));
tags = parseStringList(json["tags"]);
title = json["title"];
totalEpisode = json["totalEpisode"];
@@ -230,7 +244,9 @@ class Content {
md5 = json["md5"];
mediaId = json["mediaId"];
mediaSize = json["mediaSize"];
mediaStatus = json["mediaStatus"] == null ? null : VidStatus.fromMap(json["mediaStatus"]);
mediaStatus = json["mediaStatus"] == null
? null
: VidStatus.fromMap(json["mediaStatus"]);
name = json["name"];
playTime = json["playTime"];
price = json["price"];
@@ -265,7 +281,8 @@ class Content {
"ratio": ratio,
"text": text,
"updateTime": updateTime,
"urlSet": urlSet == null ? [] : List<dynamic>.from(urlSet!.map((x) => x)),
"urlSet":
urlSet == null ? [] : List<dynamic>.from(urlSet!.map((x) => x)),
"videoUrl": videoUrl,
"weight": weight,
};
@@ -282,8 +299,12 @@ class MediaSearchListModel {
MediaSearchListModel.fromJson(dynamic json) {
hasNext = json['hasNext'];
list = (json['list'] as List?)?.map((v) => CartoonMediaInfo.fromJson(v)).toList();
tagMedia = (json['tagMedia'] as List?)?.map((v) => CartoonMediaInfo.fromJson(v)).toList();
list = (json['list'] as List?)
?.map((v) => CartoonMediaInfo.fromJson(v))
.toList();
tagMedia = (json['tagMedia'] as List?)
?.map((v) => CartoonMediaInfo.fromJson(v))
.toList();
tagId = json['tagId'];
total = json['total'];
}
@@ -298,4 +319,3 @@ class MediaSearchListModel {
return map;
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
//漫画章节
import 'package:hgmj/config/address.dart' as address;
import 'package:wydj/config/address.dart' as address;
import 'package:path/path.dart' as path;
import '../media_content.dart';
+1 -2
View File
@@ -1,5 +1,4 @@
import 'package:hgmj/hj_utils/text_util.dart';
import 'package:wydj/hj_utils/text_util.dart';
class ActressInfo {
String? age;
+1 -1
View File
@@ -1,4 +1,4 @@
import 'package:hgmj/hj_model/actress_info.dart';
import 'package:wydj/hj_model/actress_info.dart';
class ActressModel {
ActressModel({
+65 -56
View File
@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/hj_model/drama_media_info.dart';
import 'package:hgmj/hj_model/splash/ads_model.dart';
import 'package:hgmj/hj_model/video_model.dart';
import 'package:hgmj/tools_base/global_store/store.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/hj_model/drama_media_info.dart';
import 'package:wydj/hj_model/splash/ads_model.dart';
import 'package:wydj/hj_model/video_model.dart';
import 'package:wydj/tools_base/global_store/store.dart';
import 'acg/comic_chapters_model.dart';
import 'actress_info.dart';
@@ -30,7 +30,8 @@ class CartoonMediaInfo {
int? totalEpisode; //总集数
int? currentEpisode; //当前集数
int? freeEpisode; //免费集数
bool isCartoonFreeEpisode = false; //当前播放集是否属于免费集(前 freeEpisode 集):运行时按当前集号计算,命中则不拦播、进度可全程拖
bool isCartoonFreeEpisode =
false; //当前播放集是否属于免费集(前 freeEpisode 集):运行时按当前集号计算,命中则不拦播、进度可全程拖
int? updateStatus; //更新状态 0 默认 1、更新中 2、已完结
String? updateTime; //文档更新时间
String? createdAt; //文档创建时间
@@ -86,16 +87,19 @@ class CartoonMediaInfo {
bool isSelected = false; // 是否选中
String? heroTag; //本地字段,用于传递hero动画tag 随机数
String? get coverH => horizontalCover?.isNotEmpty == true ? horizontalCover : verticalCover;
String? get coverH =>
horizontalCover?.isNotEmpty == true ? horizontalCover : verticalCover;
String? get coverV => verticalCover?.isNotEmpty == true ? verticalCover : horizontalCover;
String? get coverV =>
verticalCover?.isNotEmpty == true ? verticalCover : horizontalCover;
String get unit => mediaType == 'image' ? '话' : '章';
//更新状态
String get updateDesc => updateStatus == 1 ? '连载中' : '已完结';
String get tagIds => tagDetails?.map((e) => e.id).toList().join(',') ?? '';
String get tagNames => tagDetails?.map((e) => e.name).toList().join(',') ?? '';
String get tagNames =>
tagDetails?.map((e) => e.name).toList().join(',') ?? '';
//更新状态
String get getDetailUpdateString {
@@ -237,50 +241,51 @@ class CartoonMediaInfo {
globalStore.isSuperUp;
}
CartoonMediaInfo(
{this.contents,
this.choiceSort,
this.countBrowse,
this.countCollect,
this.countComment,
this.countLike,
this.countPurchases,
this.countPurchasesRate,
this.countView,
this.createdAt,
this.direction,
this.freeTime,
this.horizontalCover,
this.id,
this.isDelete,
this.kind,
this.mId,
this.mediaType,
this.moduleName,
this.permission,
this.permissionIconHide,
this.price,
this.sId,
this.discountPrice,
this.sectionName,
this.sectionSort,
this.sortCode,
this.status,
this.summary,
this.tagDetails,
this.title,
this.totalEpisode,
this.currentEpisode,
this.updateStatus,
this.updateTime,
this.updatedAct,
this.verticalCover,
this.author,
this.freeEpisode,
this.contentsPrice,
this.mediaSubType,
this.actress,
this.hot,});
CartoonMediaInfo({
this.contents,
this.choiceSort,
this.countBrowse,
this.countCollect,
this.countComment,
this.countLike,
this.countPurchases,
this.countPurchasesRate,
this.countView,
this.createdAt,
this.direction,
this.freeTime,
this.horizontalCover,
this.id,
this.isDelete,
this.kind,
this.mId,
this.mediaType,
this.moduleName,
this.permission,
this.permissionIconHide,
this.price,
this.sId,
this.discountPrice,
this.sectionName,
this.sectionSort,
this.sortCode,
this.status,
this.summary,
this.tagDetails,
this.title,
this.totalEpisode,
this.currentEpisode,
this.updateStatus,
this.updateTime,
this.updatedAct,
this.verticalCover,
this.author,
this.freeEpisode,
this.contentsPrice,
this.mediaSubType,
this.actress,
this.hot,
});
CartoonMediaInfo.fromJson(dynamic json) {
freeEpisode = json['freeEpisode'];
@@ -321,11 +326,15 @@ class CartoonMediaInfo {
status = json['status'];
summary = json['summary'];
lsjId = json['lsjId'];
actress = json["actress"] == null ? null : ActressInfo.fromJson(json["actress"]);
allActress = json["actresses"] == null ? [] : List<ActressInfo>.from(json["actresses"]!.map((x) => ActressInfo.fromJson(x)));
actress =
json["actress"] == null ? null : ActressInfo.fromJson(json["actress"]);
allActress = json["actresses"] == null
? []
: List<ActressInfo>.from(
json["actresses"]!.map((x) => ActressInfo.fromJson(x)));
hasFollow = json['hasFollow'];
final hot = json['hot'];
if(hot is int) {
if (hot is int) {
this.hot = hot;
}
if (json['tagDetails'] != null) {
+1 -1
View File
@@ -1,4 +1,4 @@
import 'package:hgmj/hj_model/comment/comment_model.dart';
import 'package:wydj/hj_model/comment/comment_model.dart';
///评论列表返回信息
class CommentListRes {
+1 -1
View File
@@ -1,4 +1,4 @@
import 'package:hgmj/hj_model/comment/reply_model.dart';
import 'package:wydj/hj_model/comment/reply_model.dart';
class CommentModel {
String? id;
+26 -12
View File
@@ -1,5 +1,5 @@
import 'package:hgmj/hj_model/drama_media_info.dart';
import 'package:hgmj/hj_model/media_content.dart';
import 'package:wydj/hj_model/drama_media_info.dart';
import 'package:wydj/hj_model/media_content.dart';
/// 一条短剧观看记录:续播位置 + 列表展示用的剧信息快照。本地记录,不走后端,见 [DramaResumeStore]。
/// 落库时整条存成 model_data,所以 [mediaId] 必须写进 json——
@@ -29,7 +29,9 @@ class DramaResume {
: mediaId = json?['mediaId'] ?? '',
contentId = json?['contentId'] ?? '',
progressSeconds = json?['progressSeconds'] ?? 0,
drama = json?['drama'] == null ? null : DramaMediaInfo.fromJson(json['drama']),
drama = json?['drama'] == null
? null
: DramaMediaInfo.fromJson(json['drama']),
watchedAt = json?['watchedAt'] ?? 0;
Map<String, dynamic> toJson() => {
@@ -62,9 +64,12 @@ class DramaPaywall {
String get titleUI => title?.isNotEmpty == true ? title! : '更多精彩解锁即享';
String get coinButtonUI => coinButtonText?.isNotEmpty == true ? coinButtonText! : '${unlockCoin ?? 0}金币解锁';
String get coinButtonUI => coinButtonText?.isNotEmpty == true
? coinButtonText!
: '${unlockCoin ?? 0}金币解锁';
String get cardButtonUI => cardButtonText?.isNotEmpty == true ? cardButtonText! : '开通短剧卡免费看';
String get cardButtonUI =>
cardButtonText?.isNotEmpty == true ? cardButtonText! : '开通短剧卡免费看';
}
/// AI短剧 Feed 的一条:某部剧 + 该剧第一集。整页走 ListBaseModel<DramaFeedItem>
@@ -76,7 +81,8 @@ class DramaFeedItem {
json ??= {};
//缺 media 就不造空模型,上层按 null 过滤掉这条,别让信息流多出一个没剧名没地址的空位
if (json['media'] != null) media = DramaMediaInfo.fromJson(json['media']);
if (json['content'] != null) content = MediaContent.fromJson(json['content']);
if (json['content'] != null)
content = MediaContent.fromJson(json['content']);
}
}
@@ -104,9 +110,12 @@ class DramaTopic {
name = json['name']?.toString();
topicType = json['topicType']?.toString();
systemKey = json['systemKey']?.toString();
sort = json['sort'] is int ? json['sort'] as int : int.tryParse('${json['sort'] ?? ''}');
workCount =
json['workCount'] is int ? json['workCount'] as int : int.tryParse('${json['workCount'] ?? ''}');
sort = json['sort'] is int
? json['sort'] as int
: int.tryParse('${json['sort'] ?? ''}');
workCount = json['workCount'] is int
? json['workCount'] as int
: int.tryParse('${json['workCount'] ?? ''}');
}
}
@@ -121,9 +130,14 @@ class DramaSearchResult {
json ??= {};
hasNext = json['hasNext'] == true;
tagID = json['tagID']?.toString();
list = (json['list'] as List?)?.map((e) => DramaMediaInfo.fromJson(e)).toList() ?? [];
tagMediaList =
(json['tagMediaList'] as List?)?.map((e) => DramaMediaInfo.fromJson(e)).toList() ?? [];
list = (json['list'] as List?)
?.map((e) => DramaMediaInfo.fromJson(e))
.toList() ??
[];
tagMediaList = (json['tagMediaList'] as List?)
?.map((e) => DramaMediaInfo.fromJson(e))
.toList() ??
[];
}
}
+14 -9
View File
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/hj_model/media_content.dart';
import 'package:hgmj/hj_model/video_model.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/hj_model/media_content.dart';
import 'package:wydj/hj_model/video_model.dart';
/// 短剧作品信息(接口 DramaInfo:一部剧 + 一堆分集)
/// 单集播放数据用 [toVideoModel] 转成 VideoModel 交给短视频播放器
@@ -72,9 +72,11 @@ class DramaMediaInfo {
bool haxNextEpisode = true; //是否还有下一页
bool isSelected = false; //是否选中
String? get coverH => horizontalCover?.isNotEmpty == true ? horizontalCover : verticalCover;
String? get coverH =>
horizontalCover?.isNotEmpty == true ? horizontalCover : verticalCover;
String? get coverV => verticalCover?.isNotEmpty == true ? verticalCover : horizontalCover;
String? get coverV =>
verticalCover?.isNotEmpty == true ? verticalCover : horizontalCover;
String get unit => '集';
@@ -83,9 +85,11 @@ class DramaMediaInfo {
String get tagIds => tagDetails?.map((e) => e.id).toList().join(',') ?? '';
String get tagNames => tagDetails?.map((e) => e.name).toList().join(',') ?? '';
String get tagNames =>
tagDetails?.map((e) => e.name).toList().join(',') ?? '';
Color get updateDescColor => updateStatus == 1 ? AppColors.actionRed : const Color(0xff989898);
Color get updateDescColor =>
updateStatus == 1 ? AppColors.actionRed : const Color(0xff989898);
//集数状态描述
String get episodeNumberStatus {
@@ -172,13 +176,14 @@ class DramaMediaInfo {
countView = json['countView'];
hasFollow = json['hasFollow'];
final hot = json['hot'];
if(hot is int) {
if (hot is int) {
this.hot = hot;
}
direction = json['direction'];
freeTime = json['freeTime'];
mediaStatus = VidStatus.fromMap(json['mediaStatus']);
tagDetails = (json['tagDetails'] as List?)?.map((e) => TagsBean.fromMap(e)).toList();
tagDetails =
(json['tagDetails'] as List?)?.map((e) => TagsBean.fromMap(e)).toList();
}
/// 落本地观看记录用(见 [DramaResume.drama])。只序列化后端字段,
+13 -5
View File
@@ -1,5 +1,5 @@
import 'package:collection/collection.dart';
import 'package:hgmj/hj_utils/const.dart';
import 'package:wydj/hj_utils/const.dart';
//亚模块模型
class ModuleData {
@@ -41,6 +41,7 @@ class ModuleData {
bool get isACG => type == 4 || type == 5 || type == 6;
//短剧
bool get isDrama => type == 12;
/// 展示用的排序项:top=true 的置顶,最多 4 个。
/// 标题、sort 值、随机刷新配置一律从这份派生——分头各排一次,遇到同名/同值 remove 会删错元素,两边就对不上了。
/// haiJiaoStyle 解析完就不再变,算一次存起来,别每个 getter 各构造一遍
@@ -53,10 +54,13 @@ class ModuleData {
/// 排序 tab(标题 + sort 值),为空返回 null 让调用方退回默认值。
/// 标题和 sort 值必须一起产出:拆成两个并行数组时,后端只下发其中一个就会静默错位
List<SortTab<int>>? get sortTabs => _sortedRules.isEmpty ? null : _sortedRules.map((e) => SortTab(e.name ?? '', e.val ?? -1)).toList();
List<SortTab<int>>? get sortTabs => _sortedRules.isEmpty
? null
: _sortedRules.map((e) => SortTab(e.name ?? '', e.val ?? -1)).toList();
/// 按 sort 值取对应的排序规则(用于判断该排序项是否走随机刷新接口)
SortRuleModel? sortRuleOf(int? val) => _sortedRules.firstWhereOrNull((e) => e.val == val);
SortRuleModel? sortRuleOf(int? val) =>
_sortedRules.firstWhereOrNull((e) => e.val == val);
}
class HaiJiaoStyle {
@@ -73,7 +77,8 @@ class HaiJiaoStyle {
showChosenVideo = json['showChosenVideo'];
sortShow = json['sortShow'];
final rules = json['sortRules'];
if (rules is List) sortRules = rules.map((e) => SortRuleModel.fromJson(e)).toList();
if (rules is List)
sortRules = rules.map((e) => SortRuleModel.fromJson(e)).toList();
}
}
@@ -129,5 +134,8 @@ class HomePlateModel {
}
//字段缺失或类型不对(后端偶发下发非数组)都退化成空列表,别让首页解析整个抛掉
static List<ModuleData> _modules(dynamic list) => (list is List ? list : const []).map((e) => ModuleData.fromJson(e)).toList();
static List<ModuleData> _modules(dynamic list) =>
(list is List ? list : const [])
.map((e) => ModuleData.fromJson(e))
.toList();
}
+15 -6
View File
@@ -1,5 +1,5 @@
import 'package:hgmj/hj_model/home/module_detail_model.dart';
import 'package:hgmj/hj_model/video_model.dart';
import 'package:wydj/hj_model/home/module_detail_model.dart';
import 'package:wydj/hj_model/video_model.dart';
//注意⚠️ VideoListResp 只用于兼容不同业务服务端返回的视频列表 key 不一致的情况
//注意⚠️ 请勿添加其他类型的数据list,如需添加请单独另外创建新的类
@@ -15,14 +15,24 @@ class VideoListResp {
json ??= {};
hasNext = json['hasNext'];
//各业务的视频列表 key 不一样,逐个匹配(后命中的覆盖先命中的)
for (final key in ['videos', 'vInfos', 'searchVideo', 'list', 'data', 'searchTag']) {
for (final key in [
'videos',
'vInfos',
'searchVideo',
'list',
'data',
'searchTag'
]) {
if (json[key] is List) {
videos = (json[key] as List).map((e) => VideoModel.fromJson(e)).toList();
videos =
(json[key] as List).map((e) => VideoModel.fromJson(e)).toList();
}
}
tagID = json['tagID'] ?? json['libraryTag']?['id'];
if (json['tagVidList'] is List) {
tagVidList = (json['tagVidList'] as List).map((e) => VideoModel.fromJson(e)).toList();
tagVidList = (json['tagVidList'] as List)
.map((e) => VideoModel.fromJson(e))
.toList();
}
}
}
@@ -41,4 +51,3 @@ class SectionListResp {
}
}
}
+14 -14
View File
@@ -1,17 +1,17 @@
import 'package:hgmj/hj_model/acg/comic_chapters_model.dart';
import 'package:hgmj/hj_model/actress_model.dart';
import 'package:hgmj/hj_model/cartoon_media_info.dart';
import 'package:hgmj/hj_model/drama/drama_models.dart';
import 'package:hgmj/hj_model/drama_media_info.dart';
import 'package:hgmj/hj_model/comment/reply_model.dart';
import 'package:hgmj/hj_model/comment/user_comment_res.dart';
import 'package:hgmj/hj_model/home/collection_model.dart';
import 'package:hgmj/hj_model/media_content.dart';
import 'package:hgmj/hj_model/message/message_dynamic_list.dart';
import 'package:hgmj/hj_model/mine/exchange/bill_item_model.dart';
import 'package:hgmj/hj_model/mine/follow_user_list_model.dart';
import 'package:hgmj/hj_model/mine/promotion_record.dart';
import 'package:hgmj/hj_model/video_model.dart';
import 'package:wydj/hj_model/acg/comic_chapters_model.dart';
import 'package:wydj/hj_model/actress_model.dart';
import 'package:wydj/hj_model/cartoon_media_info.dart';
import 'package:wydj/hj_model/drama/drama_models.dart';
import 'package:wydj/hj_model/drama_media_info.dart';
import 'package:wydj/hj_model/comment/reply_model.dart';
import 'package:wydj/hj_model/comment/user_comment_res.dart';
import 'package:wydj/hj_model/home/collection_model.dart';
import 'package:wydj/hj_model/media_content.dart';
import 'package:wydj/hj_model/message/message_dynamic_list.dart';
import 'package:wydj/hj_model/mine/exchange/bill_item_model.dart';
import 'package:wydj/hj_model/mine/follow_user_list_model.dart';
import 'package:wydj/hj_model/mine/promotion_record.dart';
import 'package:wydj/hj_model/video_model.dart';
import '../hj_page/ai/models/ai_change_face_video_model.dart';
import '../hj_page/ai/models/ai_record_model.dart';
+13 -7
View File
@@ -1,6 +1,6 @@
import 'package:hgmj/config/address.dart' as address;
import 'package:hgmj/hj_model/drama/drama_models.dart';
import 'package:hgmj/hj_model/video_model.dart';
import 'package:wydj/config/address.dart' as address;
import 'package:wydj/hj_model/drama/drama_models.dart';
import 'package:wydj/hj_model/video_model.dart';
import 'package:path/path.dart' as path;
/// 作品的「一集」:漫画一话 / 小说一章 / 有声一集 / 短剧一集 共用这一个模型,
@@ -73,7 +73,8 @@ class MediaContent {
audioUrl = json['audioUrl'];
//用 is List 判而不是 as List:下发 null 或非数组时硬 cast 会抛,整条分集就解析不出来
final rawUrlSet = json['urlSet'];
urlSet = rawUrlSet is List ? rawUrlSet.map((e) => e.toString()).toList() : [];
urlSet =
rawUrlSet is List ? rawUrlSet.map((e) => e.toString()).toList() : [];
text = json['text'];
md5 = json['md5'];
playTime = json['playTime'];
@@ -82,7 +83,9 @@ class MediaContent {
weight = json['weight'];
//数字直接转;后端也可能下发字符串("1.5"),那时才走 parse,脏值落 null
final rawRatio = json['ratio'];
ratio = rawRatio is num ? rawRatio.toDouble() : double.tryParse(rawRatio?.toString() ?? '');
ratio = rawRatio is num
? rawRatio.toDouble()
: double.tryParse(rawRatio?.toString() ?? '');
listenPermission = json['listenPermission'];
price = json['price'];
@@ -90,7 +93,8 @@ class MediaContent {
isFree = json['isFree'];
canPlay = json['canPlay'];
accessType = json['accessType'];
paywall = json['paywall'] != null ? DramaPaywall.fromJson(json['paywall']) : null;
paywall =
json['paywall'] != null ? DramaPaywall.fromJson(json['paywall']) : null;
isActive = json['isActive'];
previewEnabled = json['previewEnabled'];
@@ -105,7 +109,9 @@ class MediaContent {
countDisLike = json['countDisLike'];
countLike = json['countLike'];
countPurchases = json['countPurchases'];
mediaStatus = json['mediaStatus'] != null ? VidStatus.fromMap(json['mediaStatus']) : null;
mediaStatus = json['mediaStatus'] != null
? VidStatus.fromMap(json['mediaStatus'])
: null;
createdAt = json['createdAt'];
updateTime = json['updateTime'];
@@ -1,4 +1,4 @@
import 'package:hgmj/hj_model/mine/exchange/recharge_type_list_model.dart';
import 'package:wydj/hj_model/mine/exchange/recharge_type_list_model.dart';
import 'dc_model.dart';
@@ -11,6 +11,8 @@ class RechargeListModel {
json ??= {};
daichong = DCModel.fromJson(json['daichong']);
//代充数据挂在上级,逐条塞给档位,档位内部才能拼出代充支付方式
list = (json['list'] as List?)?.map((e) => RechargeTypeModel.fromJson(e)..daichong = daichong).toList();
list = (json['list'] as List?)
?.map((e) => RechargeTypeModel.fromJson(e)..daichong = daichong)
.toList();
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
import 'package:hgmj/hj_model/splash/ads_model.dart';
import 'package:wydj/hj_model/splash/ads_model.dart';
class AdGroup {
final List<AdsInfoModel>? items;
+99 -30
View File
@@ -1,4 +1,4 @@
import 'package:hgmj/assets_tool/images.dart';
import 'package:wydj/assets_tool/images.dart';
import '../../alert/vip_guide/guide_manager.dart';
import '../../config/config.dart';
@@ -20,7 +20,9 @@ class AdvanceStatus {
balancePayment = json['balancePayment'];
activityPopUp = json['activityPopUp'];
oid = json['oid'];
privilegeLimit = json['privilegeLimit'] != null ? PrivilegeLimit.fromJson(json['privilegeLimit']) : null;
privilegeLimit = json['privilegeLimit'] != null
? PrivilegeLimit.fromJson(json['privilegeLimit'])
: null;
}
}
@@ -43,7 +45,10 @@ class Remain {
int? todayCoinVideoCount; //今日剩余金币视频观看次数
int? todayDownloadCount; //今日剩余下载次数
Remain({this.todayAiUndressCount, this.todayCoinVideoCount, this.todayDownloadCount});
Remain(
{this.todayAiUndressCount,
this.todayCoinVideoCount,
this.todayDownloadCount});
Remain.fromJson(Map<String, dynamic> json) {
todayAiUndressCount = json['todayAiUndressCount'];
@@ -63,7 +68,8 @@ class BannerJump {
BannerJump({this.additionalProp});
BannerJump.fromJson(Map<String, dynamic> json, {String key = '1'}) {
additionalProp = json[key] != null ? AdditionalProp.fromJson(json[key]) : null;
additionalProp =
json[key] != null ? AdditionalProp.fromJson(json[key]) : null;
}
}
@@ -77,7 +83,15 @@ class AdditionalProp {
String? endAt; //结束时间
int? countdownType;
AdditionalProp({this.id, this.banner, this.endAt, this.position, this.startAt, this.title, this.url, this.countdownType});
AdditionalProp(
{this.id,
this.banner,
this.endAt,
this.position,
this.startAt,
this.title,
this.url,
this.countdownType});
AdditionalProp.fromJson(Map<String, dynamic> json) {
id = json['id'];
@@ -159,15 +173,23 @@ class DomainSourceModel {
Config.darkWebIcon = map['darkWebIcon'];
Config.darkWebIconName = map['darkWebIconName'];
Config.mineBg = map['personalCenterBackground'];
Config.entryPopupEnabled = map['shortDramaEntryPopupEnabled'] ?? true; //短剧引导气泡,字段缺失当开启
Config.isDramaEntry = map['defaultEntryPage'] == 'drama'; //默认进哪个 tab,缺字段/其它值都按主页
MineMsgProvider().payTier = PayTierModel.fromJson(map); //支付状态分层(各展示位图片/卡ID/倒计时)
Config.entryPopupEnabled =
map['shortDramaEntryPopupEnabled'] ?? true; //短剧引导气泡,字段缺失当开启
Config.isDramaEntry =
map['defaultEntryPage'] == 'drama'; //默认进哪个 tab,缺字段/其它值都按主页
MineMsgProvider().payTier =
PayTierModel.fromJson(map); //支付状态分层(各展示位图片/卡ID/倒计时)
GuideManager().update(map['paymentGuide']); //付费引导各场景开关(弹窗一律读缓存,不再临时查接口)
if (map['aiSwitchConf'] is List) {
Config.aiTypes = (map['aiSwitchConf'] as List).map((e) => AISwitchConf.fromJson(e)).toList();
Config.aiTypes = (map['aiSwitchConf'] as List)
.map((e) => AISwitchConf.fromJson(e))
.toList();
}
if (map.containsKey('bannerJumpList')) {
Config.bannerJumps = (map['bannerJumpList'] as List?)?.map((o) => BannerJumpEntity.fromJson(o)).toList() ?? [];
Config.bannerJumps = (map['bannerJumpList'] as List?)
?.map((o) => BannerJumpEntity.fromJson(o))
.toList() ??
[];
}
// 域名 / 线路 / 版本
@@ -175,10 +197,14 @@ class DomainSourceModel {
info.domain = (map['domain'] as List?)?.map((o) => o.toString()).toList();
}
if (map.containsKey('sourceList')) {
info.sourceList = (map['sourceList'] as List?)?.map((o) => Sourcelist.fromJson(o)).toList();
info.sourceList = (map['sourceList'] as List?)
?.map((o) => Sourcelist.fromJson(o))
.toList();
}
if (map.containsKey('ver')) {
info.ver = (map['ver'] as List?)?.map((o) => CheckVersionInfo.fromMap(o)).toList();
info.ver = (map['ver'] as List?)
?.map((o) => CheckVersionInfo.fromMap(o))
.toList();
}
// 广告
@@ -199,8 +225,12 @@ class DomainSourceModel {
if (map.containsKey('advanceStatus')) {
info.advanceStatus = AdvanceStatus.fromJson(map['advanceStatus']);
}
info.bannerJump = map['bannerJump'] != null ? BannerJump.fromJson(map['bannerJump']) : null;
info.proxyBannerJump = map['bannerJump'] != null ? BannerJump.fromJson(map['bannerJump'], key: '2') : null;
info.bannerJump = map['bannerJump'] != null
? BannerJump.fromJson(map['bannerJump'])
: null;
info.proxyBannerJump = map['bannerJump'] != null
? BannerJump.fromJson(map['bannerJump'], key: '2')
: null;
info.festivalUi = map['festivalUi'];
if (info.festivalUi?.isNotEmpty != true) info.festivalUi = '默认';
@@ -210,10 +240,12 @@ class DomainSourceModel {
// 搜索
if (map['hotSearchTerms'] is List) {
info.hotSearchTerms = (map['hotSearchTerms'] as List).map((e) => e.toString()).toList();
info.hotSearchTerms =
(map['hotSearchTerms'] as List).map((e) => e.toString()).toList();
}
if (map['searchHintWord'] is List) {
info.searchHintWord = (map['searchHintWord'] as List).map((e) => e.toString()).toList();
info.searchHintWord =
(map['searchHintWord'] as List).map((e) => e.toString()).toList();
}
// 暗网 VIP
@@ -221,7 +253,8 @@ class DomainSourceModel {
info.darkWebVipName = map['darkWebVipName'];
info.shortDramaCardId = map['shortDramaCardId'];
if (map['recommendVipIds'] is List) {
info.recommendVipIds = (map['recommendVipIds'] as List).map((e) => e.toString()).toList();
info.recommendVipIds =
(map['recommendVipIds'] as List).map((e) => e.toString()).toList();
}
// 其他
@@ -229,7 +262,9 @@ class DomainSourceModel {
info.broadcast = map['broadcast'] ?? false;
info.storeIsOpen = map['storeIsOpen'];
if (map['jgArea'] is List) {
info.jgArea = (map['jgArea'] as List?)?.map((e) => JGAreaModel.fromJson(e)).toList();
info.jgArea = (map['jgArea'] as List?)
?.map((e) => JGAreaModel.fromJson(e))
.toList();
}
return info;
}
@@ -292,9 +327,15 @@ class AdsBean {
static AdsBean fromMap(Map<String, dynamic>? map) {
map ??= {};
return AdsBean()
..announInfo = (map['announInfo'] as List?)?.map((o) => AnnounceInfoBean.fromJson(o)).toList()
..announList = (map['announList'] as List?)?.map((o) => AnnounceInfoBean.fromJson(o)).toList()
..adsInfoList = (map['adsInfoList'] as List?)?.map((o) => AdsInfoModel.fromMap(o)).toList();
..announInfo = (map['announInfo'] as List?)
?.map((o) => AnnounceInfoBean.fromJson(o))
.toList()
..announList = (map['announList'] as List?)
?.map((o) => AnnounceInfoBean.fromJson(o))
.toList()
..adsInfoList = (map['adsInfoList'] as List?)
?.map((o) => AdsInfoModel.fromMap(o))
.toList();
}
Map toJson() => {
@@ -313,7 +354,15 @@ class JGAreaModel {
String? linkUrl;
String? mid;
JGAreaModel({this.id, this.name, this.img, this.desc, this.linkType, this.linkUrl, this.type, this.mid});
JGAreaModel(
{this.id,
this.name,
this.img,
this.desc,
this.linkType,
this.linkUrl,
this.type,
this.mid});
factory JGAreaModel.fromJson(Map<String, dynamic> json) => JGAreaModel(
id: json["id"],
@@ -348,7 +397,8 @@ class Sourcelist {
factory Sourcelist.fromJson(Map<String, dynamic> json) => Sourcelist(
id: json["id"],
domain: List<Domain>.from(json["domain"].map((x) => Domain.fromJson(x))),
domain:
List<Domain>.from(json["domain"].map((x) => Domain.fromJson(x))),
isActive: json["isActive"],
type: json["type"],
);
@@ -436,7 +486,15 @@ class BannerJumpEntity {
String? endAt;
int? countdownType;
BannerJumpEntity({this.title, this.id, this.position, this.url, this.startAt, this.banner, this.endAt, this.countdownType});
BannerJumpEntity(
{this.title,
this.id,
this.position,
this.url,
this.startAt,
this.banner,
this.endAt,
this.countdownType});
BannerJumpEntity.fromJson(dynamic json) {
id = json['id'];
@@ -455,7 +513,8 @@ enum PayTier {
newUnpay('new_unpay'), //新用户:注册≤1天且从未付费 → 推新人200卡(新人价+首购引导+紧迫感)
under7DayUnpay('under_7_day_unpay'), //未付费·注册1~7天 → 推300卡(限时优惠+紧迫感)
over7DayUnpay('over_7_day_unpay'), //未付费·注册>7天 → 推300卡(永久卡唤醒需求+信任背书)
over7DayNeedUpgrade('over_7_day_need_upgrade'), //低级会员需续费:注册>7天且已付费、未达最高等级(<5) → 推500至尊卡
over7DayNeedUpgrade(
'over_7_day_need_upgrade'), //低级会员需续费:注册>7天且已付费、未达最高等级(<5) → 推500至尊卡
normal('normal'), //正常用户:无特殊弹窗
unregistered('unregistered'); //未注册(未登录)
@@ -496,7 +555,13 @@ class PayTierConfig {
String? vipCard; //点击跳转的会员卡 ID
int? lastDiscountTime; //优惠截止 Unix 时间戳(秒),早于当前则不展示倒计时
PayTierConfig({this.homePage, this.homePageFlot, this.playPage, this.meTab, this.vipCard, this.lastDiscountTime});
PayTierConfig(
{this.homePage,
this.homePageFlot,
this.playPage,
this.meTab,
this.vipCard,
this.lastDiscountTime});
PayTierConfig.fromJson(Map<String, dynamic>? json) {
json ??= {};
@@ -508,7 +573,8 @@ class PayTierConfig {
lastDiscountTime = _parseEpochSec(json['lastDiscountTime']);
}
static const _minValidEpochSec = 946684800; //2000-01-01,用于挡掉后端零值时间 0001-01-01T00:00:00Z
static const _minValidEpochSec =
946684800; //2000-01-01,用于挡掉后端零值时间 0001-01-01T00:00:00Z
//兼容 Unix 秒(int) / 数字字符串 / ISO 字符串(带 Z 或 +08:00 时区);零值哨兵一律归 null,避免负 epoch 流入业务
static int? _parseEpochSec(dynamic v) {
@@ -519,7 +585,8 @@ class PayTierConfig {
} else if (v is String) {
final s = v.trim();
if (s.isEmpty) return null;
sec = int.tryParse(s) ?? (DateTime.tryParse(s)?.millisecondsSinceEpoch ?? 0) ~/ 1000;
sec = int.tryParse(s) ??
(DateTime.tryParse(s)?.millisecondsSinceEpoch ?? 0) ~/ 1000;
}
return (sec != null && sec >= _minValidEpochSec) ? sec : null;
}
@@ -535,9 +602,11 @@ class PayTierConfig {
bool get hasDiscountCountdown => discountRemainSec > 0;
String get discountHour => (discountRemainSec ~/ 3600).toString().padLeft(2, '0');
String get discountHour =>
(discountRemainSec ~/ 3600).toString().padLeft(2, '0');
String get discountMin => ((discountRemainSec ~/ 60) % 60).toString().padLeft(2, '0');
String get discountMin =>
((discountRemainSec ~/ 60) % 60).toString().padLeft(2, '0');
String get discountSec => (discountRemainSec % 60).toString().padLeft(2, '0');
}
+8 -4
View File
@@ -1,4 +1,4 @@
import 'package:hgmj/assets_tool/images.dart';
import 'package:wydj/assets_tool/images.dart';
/// 用户信息
class UserInfoModel {
@@ -54,7 +54,8 @@ class UserInfoModel {
// ============ 计算属性 ============
/// 观影券总数量
int get couponCount => (goldVideoCoupon ?? []).fold(0, (sum, e) => sum + (e.count ?? 0));
int get couponCount =>
(goldVideoCoupon ?? []).fold(0, (sum, e) => sum + (e.count ?? 0));
/// 可解锁该金币视频的观影券面额:券面额需 >= 视频金币,都不够就退回第一张
int? couponGold(int? originCoins) {
@@ -66,7 +67,8 @@ class UserInfoModel {
}
/// 作品总数(视频上传 + 封面上传)
int get totalWorkCount => totalWorks ?? 0 ; //(vidUploadCount ?? 0) + (coverUploadCount ?? 0);
int get totalWorkCount =>
totalWorks ?? 0; //(vidUploadCount ?? 0) + (coverUploadCount ?? 0);
/// 会员等级对应的角标图片;等级 1~4,0 级(含推广会员)无角标
String get vipImageName {
@@ -111,7 +113,9 @@ class UserInfoModel {
allGoldVideoFree = map['allGoldVideoFree'] ?? false;
goldVideoFreeExpire = map['goldVideoFreeExpire'];
goldVideoCoupon = (map['goldVideoCoupon'] as List?)?.map((o) => MyCoupon.fromJson(o)).toList();
goldVideoCoupon = (map['goldVideoCoupon'] as List?)
?.map((o) => MyCoupon.fromJson(o))
.toList();
broadcastExpire = map['broadcastExpire'];
dramaExpire = map['dramaExpire'];
payVidDiscount = map['payVidDiscount'];
+24 -11
View File
@@ -1,5 +1,5 @@
import 'package:hgmj/hj_model/splash/ads_model.dart';
import 'package:hgmj/hj_utils/date_time_util.dart';
import 'package:wydj/hj_model/splash/ads_model.dart';
import 'package:wydj/hj_utils/date_time_util.dart';
import '../config/address.dart';
import '../tools_base/global_store/store.dart';
@@ -186,10 +186,12 @@ class VideoModel {
.toList();
title = map['title'];
via = map['via'];
comment = map.containsKey("comment") ? CommentBean.fromMap(map['comment']) : null;
comment =
map.containsKey("comment") ? CommentBean.fromMap(map['comment']) : null;
vidStatus = VidStatus.fromMap(map['vidStatus']);
if (map['seriesCover'] is List) {
seriesCover = (map['seriesCover'] as List).map((e) => e.toString()).toList();
seriesCover =
(map['seriesCover'] as List).map((e) => e.toString()).toList();
}
newsType = map['newsType'];
reason = map['reason'];
@@ -302,7 +304,9 @@ class VideoModel {
/// 拼 m3u8 完整播放链接:各播放源共用同一套 host / token / cdn 参数。
/// 后端偶尔直接下发完整链接(265、短剧下载授权地址),那种别再往前面拼一遍 host
String _m3u8(String? path) {
if (path != null && (path.startsWith('http://') || path.startsWith('https://'))) return path;
if (path != null &&
(path.startsWith('http://') || path.startsWith('https://')))
return path;
return "${Address.baseApiPath}/vid/h5/m3u8/$path?token=${Address.token}&c=${Address.cdnAddress}";
}
@@ -332,8 +336,10 @@ class VideoModel {
/// - 普通源:[useH265] 且有 265 地址 → 265(省带宽),否则 264(兜底)
/// [useH265] 由调用方算好传入(设备硬解能力 + 本条是否已运行时回退),model 不依赖 CodecSupport
String realPlayUrl({required bool canPlayPreview, required bool useH265}) {
if (playContentStyle == 2 && chineseLink?.isNotEmpty == true) return realChineseUrl;
if (playContentStyle == 3 && codelessLink?.isNotEmpty == true) return realUncodeUrl;
if (playContentStyle == 2 && chineseLink?.isNotEmpty == true)
return realChineseUrl;
if (playContentStyle == 3 && codelessLink?.isNotEmpty == true)
return realUncodeUrl;
if (canPlayPreview) return realPreviewUrl;
if (useH265 && realH265Url.isNotEmpty) return realH265Url;
return realVideoUrl;
@@ -343,7 +349,8 @@ class VideoModel {
/// 展示用创建时间:createdAt 为空或后端占位值时退回审核通过时间
String? get realCreateAt {
if (createdAt?.contains("0001-01-01") == true || createdAt?.isNotEmpty != true) {
if (createdAt?.contains("0001-01-01") == true ||
createdAt?.isNotEmpty != true) {
return reviewAt;
}
return createdAt;
@@ -356,7 +363,8 @@ class VideoModel {
return sec >= start && sec < end;
}
bool get isDarkTag => tags?.any((e) => e.name?.contains("暗网") == true) ?? false;
bool get isDarkTag =>
tags?.any((e) => e.name?.contains("暗网") == true) ?? false;
String get allTags => tags?.map((e) => e.name).join(' ') ?? '';
@@ -448,14 +456,19 @@ extension LockType on VideoModel {
/// 帖子流相关的判断与封面取值扩展(社区/个人主页等场景使用)
extension Post on VideoModel {
bool isVideo() {
return newsType == 'SP' || newsType == 'MOVIE' || newsType == 'SHORT' || newsType == 'COVER';
return newsType == 'SP' ||
newsType == 'MOVIE' ||
newsType == 'SHORT' ||
newsType == 'COVER';
}
//埋点专用
String get contentType => newsType == 'SP' ? 'video' : 'short_video';
bool isSeedPost() {
return newsType == 'ADULT_GAME' || (seedLink?.isNotEmpty ?? false) || newsType == 'SEED_LINK';
return newsType == 'ADULT_GAME' ||
(seedLink?.isNotEmpty ?? false) ||
newsType == 'SEED_LINK';
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:hgmj/hj_utils/api_service/ai_service.dart';
import 'package:hgmj/tools_base/base_list_controller.dart';
import 'package:wydj/hj_utils/api_service/ai_service.dart';
import 'package:wydj/tools_base/base_list_controller.dart';
import 'ai_sub_type/ai_function_logic.dart';
import 'models/ai_mod_list_model.dart';
+3 -3
View File
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/loading/loading_center_widget.dart';
import 'package:hgmj/tools_base/widget/keep_alive_widget.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/loading/loading_center_widget.dart';
import 'package:wydj/tools_base/widget/keep_alive_widget.dart';
import '../../assets_tool/app_colors.dart';
import '../../tools_base/indicator/custom_tab_indicator.dart';
+3 -2
View File
@@ -4,7 +4,7 @@ import 'package:get/get.dart';
import '../../../alert/mine/vip_level_dialog.dart';
import '../../../config/config.dart';
import '../../../hj_utils/api_service/ai_service.dart';
import 'package:hgmj/tools_base/toast.dart';
import 'package:wydj/tools_base/toast.dart';
import '../../../tools_base/global_store/store.dart';
import '../../../tools_base/loading/loading_helper.dart';
import '../ai_sub_type/ai_function_logic.dart';
@@ -37,7 +37,8 @@ class AiPaintLogic extends AiFunctionBaseLogic {
@override
Future<void> submit() async {
if ((globalStore.wallet?.amount ?? 0) < (int.tryParse(Config.aiDrawPrice) ?? 0)) {
if ((globalStore.wallet?.amount ?? 0) <
(int.tryParse(Config.aiDrawPrice) ?? 0)) {
showVipLevelDialog(
"当前金币不足",
buttonTitle: '我知道了',
+41 -19
View File
@@ -2,10 +2,10 @@ import 'dart:math';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/config/config.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/config/config.dart';
import 'package:wydj/hj_utils/screen.dart';
import '../../../tools_base/widget/net_image_widget.dart';
import '../models/ai_mod_list_model.dart';
@@ -30,7 +30,8 @@ class AiPaintPage extends StatelessWidget {
children: [
Expanded(
child: SingleChildScrollView(
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
keyboardDismissBehavior:
ScrollViewKeyboardDismissBehavior.onDrag,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -86,31 +87,45 @@ class AiPaintPage extends StatelessWidget {
logic.aspectRatios.length,
(index) => Padding(
padding: EdgeInsets.only(right: 12),
child: InkWell(enableFeedback: false,
child: InkWell(
enableFeedback: false,
onTap: () {
logic.selectIndex = index;
logic.update();
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 8),
padding:
EdgeInsets.symmetric(horizontal: 8),
alignment: Alignment.center,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: logic.selectIndex == index
? [AppColors.actionRed, AppColors.actionRed]
? [
AppColors.actionRed,
AppColors.actionRed
]
: [
Colors.white.withValues(alpha: .05),
Colors.white.withValues(alpha: .05),
Colors.white
.withValues(alpha: .05),
Colors.white
.withValues(alpha: .05),
]),
borderRadius: BorderRadius.circular(4),
color: logic.selectIndex == index ? null : Color(0xFF7C7C7C),
color: logic.selectIndex == index
? null
: Color(0xFF7C7C7C),
),
height: 28,
child: Text(
logic.aspectRatios[index],
style: TextStyle(
color: logic.selectIndex == index ? Colors.white : Colors.white.withValues(alpha: .5),
fontSize: logic.selectIndex == index ? 14 : 12,
color: logic.selectIndex == index
? Colors.white
: Colors.white
.withValues(alpha: .5),
fontSize: logic.selectIndex == index
? 14
: 12,
fontWeight: FontWeight.w400,
),
),
@@ -160,7 +175,8 @@ class AiPaintPage extends StatelessWidget {
)
],
),
InkWell(enableFeedback: false,
InkWell(
enableFeedback: false,
onTap: () => logic.submit(),
child: Container(
height: 44,
@@ -193,19 +209,23 @@ class AiPaintPage extends StatelessWidget {
Widget _getStyleView(AiPaintLogic logic) {
return logic.isFold
? InkWell(enableFeedback: false,
? InkWell(
enableFeedback: false,
onTap: () {
logic.isFold = !logic.isFold;
logic.update();
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 10),
padding:
const EdgeInsets.symmetric(horizontal: 10.0, vertical: 10),
child: Row(
children: [
_buildStyleTitle(),
Spacer(),
NetworkImageLoader(
imageUrl: logic.models.length > 1 ? logic.models[logic.chooseItemIndex].cover ?? "" : '',
imageUrl: logic.models.length > 1
? logic.models[logic.chooseItemIndex].cover ?? ""
: '',
width: 32,
height: 32,
),
@@ -220,13 +240,15 @@ class AiPaintPage extends StatelessWidget {
)
: Column(
children: [
InkWell(enableFeedback: false,
InkWell(
enableFeedback: false,
onTap: () {
logic.isFold = !logic.isFold;
logic.update();
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 10),
padding: const EdgeInsets.symmetric(
horizontal: 10.0, vertical: 10),
child: Row(
children: [
_buildStyleTitle(),
+12 -8
View File
@@ -1,5 +1,5 @@
import 'package:hgmj/hj_utils/api_service/ai_service.dart';
import 'package:hgmj/tools_base/base_list_controller.dart';
import 'package:wydj/hj_utils/api_service/ai_service.dart';
import 'package:wydj/tools_base/base_list_controller.dart';
import 'ai_sub_type/ai_function_logic.dart';
import 'models/ai_mod_list_model.dart';
@@ -28,7 +28,8 @@ class AIFaceTemplateLogic extends ListBaseLogic<TemplateModel> {
void loadData() async {
dataList ??= [];
final resp = await AIService.getModelListV2(type: type, categoryId: mod?.id ?? '');
final resp =
await AIService.getModelListV2(type: type, categoryId: mod?.id ?? '');
if (resp != null) {
dataList?.addAll(resp.templateList ?? []);
//默认上架时间降序
@@ -49,18 +50,21 @@ class AIFaceTemplateLogic extends ListBaseLogic<TemplateModel> {
switch (sortIndex) {
case 0:
dataList?.sort(
(obj1, obj2) => ascending ? obj2.timestamp.compareTo(obj1.timestamp) : obj1.timestamp.compareTo(obj2.timestamp),
(obj1, obj2) => ascending
? obj2.timestamp.compareTo(obj1.timestamp)
: obj1.timestamp.compareTo(obj2.timestamp),
);
case 1:
dataList?.sort(
(obj1, obj2) => ascending
? (obj2.usedCount ?? 0).compareTo(obj1.usedCount ?? 0) :
(obj1.usedCount ?? 0).compareTo(obj2.usedCount ?? 0),
? (obj2.usedCount ?? 0).compareTo(obj1.usedCount ?? 0)
: (obj1.usedCount ?? 0).compareTo(obj2.usedCount ?? 0),
);
case 2:
dataList?.sort(
(obj1, obj2) =>
ascending ? (obj2.coin ?? 0).compareTo(obj1.coin ?? 0) : (obj1.coin ?? 0).compareTo(obj2.coin ?? 0),
(obj1, obj2) => ascending
? (obj2.coin ?? 0).compareTo(obj1.coin ?? 0)
: (obj1.coin ?? 0).compareTo(obj2.coin ?? 0),
);
default:
}
+19 -10
View File
@@ -2,10 +2,10 @@ import 'dart:math';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/loading/loading_center_widget.dart';
import 'package:hgmj/tools_base/widget/net_image_widget.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/loading/loading_center_widget.dart';
import 'package:wydj/tools_base/widget/net_image_widget.dart';
import '../../assets_tool/app_colors.dart';
import 'ai_face_sub_logic.dart';
@@ -17,7 +17,8 @@ import 'models/ai_mod_list_model.dart';
class AIFaceChangeSubPage extends StatelessWidget {
final AICategoryMod? mod;
final AiType type; //图片换脸 / 视频换脸
const AIFaceChangeSubPage({super.key, this.mod, this.type = AiType.imageChangeFace});
const AIFaceChangeSubPage(
{super.key, this.mod, this.type = AiType.imageChangeFace});
// 多分类子页作为 TabBarView 的 keepAlive children 并存,用 type+分类id 隔离各自 logic 实例
String get _tag => 'ai_face_sub_${type.name}_${mod?.id}';
@@ -51,7 +52,8 @@ class AIFaceChangeSubPage extends StatelessWidget {
itemCount: logic.dataList?.length ?? 0,
itemBuilder: (context, index) {
TemplateModel? model = logic.dataList?[index];
return InkWell(enableFeedback: false,
return InkWell(
enableFeedback: false,
onTap: () => Get.to(AIModDetailPage(model!)),
child: NetworkImageLoader(imageUrl: model?.cover ?? ''),
);
@@ -78,9 +80,11 @@ class AIFaceChangeSubPage extends StatelessWidget {
);
}
Widget _buildSortItem(String title, bool ascending, int sortIndex, AIFaceTemplateLogic logic) {
Widget _buildSortItem(
String title, bool ascending, int sortIndex, AIFaceTemplateLogic logic) {
final bool sel = logic.sortIndex == sortIndex;
return InkWell(enableFeedback: false,
return InkWell(
enableFeedback: false,
onTap: () => logic.changeSortAction(sortIndex),
child: Container(
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 3),
@@ -92,7 +96,11 @@ class AIFaceChangeSubPage extends StatelessWidget {
children: [
Text(
title,
style: TextStyle(fontSize: 12, color: Colors.white, fontWeight: FontWeight.w500, height: 1.5),
style: TextStyle(
fontSize: 12,
color: Colors.white,
fontWeight: FontWeight.w500,
height: 1.5),
),
5.sizeBoxW,
Column(
@@ -100,7 +108,8 @@ class AIFaceChangeSubPage extends StatelessWidget {
children: [
_buildArrow(active: sel && ascending),
4.sizeBoxH,
Transform.rotate(angle: -pi, child: _buildArrow(active: sel && !ascending)),
Transform.rotate(
angle: -pi, child: _buildArrow(active: sel && !ascending)),
],
),
],
@@ -1,8 +1,8 @@
import 'package:get/get.dart';
import 'package:hgmj/hj_utils/api_service/ai_service.dart';
import 'package:hgmj/tools_base/debug_log.dart';
import 'package:hgmj/tools_base/loading/loading_alert_widget.dart';
import 'package:hgmj/tools_base/toast.dart';
import 'package:wydj/hj_utils/api_service/ai_service.dart';
import 'package:wydj/tools_base/debug_log.dart';
import 'package:wydj/tools_base/loading/loading_alert_widget.dart';
import 'package:wydj/tools_base/toast.dart';
import '../models/ai_girl_resp_model.dart';
import '../widgets/ai_girl_sheet.dart';
@@ -54,7 +54,8 @@ class AIGrilFriendLogic extends GetxController {
//充值操作
onRechargeBottomSheet() async {
if (currencys != null && currencys?.list?.isNotEmpty == true) {
Get.bottomSheet(AIGirlSheet(list: currencys?.list), isScrollControlled: true);
Get.bottomSheet(AIGirlSheet(list: currencys?.list),
isScrollControlled: true);
} else {
await onFetchChargeList();
if (currencys?.list?.isNotEmpty != true) {
@@ -1,7 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:wydj/assets_tool/images.dart';
import '../../../hj_utils/widget_util.dart';
import '../../../tools_base/unique_tag_mixin.dart';
@@ -15,7 +15,8 @@ class AIGrilFriendPage extends StatefulWidget {
State<AIGrilFriendPage> createState() => _AIGrilFriendPageState();
}
class _AIGrilFriendPageState extends State<AIGrilFriendPage> with UniqueTagMixin {
class _AIGrilFriendPageState extends State<AIGrilFriendPage>
with UniqueTagMixin {
@override
Widget build(BuildContext context) {
return GetBuilder<AIGrilFriendLogic>(
@@ -67,7 +68,8 @@ class _AIGrilFriendPageState extends State<AIGrilFriendPage> with UniqueTagMixin
child: Obx(
() => Text(
logic.tips.value,
style: textStyle(17, Colors.white, FontWeight.w500),
style:
textStyle(17, Colors.white, FontWeight.w500),
),
)),
),
@@ -77,7 +79,8 @@ class _AIGrilFriendPageState extends State<AIGrilFriendPage> with UniqueTagMixin
child: GestureDetector(
child: GestureDetector(
onTap: () => Get.back(),
child: const Icon(Icons.arrow_back_ios, size: 24, color: Colors.white),
child: const Icon(Icons.arrow_back_ios,
size: 24, color: Colors.white),
),
),
)
@@ -101,7 +104,8 @@ class _AIGrilFriendPageState extends State<AIGrilFriendPage> with UniqueTagMixin
GestureDetector(
child: GestureDetector(
onTap: () => Get.back(),
child: const Icon(Icons.arrow_back_ios, size: 24, color: Colors.white),
child: const Icon(Icons.arrow_back_ios,
size: 24, color: Colors.white),
),
),
Container(
+3 -2
View File
@@ -3,7 +3,7 @@ import 'dart:collection';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import '../../../hj_utils/widget_util.dart';
import '../../web_page/h5_webview_settings.dart';
@@ -27,7 +27,8 @@ class _YHYSH5ViewState extends State<AiH5Page> {
fit: StackFit.expand,
children: [
InAppWebView(
initialUrlRequest: URLRequest(url: WebUri(widget.webUrl ?? "")), //h5的url
initialUrlRequest:
URLRequest(url: WebUri(widget.webUrl ?? "")), //h5的url
initialSettings: h5WebViewSettings,
initialUserScripts: UnmodifiableListView<UserScript>([]),
),
+8 -6
View File
@@ -2,10 +2,10 @@ import 'dart:math';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/hj_page/pre_sale/pre_sale_provider.dart';
import 'package:hgmj/hj_utils/api_service/ai_service.dart';
import 'package:hgmj/tools_base/global_store/store.dart';
import 'package:hgmj/tools_base/widget/keep_alive_widget.dart';
import 'package:wydj/hj_page/pre_sale/pre_sale_provider.dart';
import 'package:wydj/hj_utils/api_service/ai_service.dart';
import 'package:wydj/tools_base/global_store/store.dart';
import 'package:wydj/tools_base/widget/keep_alive_widget.dart';
import '../../config/config.dart';
import '../../hj_model/splash/domain_source_model.dart';
@@ -18,7 +18,8 @@ import './ai_sub_type/ai_strip_sub_page.dart';
import './models/ai_mod_list_model.dart';
import 'ai_square/ai_square_page.dart';
class AiHomeLogic extends GetxController with GetSingleTickerProviderStateMixin {
class AiHomeLogic extends GetxController
with GetSingleTickerProviderStateMixin {
bool isShowLoading = true;
final AiType? aiType;
// int tabIndex;
@@ -50,7 +51,8 @@ class AiHomeLogic extends GetxController with GetSingleTickerProviderStateMixin
//3.获取到默认进来的排序
int? initialIndex = aiTypes?.indexWhere((model) => model.aiType == aiType);
initialIndex = max(0, initialIndex ?? 0);
tabCtr = TabController(initialIndex: initialIndex, length: menus.length, vsync: this)
tabCtr = TabController(
initialIndex: initialIndex, length: menus.length, vsync: this)
..addListener(() {
if (!tabCtr.indexIsChanging) {
update(['tab']);
+22 -9
View File
@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/loading/loading_center_widget.dart';
import 'package:hgmj/tools_base/widget/keep_alive_widget.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/loading/loading_center_widget.dart';
import 'package:wydj/tools_base/widget/keep_alive_widget.dart';
import '../../hj_utils/widget_util.dart';
import 'ai_home_logic.dart';
@@ -36,7 +36,10 @@ class AiHomePage extends StatelessWidget {
),
child: Text(
'记录',
style: textStyle(14, Colors.white.withValues(alpha: 0.55), FontWeight.w400),
style: textStyle(
14,
Colors.white.withValues(alpha: 0.55),
FontWeight.w400),
),
),
),
@@ -61,7 +64,9 @@ class AiHomePage extends StatelessWidget {
Expanded(
child: TabBarView(
controller: logic.tabCtr,
children: logic.menus.map<Widget>((e) => logic.subPage(e).keepAlive).toList(),
children: logic.menus
.map<Widget>((e) => logic.subPage(e).keepAlive)
.toList(),
),
)
],
@@ -100,8 +105,13 @@ class AiHomePage extends StatelessWidget {
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
color: isSelected ? Color(0xffFFC000) : Colors.white.withValues(alpha: .1),
border: isSelected ? null : Border.all(width: 1, color: Colors.white.withValues(alpha: .35)),
color: isSelected
? Color(0xffFFC000)
: Colors.white.withValues(alpha: .1),
border: isSelected
? null
: Border.all(
width: 1, color: Colors.white.withValues(alpha: .35)),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
@@ -114,7 +124,10 @@ class AiHomePage extends StatelessWidget {
4.sizeBoxW,
Text(
menu.aiTypeName ?? '',
style: textStyle(12, isSelected ? Colors.black : Colors.white, FontWeight.w400),
style: textStyle(
12,
isSelected ? Colors.black : Colors.white,
FontWeight.w400),
),
],
),
@@ -2,13 +2,13 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/config/config.dart';
import 'package:hgmj/hj_utils/api_service/ai_service.dart';
import 'package:hgmj/tools_base/toast.dart';
import 'package:hgmj/tools_base/file_upload/file_upload_tool.dart';
import 'package:hgmj/tools_base/global_store/store.dart';
import 'package:hgmj/tools_base/loading/loading_alert_widget.dart';
import 'package:hgmj/tools_base/widget/common_alert.dart';
import 'package:wydj/config/config.dart';
import 'package:wydj/hj_utils/api_service/ai_service.dart';
import 'package:wydj/tools_base/toast.dart';
import 'package:wydj/tools_base/file_upload/file_upload_tool.dart';
import 'package:wydj/tools_base/global_store/store.dart';
import 'package:wydj/tools_base/loading/loading_alert_widget.dart';
import 'package:wydj/tools_base/widget/common_alert.dart';
import '../../../alert/mine/vip_level_dialog.dart';
import '../../../hj_model/splash/ads_model.dart';
@@ -26,7 +26,8 @@ class AiItvLogic extends GetxController {
AiItvLogic({this.model});
Future<void> submit() async {
if ((globalStore.wallet?.amount ?? 0) < (int.tryParse(Config.aiVideoPrice) ?? 0)) {
if ((globalStore.wallet?.amount ?? 0) <
(int.tryParse(Config.aiVideoPrice) ?? 0)) {
showVipLevelDialog(
"当前金币不足",
buttonTitle: '我知道了',
@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/config/config.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/banner/ads_banner.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/config/config.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/banner/ads_banner.dart';
import '../../../hj_model/splash/ads_model.dart';
import '../widgets/pic_picker.dart';
@@ -20,7 +20,8 @@ class AiItvPage extends StatelessWidget {
appBar: AppBar(
title: Text(
model?.title ?? '图生视频',
style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w600),
style: TextStyle(
color: Colors.white, fontSize: 16, fontWeight: FontWeight.w600),
),
centerTitle: false,
titleSpacing: -20,
@@ -78,7 +79,10 @@ class AiItvPage extends StatelessWidget {
18.sizeBoxH,
Text(
"案列鉴赏",
style: TextStyle(fontSize: 18, color: Colors.white, fontWeight: FontWeight.w600),
style: TextStyle(
fontSize: 18,
color: Colors.white,
fontWeight: FontWeight.w600),
),
12.sizeBoxH,
ClipRRect(
@@ -100,7 +104,9 @@ class AiItvPage extends StatelessWidget {
children: [
Text(
"处理一张照片的费用是 ",
style: TextStyle(color: Colors.white.withValues(alpha: .6), fontSize: 14),
style: TextStyle(
color: Colors.white.withValues(alpha: .6),
fontSize: 14),
),
Text(
"${Config.aiVideoPrice}金币",
@@ -112,7 +118,8 @@ class AiItvPage extends StatelessWidget {
],
),
18.sizeBoxH,
InkWell(enableFeedback: false,
InkWell(
enableFeedback: false,
onTap: () => logic.submit(),
child: Container(
height: 44,
+26 -14
View File
@@ -1,12 +1,12 @@
import 'package:easy_rich_text/easy_rich_text.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/hj_page/pre_sale/pre_sale_provider.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/global_store/store.dart';
import 'package:hgmj/tools_base/widget/net_image_widget.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/hj_page/pre_sale/pre_sale_provider.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/global_store/store.dart';
import 'package:wydj/tools_base/widget/net_image_widget.dart';
import 'package:provider/provider.dart';
import '../../hj_model/video_model.dart';
@@ -45,7 +45,8 @@ class AIModDetailPage extends StatelessWidget {
bottom: 0,
left: 0,
right: 0,
child: InkWell(enableFeedback: false,
child: InkWell(
enableFeedback: false,
onTap: () => logic.submit(),
child: Container(
height: 44,
@@ -91,9 +92,11 @@ class AIModDetailPage extends StatelessWidget {
),
//视频换脸
if (logic.isChangeVideo)
InkWell(enableFeedback: false,
InkWell(
enableFeedback: false,
onTap: () {
VideoModel videoModel = VideoModel()..sourceURL = logic.mod.m3u8Url;
VideoModel videoModel = VideoModel()
..sourceURL = logic.mod.m3u8Url;
Get.to(
SimpleVideoPlayerPage(
videoUrl: videoModel.realVideoUrl,
@@ -205,7 +208,10 @@ class AIModDetailPage extends StatelessWidget {
12.sizeBoxH,
EasyRichText(
'处理一张照片的费用是 ${logic.price}金币',
defaultStyle: TextStyle(color: Color(0xff989898), fontSize: 14, fontWeight: FontWeight.w400),
defaultStyle: TextStyle(
color: Color(0xff989898),
fontSize: 14,
fontWeight: FontWeight.w400),
patternList: [
EasyRichTextPattern(
targetString: '${logic.price}金币',
@@ -218,7 +224,10 @@ class AIModDetailPage extends StatelessWidget {
12.sizeBoxH,
EasyRichText(
'已抵扣 ${logic.coupon?.goodsValue ?? 0}金币',
defaultStyle: TextStyle(color: Colors.white.withValues(alpha: .55), fontSize: 14, fontWeight: FontWeight.w400),
defaultStyle: TextStyle(
color: Colors.white.withValues(alpha: .55),
fontSize: 14,
fontWeight: FontWeight.w400),
patternList: [
EasyRichTextPattern(
targetString: '${logic.coupon?.goodsValue ?? 0}金币',
@@ -230,7 +239,8 @@ class AIModDetailPage extends StatelessWidget {
12.sizeBoxH,
Row(
children: [
InkWell(enableFeedback: false,
InkWell(
enableFeedback: false,
onTap: () => logic.showCoupon(),
child: GradientText(
logic.coupon == null ? '使用抵扣券' : '更换抵扣券',
@@ -245,7 +255,8 @@ class AIModDetailPage extends StatelessWidget {
),
if (logic.coupon != null) ...[
12.sizeBoxW,
InkWell(enableFeedback: false,
InkWell(
enableFeedback: false,
onTap: () {
//取消优惠券
logic.coupon = null;
@@ -253,7 +264,8 @@ class AIModDetailPage extends StatelessWidget {
},
child: Text(
'取消',
style: textStyle(14, Colors.white.withValues(alpha: .55), FontWeight.w400),
style: textStyle(14, Colors.white.withValues(alpha: .55),
FontWeight.w400),
),
)
]
+2 -2
View File
@@ -1,9 +1,9 @@
//ai小说
import 'package:flutter/material.dart';
import 'package:hgmj/tools_base/loading/loading_helper.dart';
import 'package:wydj/tools_base/loading/loading_helper.dart';
import '../../../../hj_utils/api_service/ai_service.dart';
import 'package:hgmj/tools_base/toast.dart';
import 'package:wydj/tools_base/toast.dart';
import '../ai_sub_type/ai_function_logic.dart';
class AINovelLogic extends AiFunctionBaseLogic {
+23 -11
View File
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/config/config.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/config/config.dart';
import 'package:wydj/hj_utils/screen.dart';
import '../widgets/ai_draw_text_field.dart';
import 'ai_novel_logic.dart';
@@ -22,7 +22,8 @@ class AINovelSubPage extends StatelessWidget {
children: [
Expanded(
child: SingleChildScrollView(
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
keyboardDismissBehavior:
ScrollViewKeyboardDismissBehavior.onDrag,
padding: EdgeInsets.symmetric(horizontal: 6).copyWith(top: 12),
child: Column(
children: [
@@ -70,7 +71,8 @@ class AINovelSubPage extends StatelessWidget {
logic.mods.length,
(index) => Padding(
padding: EdgeInsets.only(right: 12),
child: InkWell(enableFeedback: false,
child: InkWell(
enableFeedback: false,
onTap: () {
logic.selectIndex = index;
logic.update();
@@ -81,19 +83,28 @@ class AINovelSubPage extends StatelessWidget {
decoration: BoxDecoration(
gradient: LinearGradient(
colors: logic.selectIndex == index
? [AppColors.actionRed, AppColors.actionRed]
? [
AppColors.actionRed,
AppColors.actionRed
]
: [
Colors.white.withValues(alpha: .05),
Colors.white.withValues(alpha: .05),
Colors.white
.withValues(alpha: .05),
Colors.white
.withValues(alpha: .05),
]),
borderRadius: BorderRadius.circular(4),
color: logic.selectIndex == index ? null : Color(0xFF7C7C7C),
color: logic.selectIndex == index
? null
: Color(0xFF7C7C7C),
),
height: 28,
child: Text(
logic.mods[index],
style: TextStyle(
color: logic.selectIndex == index ? Colors.black : Colors.white.withValues(alpha: .5),
color: logic.selectIndex == index
? Colors.black
: Colors.white.withValues(alpha: .5),
fontSize: 14,
fontWeight: FontWeight.w400,
),
@@ -125,7 +136,8 @@ class AINovelSubPage extends StatelessWidget {
)
],
),
InkWell(enableFeedback: false,
InkWell(
enableFeedback: false,
onTap: () => logic.submit(),
child: Container(
height: 44,
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/tools_base/indicator/custom_tab_indicator.dart';
import 'package:hgmj/tools_base/widget/keep_alive_widget.dart';
import 'package:wydj/tools_base/indicator/custom_tab_indicator.dart';
import 'package:wydj/tools_base/widget/keep_alive_widget.dart';
import '../../../hj_model/splash/domain_source_model.dart';
import '../ai_sub_type/ai_function_logic.dart';
@@ -65,7 +65,8 @@ class AIMainRecordPage extends StatelessWidget {
fontWeight: FontWeight.w500,
),
unselectedLabelColor: Colors.white.withValues(alpha: .35),
unselectedLabelStyle: const TextStyle(fontSize: 14, fontWeight: FontWeight.w400),
unselectedLabelStyle:
const TextStyle(fontSize: 14, fontWeight: FontWeight.w400),
indicator: CustomIndicator(
isGradient: true,
width: 13,
+15 -9
View File
@@ -1,10 +1,10 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/hj_model/list_base_model.dart';
import 'package:hgmj/hj_utils/api_service/ai_service.dart';
import 'package:hgmj/tools_base/toast.dart';
import 'package:wydj/hj_model/list_base_model.dart';
import 'package:wydj/hj_utils/api_service/ai_service.dart';
import 'package:wydj/tools_base/toast.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:hgmj/tools_base/widget/common_alert.dart';
import 'package:wydj/tools_base/widget/common_alert.dart';
import '../ai_sub_type/ai_function_logic.dart';
import '../models/ai_record_model.dart';
@@ -41,7 +41,9 @@ class AIRecordLogic extends GetxController {
refreshCtr?.refreshCompleted();
}
dataSource.addAll(res?.list ?? []);
(res?.hasNext ?? false) ? refreshCtr?.loadComplete() : refreshCtr?.loadNoData();
(res?.hasNext ?? false)
? refreshCtr?.loadComplete()
: refreshCtr?.loadNoData();
page += 1;
} catch (e) {
isLoading = false;
@@ -73,13 +75,17 @@ class AIRecordLogic extends GetxController {
final model = dataSource[index];
switch (aiType) {
case AiType.aiNovel:
return AINovelRecord(model, onDeleteCallback: () => deleteRecord(index));
return AINovelRecord(model,
onDeleteCallback: () => deleteRecord(index));
case AiType.imageToVideo:
return AIVideoRecord(model, status: sort, onDeleteCallback: () => deleteRecord(index));
return AIVideoRecord(model,
status: sort, onDeleteCallback: () => deleteRecord(index));
case AiType.aiPaint:
return AIPaintRecord(model, status: sort, onDeleteCallback: () => deleteRecord(index));
return AIPaintRecord(model,
status: sort, onDeleteCallback: () => deleteRecord(index));
default: //脱衣 / 视频换脸 / 图片换脸
return AIImageRecord(model, aiType: aiType, onDeleteCallback: () => deleteRecord(index));
return AIImageRecord(model,
aiType: aiType, onDeleteCallback: () => deleteRecord(index));
}
}
+19 -11
View File
@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/loading/loading_center_widget.dart';
import 'package:hgmj/tools_base/refresh/pull_refresh.dart';
import 'package:hgmj/tools_base/widget/keep_alive_widget.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/loading/loading_center_widget.dart';
import 'package:wydj/tools_base/refresh/pull_refresh.dart';
import 'package:wydj/tools_base/widget/keep_alive_widget.dart';
import '../ai_sub_type/ai_function_logic.dart';
import 'ai_record_logic.dart';
@@ -20,8 +20,10 @@ class AiRecordPage extends StatefulWidget {
State<AiRecordPage> createState() => _AiRecordPageState();
}
class _AiRecordPageState extends State<AiRecordPage> with SingleTickerProviderStateMixin {
late final TabController _tabCtr = TabController(length: _subTypes.length, vsync: this);
class _AiRecordPageState extends State<AiRecordPage>
with SingleTickerProviderStateMixin {
late final TabController _tabCtr =
TabController(length: _subTypes.length, vsync: this);
@override
void dispose() {
@@ -39,7 +41,9 @@ class _AiRecordPageState extends State<AiRecordPage> with SingleTickerProviderSt
controller: _tabCtr,
children: List.generate(
_subTypes.length,
(index) => _AiRecordStatusList(aiType: widget.aiType, status: index + 1).keepAlive,
(index) =>
_AiRecordStatusList(aiType: widget.aiType, status: index + 1)
.keepAlive,
),
),
)
@@ -58,7 +62,8 @@ class _AiRecordPageState extends State<AiRecordPage> with SingleTickerProviderSt
decoration: BoxDecoration(
border: index != 2
? Border(
right: BorderSide(width: .5, color: Colors.white.withValues(alpha: .1)),
right: BorderSide(
width: .5, color: Colors.white.withValues(alpha: .1)),
)
: null,
),
@@ -69,8 +74,10 @@ class _AiRecordPageState extends State<AiRecordPage> with SingleTickerProviderSt
padding: EdgeInsets.only(top: 10, left: 7),
labelPadding: EdgeInsets.zero,
tabAlignment: TabAlignment.start,
unselectedLabelStyle: TextStyle(color: Colors.white.withValues(alpha: .35), fontSize: 14),
labelStyle: TextStyle(color: Colors.white.withValues(alpha: .9), fontSize: 14),
unselectedLabelStyle:
TextStyle(color: Colors.white.withValues(alpha: .35), fontSize: 14),
labelStyle:
TextStyle(color: Colors.white.withValues(alpha: .9), fontSize: 14),
indicator: const BoxDecoration(),
);
}
@@ -108,7 +115,8 @@ class _AiRecordStatusList extends StatelessWidget {
padding: EdgeInsets.only(left: 16, right: 16, top: 18),
separatorBuilder: (_, index) => 12.sizeBoxH,
itemCount: logic.dataSource.length,
itemBuilder: (BuildContext context, int index) => logic.instanceChild(index),
itemBuilder: (BuildContext context, int index) =>
logic.instanceChild(index),
);
}
}
@@ -1,6 +1,6 @@
import 'package:get/get.dart';
import 'package:hgmj/hj_utils/api_service/ai_service.dart';
import 'package:hgmj/tools_base/base_list_controller.dart';
import 'package:wydj/hj_utils/api_service/ai_service.dart';
import 'package:wydj/tools_base/base_list_controller.dart';
import '../ai_mod_detail_page.dart';
import '../ai_home_logic.dart';
@@ -15,7 +15,8 @@ class AiSquareLogic extends ListBaseLogic<AISquareItemModel> {
}
//isRefresh=true 下拉刷新 / false 上拉加载更多
void loadData({bool isRefresh = true}) => fetchData(isRefresh: isRefresh, fetch: _fetch);
void loadData({bool isRefresh = true}) =>
fetchData(isRefresh: isRefresh, fetch: _fetch);
Future<(List<AISquareItemModel>?, bool)> _fetch(int page) async {
final resp = await AIService.getPlazaList(page);
@@ -44,7 +45,8 @@ class AiSquareLogic extends ListBaseLogic<AISquareItemModel> {
Get.to(() => AIModDetailPage(mod));
return;
}
final isImageFace = AiTypeCode.fromServerCode(model.type) == AiType.imageChangeFace;
final isImageFace =
AiTypeCode.fromServerCode(model.type) == AiType.imageChangeFace;
Get.find<AiHomeLogic>().jumpSubModule(isImageFace ? 5 : 4);
}
}
+3 -3
View File
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/loading/loading_center_widget.dart';
import 'package:hgmj/tools_base/refresh/pull_refresh.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/loading/loading_center_widget.dart';
import 'package:wydj/tools_base/refresh/pull_refresh.dart';
import '../widgets/ai_square_cell.dart';
import 'ai_square_logic.dart';
@@ -1,14 +1,14 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/config/config.dart';
import 'package:hgmj/hj_page/pre_sale/pre_sale_provider.dart';
import 'package:hgmj/hj_utils/api_service/ai_service.dart';
import 'package:hgmj/tools_base/file_upload/file_upload_tool.dart';
import 'package:hgmj/tools_base/global_store/store.dart';
import 'package:hgmj/tools_base/loading/loading_alert_widget.dart';
import 'package:hgmj/tools_base/toast.dart';
import 'package:hgmj/tools_base/widget/common_alert.dart';
import 'package:wydj/config/config.dart';
import 'package:wydj/hj_page/pre_sale/pre_sale_provider.dart';
import 'package:wydj/hj_utils/api_service/ai_service.dart';
import 'package:wydj/tools_base/file_upload/file_upload_tool.dart';
import 'package:wydj/tools_base/global_store/store.dart';
import 'package:wydj/tools_base/loading/loading_alert_widget.dart';
import 'package:wydj/tools_base/toast.dart';
import 'package:wydj/tools_base/widget/common_alert.dart';
import '../../../alert/mine/vip_level_dialog.dart';
import '../../../routers/jump_router.dart';
@@ -68,7 +68,8 @@ abstract class AiFunctionBaseLogic extends GetxController {
//免费次数或金币够不够本次消费
bool canPay(int price) {
final freeCount = (globalStore.wallet?.todayAiFreeTimes ?? 0) + (presaleProvider.remain?.todayAiUndressCount ?? 0);
final freeCount = (globalStore.wallet?.todayAiFreeTimes ?? 0) +
(presaleProvider.remain?.todayAiUndressCount ?? 0);
if ((globalStore.wallet?.amount ?? 0) < price && freeCount <= 0) {
showVipLevelDialog("当前免费次数不足或金币余额不足", buttonTitle: '去充值', vipEvent: () {
Get.back();
@@ -142,13 +143,19 @@ class AiStripLogic extends AiFunctionBaseLogic {
Future<void> submit() async {
if (!checkPic()) return;
//预售期有免费次数先走免费,否则查金币
if (presaleProvider.isOpen && presaleProvider.hasLimit && (presaleProvider.remain?.todayAiUndressCount ?? 0) > 0) {
presaleProvider.remain?.todayAiUndressCount = (presaleProvider.remain?.todayAiUndressCount ?? 0) - 1;
if (presaleProvider.isOpen &&
presaleProvider.hasLimit &&
(presaleProvider.remain?.todayAiUndressCount ?? 0) > 0) {
presaleProvider.remain?.todayAiUndressCount =
(presaleProvider.remain?.todayAiUndressCount ?? 0) - 1;
} else {
if (!canPay(int.tryParse(Config.aiUndressPrice) ?? 0)) return;
}
//传副本:提交成功回调里会清空 localPicList
await upload([...localPicList], (urls) => AIService.generateUndress(urls, shareToAiSquare, editingCtr.text));
await upload(
[...localPicList],
(urls) =>
AIService.generateUndress(urls, shareToAiSquare, editingCtr.text));
}
}
@@ -171,16 +178,22 @@ class AiFaceDetailLogic extends AiFunctionBaseLogic {
Future<void> submit() async {
if (!checkPic()) return;
//预售期图片换脸有免费次数先走免费,否则查金币
if (presaleProvider.isOpen && presaleProvider.hasLimit && (presaleProvider.remain?.todayAiUndressCount ?? 0) > 0 && !isChangeVideo) {
presaleProvider.remain?.todayAiUndressCount = (presaleProvider.remain?.todayAiUndressCount ?? 0) - 1;
if (presaleProvider.isOpen &&
presaleProvider.hasLimit &&
(presaleProvider.remain?.todayAiUndressCount ?? 0) > 0 &&
!isChangeVideo) {
presaleProvider.remain?.todayAiUndressCount =
(presaleProvider.remain?.todayAiUndressCount ?? 0) - 1;
} else {
if (!canPay(price)) return;
}
await upload(
localPicList,
(urls) => isChangeVideo
? AIService.generateChangeFace(urls, mod.id, coupon?.id, shareToAiSquare, editingCtr.text) //视频换脸
: AIService.generateImg(urls.firstOrNull ?? '', mod.id ?? '', shareToAiSquare, editingCtr.text), //图片换脸
? AIService.generateChangeFace(
urls, mod.id, coupon?.id, shareToAiSquare, editingCtr.text) //视频换脸
: AIService.generateImg(urls.firstOrNull ?? '', mod.id ?? '',
shareToAiSquare, editingCtr.text), //图片换脸
onDone: () => coupon = null,
);
}
@@ -1,13 +1,13 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/config/config.dart';
import 'package:hgmj/hj_page/pre_sale/pre_sale_provider.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/routers/jump_router.dart';
import 'package:hgmj/tools_base/banner/ads_banner.dart';
import 'package:hgmj/tools_base/global_store/store.dart';
import 'package:hgmj/tools_base/loading/loading_center_widget.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/config/config.dart';
import 'package:wydj/hj_page/pre_sale/pre_sale_provider.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/routers/jump_router.dart';
import 'package:wydj/tools_base/banner/ads_banner.dart';
import 'package:wydj/tools_base/global_store/store.dart';
import 'package:wydj/tools_base/loading/loading_center_widget.dart';
import 'package:provider/provider.dart';
import '../widgets/pic_picker.dart';
+18 -7
View File
@@ -1,4 +1,4 @@
import 'package:hgmj/hj_utils/text_util.dart';
import 'package:wydj/hj_utils/text_util.dart';
import '../../../hj_model/splash/ads_model.dart';
import 'ai_change_face_video_model.dart';
@@ -18,9 +18,15 @@ class AiModList {
AiModList.fromJson(dynamic json) {
json ??= {};
aiUndressMod = (json['aiUndressMod'] as List?)?.map((e) => AdsInfoModel.fromJson(e)).toList();
aiImgToVideoMod = (json['aiImgToVideoMod'] as List?)?.map((e) => AdsInfoModel.fromJson(e)).toList();
aiTextToImgMod = (json['aiTextToImgMod'] as List?)?.map((e) => AiChangeFaceVideoMod.fromJson(e)).toList();
aiUndressMod = (json['aiUndressMod'] as List?)
?.map((e) => AdsInfoModel.fromJson(e))
.toList();
aiImgToVideoMod = (json['aiImgToVideoMod'] as List?)
?.map((e) => AdsInfoModel.fromJson(e))
.toList();
aiTextToImgMod = (json['aiTextToImgMod'] as List?)
?.map((e) => AiChangeFaceVideoMod.fromJson(e))
.toList();
}
}
@@ -33,8 +39,12 @@ class AiChangeModList {
AiChangeModList.fromJson(dynamic json) {
json ??= {};
categoryId = json['categoryId'];
categoryList = (json['categoryList'] as List?)?.map((e) => AICategoryMod.fromJson(e)).toList();
templateList = (json['templateList'] as List?)?.map((e) => TemplateModel.fromJson(e)).toList();
categoryList = (json['categoryList'] as List?)
?.map((e) => AICategoryMod.fromJson(e))
.toList();
templateList = (json['templateList'] as List?)
?.map((e) => TemplateModel.fromJson(e))
.toList();
}
}
@@ -77,7 +87,8 @@ class TemplateModel {
int? vipCoin;
/// 上架时间戳,模版列表按它排序;时间解析不了按 0 排最前
int get timestamp => DateTime.tryParse(createdAt ?? '')?.millisecondsSinceEpoch ?? 0;
int get timestamp =>
DateTime.tryParse(createdAt ?? '')?.millisecondsSinceEpoch ?? 0;
TemplateModel.fromJson(dynamic json) {
json ??= {};
+3 -2
View File
@@ -7,7 +7,7 @@ cover换脸后封面大图
url换脸后视频地址
*/
import 'package:hgmj/hj_utils/text_util.dart';
import 'package:wydj/hj_utils/text_util.dart';
import '../../../config/address.dart';
@@ -41,7 +41,8 @@ class AiRecordModel {
String? locationScene; //地点场景
/// 换脸结果视频地址。query 用 cdn= 而不是 VideoModel 的 c=,两边接口不同,别顺手统一
String get realVideoUrl => "${Address.baseApiPath}/vid/h5/m3u8/$url?token=${Address.token}&cdn=${Address.cdnAddress}";
String get realVideoUrl =>
"${Address.baseApiPath}/vid/h5/m3u8/$url?token=${Address.token}&cdn=${Address.cdnAddress}";
AiRecordModel.fromJson(dynamic json) {
json ??= {};
+19 -12
View File
@@ -1,13 +1,13 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/hj_utils/api_service/mine_service.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/loading/loading_center_widget.dart';
import 'package:hgmj/tools_base/refresh/pull_refresh.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/hj_utils/api_service/mine_service.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/loading/loading_center_widget.dart';
import 'package:wydj/tools_base/refresh/pull_refresh.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:hgmj/tools_base/widget/sheet_handle_bar.dart';
import 'package:wydj/tools_base/widget/sheet_handle_bar.dart';
import '../../../hj_utils/widget_util.dart';
import '../../mine/mine_vip/coupon_model.dart';
@@ -42,7 +42,9 @@ class _AICouponSheetState extends State<AICouponSheet> {
dataList ??= []; //首屏失败也要退出 loading,否则永远转圈
setState(() {});
if (page == 1) refreshCtr?.refreshCompleted();
(res?.length ?? 0) < size ? refreshCtr?.loadNoData() : refreshCtr?.loadComplete();
(res?.length ?? 0) < size
? refreshCtr?.loadNoData()
: refreshCtr?.loadComplete();
}
Future<void> loadMore() => loadData(page: curPage + 1);
@@ -59,7 +61,9 @@ class _AICouponSheetState extends State<AICouponSheet> {
children: [
const SheetHandleBar(),
18.sizeBoxH,
Text('使用抵扣券', style: textStyle(18, Colors.white.withValues(alpha: .9), FontWeight.w600)),
Text('使用抵扣券',
style: textStyle(
18, Colors.white.withValues(alpha: .9), FontWeight.w600)),
18.sizeBoxH,
Expanded(child: _list()),
],
@@ -92,12 +96,14 @@ class _AICouponSheetState extends State<AICouponSheet> {
alignment: Alignment.center,
height: 68,
decoration: BoxDecoration(
image: DecorationImage(image: AssetImage('ai_coupon_bg.webp'.aiPath), fit: BoxFit.fill),
image: DecorationImage(
image: AssetImage('ai_coupon_bg.webp'.aiPath), fit: BoxFit.fill),
),
child: Row(
children: [
18.sizeBoxW,
Text('${model.goodsName}', style: textStyle(18, couponText, FontWeight.w600)),
Text('${model.goodsName}',
style: textStyle(18, couponText, FontWeight.w600)),
12.sizeBoxW,
Expanded(
child: Text(
@@ -116,7 +122,8 @@ class _AICouponSheetState extends State<AICouponSheet> {
color: const Color(0xffFFDCB3),
borderRadius: BorderRadius.circular(22),
),
child: Text('立即使用', style: textStyle(12, Color(0xFF7F0000), FontWeight.w400)),
child: Text('立即使用',
style: textStyle(12, Color(0xFF7F0000), FontWeight.w400)),
),
18.sizeBoxW,
],
+38 -16
View File
@@ -1,11 +1,11 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/hj_utils/api_service/ai_service.dart';
import 'package:hgmj/routers/jump_router.dart';
import 'package:hgmj/tools_base/debug_log.dart';
import 'package:hgmj/tools_base/loading/loading_alert_widget.dart';
import 'package:hgmj/tools_base/toast.dart';
import 'package:hgmj/tools_base/widget/sheet_handle_bar.dart';
import 'package:wydj/hj_utils/api_service/ai_service.dart';
import 'package:wydj/routers/jump_router.dart';
import 'package:wydj/tools_base/debug_log.dart';
import 'package:wydj/tools_base/loading/loading_alert_widget.dart';
import 'package:wydj/tools_base/toast.dart';
import 'package:wydj/tools_base/widget/sheet_handle_bar.dart';
import '../../../hj_utils/widget_util.dart';
import '../models/ai_girl_resp_model.dart';
@@ -26,7 +26,8 @@ class _AIGirlSheetState extends State<AIGirlSheet> {
List<AIGirlFriendCurrency> get _items => widget.list ?? [];
//列表可能为空,取不到就没得选
AIGirlFriendCurrency? get _selected => selectIndex < _items.length ? _items[selectIndex] : null;
AIGirlFriendCurrency? get _selected =>
selectIndex < _items.length ? _items[selectIndex] : null;
@override
Widget build(BuildContext context) {
@@ -44,9 +45,12 @@ class _AIGirlSheetState extends State<AIGirlSheet> {
const SheetHandleBar(color: Color(0x1AFFFFFF)),
Padding(
padding: const EdgeInsets.only(top: 18, bottom: 12),
child: Text('AI女友', style: textStyle(20, Colors.white, FontWeight.w600)),
child: Text('AI女友',
style: textStyle(20, Colors.white, FontWeight.w600)),
),
Text('充值积分', style: textStyle(14, Colors.white.withValues(alpha: .8), FontWeight.w400)),
Text('充值积分',
style: textStyle(
14, Colors.white.withValues(alpha: .8), FontWeight.w400)),
GridView.builder(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 18),
shrinkWrap: true,
@@ -65,11 +69,13 @@ class _AIGirlSheetState extends State<AIGirlSheet> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('支付小贴士:', style: textStyle(14, Colors.white, FontWeight.w500)),
Text('支付小贴士:',
style: textStyle(14, Colors.white, FontWeight.w500)),
const SizedBox(height: 6),
Text(
'1.因超时支付无法到账,请重新发起。\n2.连续发起且未支付,账号可能被加入黑名单\n3.充值成功后会在1~5分钟内到账,可重新刷新进入当前页面',
style: textStyle(12, Colors.white.withValues(alpha: .6), FontWeight.w400),
style: textStyle(12, Colors.white.withValues(alpha: .6),
FontWeight.w400),
),
],
),
@@ -83,7 +89,12 @@ class _AIGirlSheetState extends State<AIGirlSheet> {
alignment: Alignment.center,
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [Color(0xff1E3C72), Color(0xff5F40B6), Color(0xff1E3C72), Color(0xff2A5298)],
colors: [
Color(0xff1E3C72),
Color(0xff5F40B6),
Color(0xff1E3C72),
Color(0xff2A5298)
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
@@ -109,10 +120,14 @@ class _AIGirlSheetState extends State<AIGirlSheet> {
onTap: () => setState(() => selectIndex = index),
child: Container(
decoration: BoxDecoration(
color: isSelected ? const Color(0xff4039A1) : Colors.white.withValues(alpha: .05),
color: isSelected
? const Color(0xff4039A1)
: Colors.white.withValues(alpha: .05),
borderRadius: BorderRadius.circular(6),
border: Border.all(
color: isSelected ? const Color(0xff30509C) : Colors.white.withValues(alpha: .1),
color: isSelected
? const Color(0xff30509C)
: Colors.white.withValues(alpha: .1),
),
),
child: Column(
@@ -120,14 +135,21 @@ class _AIGirlSheetState extends State<AIGirlSheet> {
children: [
Text(
'${item.coins ?? 0}积分',
style: textStyle(16, isSelected ? const Color(0xffAFABFF) : const Color(0xff7D95D5), FontWeight.w400),
style: textStyle(
16,
isSelected
? const Color(0xffAFABFF)
: const Color(0xff7D95D5),
FontWeight.w400),
),
const SizedBox(height: 4),
Text(
'${(item.price ?? 0).truncate()}金币',
style: textStyle(
12,
isSelected ? const Color(0x4DF3F5FF) : Colors.white.withValues(alpha: .3),
isSelected
? const Color(0x4DF3F5FF)
: Colors.white.withValues(alpha: .3),
FontWeight.w400,
),
),
+21 -12
View File
@@ -1,12 +1,12 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:hgmj/hj_model/video_model.dart';
import 'package:hgmj/hj_utils/const.dart';
import 'package:hgmj/tools_base/toast.dart';
import 'package:hgmj/tools_base/video_download/video_cache_store.dart';
import 'package:hgmj/tools_base/video_download/video_download_manager.dart';
import 'package:hgmj/tools_base/widget/image_browser_page.dart';
import 'package:wydj/hj_model/video_model.dart';
import 'package:wydj/hj_utils/const.dart';
import 'package:wydj/tools_base/toast.dart';
import 'package:wydj/tools_base/video_download/video_cache_store.dart';
import 'package:wydj/tools_base/video_download/video_download_manager.dart';
import 'package:wydj/tools_base/widget/image_browser_page.dart';
import '../../video/simple_video_player_page.dart';
import '../ai_sub_type/ai_function_logic.dart';
@@ -39,7 +39,8 @@ class AIImageRecord extends StatelessWidget {
final AiType aiType;
final VoidCallback? onDeleteCallback;
const AIImageRecord(this.model, {super.key, this.aiType = AiType.autoStrip, this.onDeleteCallback});
const AIImageRecord(this.model,
{super.key, this.aiType = AiType.autoStrip, this.onDeleteCallback});
bool get isVideoFace => aiType.isVideoFace;
@@ -110,7 +111,8 @@ class AIImageRecord extends StatelessWidget {
String get _resultCover {
if (_state == AIRecordState.success) {
//视频换脸有的成功订单后端不回 cover,退回素材封面,别让结果位空着露占位图
if (isVideoFace) return model.cover?.isNotEmpty == true ? model.cover! : _sourceCover;
if (isVideoFace)
return model.cover?.isNotEmpty == true ? model.cover! : _sourceCover;
return model.newPic?.firstOrNull ?? '';
}
if (isVideoFace) return model.picture?.firstOrNull ?? '';
@@ -124,14 +126,17 @@ class AIImageRecord extends StatelessWidget {
ImageBrowserPage.open([images.first], showSaveButton: true);
return;
}
final isCached = await VideoCacheStore.instance.isExistLoadVideoByUrl(MediaStyle.Video, model.url ?? '');
final isCached = await VideoCacheStore.instance
.isExistLoadVideoByUrl(MediaStyle.Video, model.url ?? '');
if (isCached) {
showToast('你已经添加过缓存了');
return;
}
/// VideoDownloadManager下载到了 应用的外部私有目录中,无需动态权限
/// if (!await _checkPermission()) return;
final result = await VideoDownloadManager.instance.download(url: model.url ?? '');
final result =
await VideoDownloadManager.instance.download(url: model.url ?? '');
if (result != null) return;
final viewModel = VideoModel()
..sourceURL = model.url
@@ -147,7 +152,8 @@ class AIImageRecord extends StatelessWidget {
//视频换脸的结果位单独接播放器,链接由 VideoModel 拼(和 AiRecordModel.realVideoUrl 的 query 不一样)
void _playResultVideo() {
final videoModel = VideoModel()..sourceURL = model.url;
Get.to(SimpleVideoPlayerPage(videoUrl: videoModel.realVideoUrl, title: 'AI生成视频'));
Get.to(SimpleVideoPlayerPage(
videoUrl: videoModel.realVideoUrl, title: 'AI生成视频'));
}
//三张图:模版 + 素材 = 结果
@@ -164,7 +170,10 @@ class AIImageRecord extends StatelessWidget {
),
const AIRecordJoin(gap: 3.5),
],
AIRecordThumb(imageUrl: _sourceCover, badge: const AISourceBadge(isTemplate: false), width: 90.w),
AIRecordThumb(
imageUrl: _sourceCover,
badge: const AISourceBadge(isTemplate: false),
width: 90.w),
const AIRecordJoin(isEquals: true, gap: 3.5),
AIResultThumb(
imageUrl: _resultCover,
+11 -5
View File
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/tools_base/widget/net_image_widget.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/tools_base/widget/net_image_widget.dart';
import '../models/ai_change_face_video_model.dart';
@@ -10,7 +10,8 @@ class AIModCell extends StatelessWidget {
final bool isSelected;
final VoidCallback? onTap;
const AIModCell({super.key, required this.mod, this.isSelected = false, this.onTap});
const AIModCell(
{super.key, required this.mod, this.isSelected = false, this.onTap});
@override
Widget build(BuildContext context) {
@@ -28,7 +29,9 @@ class AIModCell extends StatelessWidget {
right: 8,
top: 8,
child: Image.asset(
isSelected ? 'radio_select.png'.commonImgPath : 'ai_draw_unselected.png'.aiPath,
isSelected
? 'radio_select.png'.commonImgPath
: 'ai_draw_unselected.png'.aiPath,
width: 20,
),
),
@@ -38,7 +41,10 @@ class AIModCell extends StatelessWidget {
const Spacer(),
Text(
mod.title ?? '',
style: TextStyle(color: Colors.white.withValues(alpha: .8), fontSize: 14, fontWeight: FontWeight.w500),
style: TextStyle(
color: Colors.white.withValues(alpha: .8),
fontSize: 14,
fontWeight: FontWeight.w500),
),
],
),
+13 -6
View File
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:hgmj/tools_base/toast.dart';
import 'package:hgmj/tools_base/widget/image_browser_page.dart';
import 'package:wydj/tools_base/toast.dart';
import 'package:wydj/tools_base/widget/image_browser_page.dart';
import '../models/ai_record_model.dart';
import 'ai_record_parts.dart';
@@ -11,7 +11,8 @@ class AIPaintRecord extends StatelessWidget {
final int status; // 1 排队 2 成功 3 失败
final VoidCallback? onDeleteCallback;
const AIPaintRecord(this.model, {super.key, required this.status, this.onDeleteCallback});
const AIPaintRecord(this.model,
{super.key, required this.status, this.onDeleteCallback});
AIRecordState get _state => switch (status) {
2 => AIRecordState.success,
@@ -22,10 +23,13 @@ class AIPaintRecord extends StatelessWidget {
/// 排队/失败没有结果图,退回模版封面占位。
/// 后端在这个接口里放模版封面的字段不固定(styleUrl 常为空),挨个兜一遍,别露占位图
String get _templateCover =>
[model.styleUrl, model.cover, model.modCover, model.modPic].firstWhere((e) => e?.isNotEmpty == true, orElse: () => '') ?? '';
[model.styleUrl, model.cover, model.modCover, model.modPic]
.firstWhere((e) => e?.isNotEmpty == true, orElse: () => '') ??
'';
//只有成功才是真结果图;未知 status 按排队处理,与 _state 的口径保持一致
String get _resultCover => status == 2 ? (model.newImgUrl ?? '') : _templateCover;
String get _resultCover =>
status == 2 ? (model.newImgUrl ?? '') : _templateCover;
@override
Widget build(BuildContext context) {
@@ -71,7 +75,10 @@ class AIPaintRecord extends StatelessWidget {
AIResultThumb(
imageUrl: _resultCover,
state: _state,
onTap: _resultCover.isEmpty ? null : () => ImageBrowserPage.open([_resultCover], showSaveButton: true),
onTap: _resultCover.isEmpty
? null
: () =>
ImageBrowserPage.open([_resultCover], showSaveButton: true),
),
],
),
+51 -19
View File
@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/hj_utils/date_time_util.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/widget/common_alert.dart';
import 'package:hgmj/tools_base/widget/net_image_widget.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/hj_utils/date_time_util.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/widget/common_alert.dart';
import 'package:wydj/tools_base/widget/net_image_widget.dart';
import '../../../hj_utils/widget_util.dart';
@@ -13,7 +13,8 @@ import '../../../hj_utils/widget_util.dart';
enum AIRecordState { queuing, success, failed }
/// 失败原因:接口没给就退回通用文案。底部文案和失败弹窗共用,改一处即可
String _failedText(String? remark) => remark?.isNotEmpty == true ? remark! : '生成失败';
String _failedText(String? remark) =>
remark?.isNotEmpty == true ? remark! : '生成失败';
/// 记录卡:白 5% 底 + 12 圆角,版式固定为
/// 创建时间/删除 → 内容 → 细线 → 状态胶囊/下载或失败原因。
@@ -60,7 +61,11 @@ class AIRecordCard extends StatelessWidget {
12.sizeBoxH,
0.5.line,
12.sizeBoxH,
AIRecordFooter(state: state, remark: remark, onDownload: onDownload, onStatusTap: onStatusTap),
AIRecordFooter(
state: state,
remark: remark,
onDownload: onDownload,
onStatusTap: onStatusTap),
],
),
);
@@ -68,7 +73,8 @@ class AIRecordCard extends StatelessWidget {
//失败原因底部只放得下两行,点卡片看全文。四类记录都走这里,别再各自实现
return GestureDetector(
behavior: HitTestBehavior.opaque, //卡片内的空白也要能点
onTap: () => CommonAlert.show(title: '失败原因', content: _failedText(remark), showCancel: false),
onTap: () => CommonAlert.show(
title: '失败原因', content: _failedText(remark), showCancel: false),
child: card,
);
}
@@ -108,7 +114,12 @@ class AIRecordFooter extends StatelessWidget {
final VoidCallback? onDownload;
final VoidCallback? onStatusTap;
const AIRecordFooter({super.key, required this.state, this.remark, this.onDownload, this.onStatusTap});
const AIRecordFooter(
{super.key,
required this.state,
this.remark,
this.onDownload,
this.onStatusTap});
@override
Widget build(BuildContext context) {
@@ -117,7 +128,8 @@ class AIRecordFooter extends StatelessWidget {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
AIStatusPill(state, onTap: state == AIRecordState.success ? onStatusTap : null),
AIStatusPill(state,
onTap: state == AIRecordState.success ? onStatusTap : null),
if (state == AIRecordState.success && onDownload != null)
AIDownloadBtn(onTap: onDownload)
else if (state == AIRecordState.failed)
@@ -154,13 +166,18 @@ class AIStatusPill extends StatelessWidget {
onTap: onTap,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
decoration:
isFailed ? null : BoxDecoration(color: const Color(0x1AFFDB9E), borderRadius: BorderRadius.circular(3)),
decoration: isFailed
? null
: BoxDecoration(
color: const Color(0x1AFFDB9E),
borderRadius: BorderRadius.circular(3)),
child: Text(
text,
style: textStyle(
13,
isFailed ? Colors.white.withValues(alpha: .55) : const Color(0xffFFDB9E),
isFailed
? Colors.white.withValues(alpha: .55)
: const Color(0xffFFDB9E),
FontWeight.w400,
),
),
@@ -183,14 +200,16 @@ class AIDownloadBtn extends StatelessWidget {
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 4),
decoration: BoxDecoration(
border: Border.all(width: 0.5, color: Colors.white.withValues(alpha: .15)),
border: Border.all(
width: 0.5, color: Colors.white.withValues(alpha: .15)),
borderRadius: BorderRadius.circular(6),
),
child: Row(
children: [
Image.asset('icon_ai_download.png'.aiPath, width: 18),
2.5.sizeBoxW,
const Text('一键下载', style: TextStyle(color: Colors.white, fontSize: 12)),
const Text('一键下载',
style: TextStyle(color: Colors.white, fontSize: 12)),
],
),
),
@@ -206,7 +225,8 @@ class AIRecordThumb extends StatelessWidget {
final VoidCallback? onTap;
final double width;
const AIRecordThumb({super.key, this.imageUrl, this.badge, this.onTap, this.width = 90});
const AIRecordThumb(
{super.key, this.imageUrl, this.badge, this.onTap, this.width = 90});
@override
Widget build(BuildContext context) {
@@ -222,7 +242,11 @@ class AIRecordThumb extends StatelessWidget {
color: Color(0xff262626),
borderRadius: BorderRadius.all(Radius.circular(8)),
),
child: NetworkImageLoader(imageUrl: imageUrl, width: width, height: 90, borderRadius: 8),
child: NetworkImageLoader(
imageUrl: imageUrl,
width: width,
height: 90,
borderRadius: 8),
),
if (badge != null) badge!,
],
@@ -239,7 +263,12 @@ class AIResultThumb extends StatelessWidget {
final VoidCallback? onTap;
final double width;
const AIResultThumb({super.key, this.imageUrl, required this.state, this.onTap, this.width = 90});
const AIResultThumb(
{super.key,
this.imageUrl,
required this.state,
this.onTap,
this.width = 90});
@override
Widget build(BuildContext context) {
@@ -260,7 +289,10 @@ class AIResultThumb extends StatelessWidget {
),
),
if (state == AIRecordState.failed)
Positioned.fill(child: Center(child: Image.asset('ai_record_failed.webp'.aiPath, width: 20))),
Positioned.fill(
child: Center(
child:
Image.asset('ai_record_failed.webp'.aiPath, width: 20))),
],
);
}
+39 -20
View File
@@ -1,15 +1,15 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/hj_page/video/simple_video_player_page.dart';
import 'package:hgmj/hj_utils/date_time_util.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/widget/header_widget.dart';
import 'package:hgmj/tools_base/widget/net_image_widget.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/hj_page/video/simple_video_player_page.dart';
import 'package:wydj/hj_utils/date_time_util.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/widget/header_widget.dart';
import 'package:wydj/tools_base/widget/net_image_widget.dart';
import '../../../hj_utils/widget_util.dart';
import 'package:hgmj/tools_base/widget/image_browser_page.dart';
import 'package:wydj/tools_base/widget/image_browser_page.dart';
import '../ai_sub_type/ai_function_logic.dart';
import '../models/ai_square_model.dart';
@@ -39,7 +39,9 @@ class AISquareCell extends StatelessWidget {
Widget _imgView() {
return switch (AiTypeCode.fromServerCode(model.type)) {
AiType.imageChangeFace || AiType.autoStrip => _twoImgsView(model.originalImage, model.generateImage),
AiType.imageChangeFace ||
AiType.autoStrip =>
_twoImgsView(model.originalImage, model.generateImage),
AiType.videoChangeFace => _videoChangeFace(),
AiType.imageToVideo => _imgToVideo(),
AiType.aiPaint => _aiDraw(),
@@ -53,20 +55,24 @@ class AISquareCell extends StatelessWidget {
Expanded(
child: InkWell(
enableFeedback: false,
onTap: () => ImageBrowserPage.open([left ?? ''], showSaveButton: true),
onTap: () =>
ImageBrowserPage.open([left ?? ''], showSaveButton: true),
child: NetworkImageLoader(
imageUrl: left,
imgBorderRadius: const BorderRadius.horizontal(left: Radius.circular(9)),
imgBorderRadius:
const BorderRadius.horizontal(left: Radius.circular(9)),
),
),
),
Expanded(
child: InkWell(
enableFeedback: false,
onTap: () => ImageBrowserPage.open([right ?? ''], showSaveButton: true),
onTap: () =>
ImageBrowserPage.open([right ?? ''], showSaveButton: true),
child: NetworkImageLoader(
imageUrl: right,
imgBorderRadius: const BorderRadius.horizontal(right: Radius.circular(9)),
imgBorderRadius:
const BorderRadius.horizontal(right: Radius.circular(9)),
),
),
),
@@ -80,7 +86,10 @@ class AISquareCell extends StatelessWidget {
children: [
Text(
'“${model.originContent ?? ''}”',
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Color(0xff03FCEB)),
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
color: Color(0xff03FCEB)),
),
12.sizeBoxH,
Row(
@@ -88,7 +97,8 @@ class AISquareCell extends StatelessWidget {
Expanded(
child: InkWell(
enableFeedback: false,
onTap: () => ImageBrowserPage.open([model.generateImage ?? ''], showSaveButton: true),
onTap: () => ImageBrowserPage.open([model.generateImage ?? ''],
showSaveButton: true),
child: NetworkImageLoader(imageUrl: model.generateImage),
),
),
@@ -113,7 +123,9 @@ class AISquareCell extends StatelessWidget {
Widget _videoChangeFace() {
return Row(
children: [
Expanded(child: _videoItem(model.generateVideoCover, model.realGenerateVideoUrl)),
Expanded(
child: _videoItem(
model.generateVideoCover, model.realGenerateVideoUrl)),
10.sizeBoxW,
const Expanded(child: SizedBox.shrink()),
],
@@ -141,7 +153,10 @@ class AISquareCell extends StatelessWidget {
style: textStyle(10, Colors.white, FontWeight.w500),
),
)),
TextSpan(text: model.title, style: textStyle(14, Colors.white.withValues(alpha: .9), FontWeight.w500))
TextSpan(
text: model.title,
style: textStyle(
14, Colors.white.withValues(alpha: .9), FontWeight.w500))
]));
}
@@ -175,7 +190,8 @@ class AISquareCell extends StatelessWidget {
10.sizeBoxW,
Text(
DateTimeUtil.utcTurnYear(model.reviewAt),
style: textStyle(12, Colors.white.withValues(alpha: 0.55), FontWeight.w400),
style: textStyle(12, Colors.white.withValues(alpha: 0.55),
FontWeight.w400),
)
],
)
@@ -189,7 +205,9 @@ class AISquareCell extends StatelessWidget {
width: 70,
height: 24,
alignment: Alignment.center,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(3), color: AppColors.actionRed),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
color: AppColors.actionRed),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@@ -218,7 +236,8 @@ class AISquareCell extends StatelessWidget {
Widget _videoItem(String? img, String url) {
return InkWell(
enableFeedback: false,
onTap: () => Get.to(() => SimpleVideoPlayerPage(videoUrl: url, title: model.title ?? '')),
onTap: () => Get.to(
() => SimpleVideoPlayerPage(videoUrl: url, title: model.title ?? '')),
child: Stack(
alignment: Alignment.center,
children: [
+13 -7
View File
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/tools_base/toast.dart';
import 'package:hgmj/tools_base/widget/image_browser_page.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/tools_base/toast.dart';
import 'package:wydj/tools_base/widget/image_browser_page.dart';
import '../models/ai_record_model.dart';
import 'ai_record_parts.dart';
@@ -12,7 +12,8 @@ class AIVideoRecord extends StatelessWidget {
final int status; // 1 排队 2 成功 3 失败
final VoidCallback? onDeleteCallback;
const AIVideoRecord(this.model, {super.key, required this.status, this.onDeleteCallback});
const AIVideoRecord(this.model,
{super.key, required this.status, this.onDeleteCallback});
AIRecordState get _state => switch (status) {
2 => AIRecordState.success,
@@ -20,7 +21,8 @@ class AIVideoRecord extends StatelessWidget {
_ => AIRecordState.queuing,
};
String get _resultCover => model.status == 3 ? (model.newImgUrl ?? '') : (model.imgUrl ?? '');
String get _resultCover =>
model.status == 3 ? (model.newImgUrl ?? '') : (model.imgUrl ?? '');
@override
Widget build(BuildContext context) {
@@ -51,13 +53,17 @@ class AIVideoRecord extends StatelessWidget {
children: [
AIRecordThumb(
imageUrl: model.imgUrl,
badge: Image.asset('ai_record_org.png'.aiPath, width: 36, height: 18),
badge:
Image.asset('ai_record_org.png'.aiPath, width: 36, height: 18),
),
const AIRecordJoin(isEquals: true),
AIResultThumb(
imageUrl: _resultCover,
state: _state,
onTap: _resultCover.isEmpty ? null : () => ImageBrowserPage.open([_resultCover], showSaveButton: true),
onTap: _resultCover.isEmpty
? null
: () =>
ImageBrowserPage.open([_resultCover], showSaveButton: true),
),
],
),
+10 -7
View File
@@ -2,10 +2,10 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:image_pickers/image_pickers.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/tools_base/toast.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/tools_base/toast.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:mobkit_dashed_border/mobkit_dashed_border.dart';
/// AI 功能的单图选择器:未选时是虚线占位框,选后是缩略图 + 右上角删除
@@ -54,7 +54,8 @@ class _PicPickerState extends State<PicPicker> {
selectCount: 1,
showCamera: true,
);
final paths = medias.map((e) => e.path ?? "").where((e) => e.isNotEmpty).toList();
final paths =
medias.map((e) => e.path ?? "").where((e) => e.isNotEmpty).toList();
if (paths.length < medias.length) showToast("添加图片失败");
return paths;
}
@@ -92,7 +93,8 @@ class _PicPickerState extends State<PicPicker> {
onTap: _delPic,
child: Padding(
padding: const EdgeInsets.all(6),
child: Image.asset("close_grey.png".commonImgPath, width: 14, height: 14),
child: Image.asset("close_grey.png".commonImgPath,
width: 14, height: 14),
),
),
),
@@ -120,7 +122,8 @@ class _PicPickerState extends State<PicPicker> {
children: [
Image.asset('add_grey.png'.communityPath, width: 24),
10.sizeBoxH,
const Text("添加图片", style: TextStyle(fontSize: 12, color: Color(0xff999999))),
const Text("添加图片",
style: TextStyle(fontSize: 12, color: Color(0xff999999))),
],
),
),
+19 -9
View File
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/routers/jump_router.dart';
import 'package:hgmj/tools_base/widget/net_image_widget.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/routers/jump_router.dart';
import 'package:wydj/tools_base/widget/net_image_widget.dart';
import '../../config/config.dart';
import '../../hj_model/cartoon_media_info.dart';
@@ -83,7 +83,10 @@ class AcgItemWidget extends StatelessWidget {
child: Text(
'${info?.episodeNumberStatus ?? ''} · ${info?.updateDesc}',
textAlign: TextAlign.left,
style: TextStyle(fontSize: 11, color: _statusColor, fontWeight: FontWeight.w400),
style: TextStyle(
fontSize: 11,
color: _statusColor,
fontWeight: FontWeight.w400),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
@@ -96,8 +99,12 @@ class AcgItemWidget extends StatelessWidget {
}
Widget _buildLevelIcon() {
if (info?.permission == 1 && Config.coinMark) return _levelTag('金币', const Color(0xFF1F2029), bgColor: [const Color(0xFFFFE580), const Color(0xFFFACC15)]);
if (info?.permission == 0 && Config.vipMark) return _levelTag('VIP', Colors.white, bgColor: [ const Color(0xFFFF8000), const Color(0xFFFF7A01)]);
if (info?.permission == 1 && Config.coinMark)
return _levelTag('金币', const Color(0xFF1F2029),
bgColor: [const Color(0xFFFFE580), const Color(0xFFFACC15)]);
if (info?.permission == 0 && Config.vipMark)
return _levelTag('VIP', Colors.white,
bgColor: [const Color(0xFFFF8000), const Color(0xFFFF7A01)]);
return const SizedBox.shrink();
}
@@ -107,7 +114,8 @@ class AcgItemWidget extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 6),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(2)),
gradient: LinearGradient(colors: bgColor ?? [Color(0xffFFC000), Color(0xffFFC000)]),
gradient: LinearGradient(
colors: bgColor ?? [Color(0xffFFC000), Color(0xffFFC000)]),
),
child: Text(
text,
@@ -117,6 +125,8 @@ class AcgItemWidget extends StatelessWidget {
}
Color get _statusColor {
return info?.updateStatus == 1 ? const Color(0xffFFC000) : Colors.white.withValues(alpha: .45);
return info?.updateStatus == 1
? const Color(0xffFFC000)
: Colors.white.withValues(alpha: .45);
}
}
@@ -1,15 +1,15 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/hj_model/acg/comic_chapters_model.dart';
import 'package:hgmj/hj_page/live/live_widget.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/hj_model/acg/comic_chapters_model.dart';
import 'package:wydj/hj_page/live/live_widget.dart';
import 'package:wydj/hj_utils/screen.dart';
import '../../assets_tool/app_colors.dart';
import '../../hj_utils/widget_util.dart';
import 'widget/free_badge.dart';
import 'package:hgmj/tools_base/widget/stagger_in_item.dart';
import 'package:hgmj/tools_base/widget/sheet_handle_bar.dart';
import 'package:wydj/tools_base/widget/stagger_in_item.dart';
import 'package:wydj/tools_base/widget/sheet_handle_bar.dart';
//有声小说 选择子集
class AudioPlayerBottomSheet extends StatefulWidget {
@@ -62,7 +62,8 @@ class _AudioPlayerBottomSheetState extends State<AudioPlayerBottomSheet> {
),
),
Spacer(),
InkWell(enableFeedback: false,
InkWell(
enableFeedback: false,
onTap: () => setState(() => sortType = sortType == 1 ? 0 : 1),
child: Row(
children: [
@@ -70,12 +71,14 @@ class _AudioPlayerBottomSheetState extends State<AudioPlayerBottomSheet> {
turns: sortType == 1 ? 0 : 0.5,
duration: const Duration(milliseconds: 250),
curve: Curves.easeOutCubic,
child: Image.asset('text_play_sort.png'.acgImgPath, width: 18),
child: Image.asset('text_play_sort.png'.acgImgPath,
width: 18),
),
4.sizeBoxW,
Text(
sortType == 1 ? '正序' : '倒序',
style: textStyle(12, Colors.white.withValues(alpha: .45), FontWeight.w400),
style: textStyle(12, Colors.white.withValues(alpha: .45),
FontWeight.w400),
),
],
),
@@ -96,52 +99,57 @@ class _AudioPlayerBottomSheetState extends State<AudioPlayerBottomSheet> {
final model = widget.allAudiobooks[realIndex];
final select = widget.currentPlayIndex == realIndex;
return StaggerInItem(
index: index,
child: InkWell(enableFeedback: false,
onTap: () {
Get.back(result: realIndex);
widget.indexHandler?.call(realIndex);
},
child: Container(
padding: const EdgeInsets.only(bottom: 6),
child: Column(
children: [
16.sizeBoxH,
Row(
index: index,
child: InkWell(
enableFeedback: false,
onTap: () {
Get.back(result: realIndex);
widget.indexHandler?.call(realIndex);
},
child: Container(
padding: const EdgeInsets.only(bottom: 6),
child: Column(
children: [
if (select) ...[
AudioWaveView(),
8.sizeBoxW,
],
Expanded(
child: Text(
//与详情/抽屉子集 title 格式一致:第X章
'第${model.episodeNumber ?? 1}${widget.unit ?? ''}',
style: TextStyle(
color: select ? AppColors.actionRed : Colors.white.withValues(alpha: .9),
fontSize: 14,
16.sizeBoxH,
Row(
children: [
if (select) ...[
AudioWaveView(),
8.sizeBoxW,
],
Expanded(
child: Text(
//与详情/抽屉子集 title 格式一致:第X章
'第${model.episodeNumber ?? 1}${widget.unit ?? ''}',
style: TextStyle(
color: select
? AppColors.actionRed
: Colors.white
.withValues(alpha: .9),
fontSize: 14,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
//无任何权限时,前 N 集免费展示「免费」角标
if (widget.hasPermission == false &&
model.inFreeEpisode) ...[
8.sizeBoxW,
const FreeBadge(),
],
8.sizeBoxW,
const Icon(
Icons.navigate_next,
size: 18,
color: Color(0xffDCDCDC),
)
],
),
//无任何权限时,前 N 集免费展示「免费」角标
if (widget.hasPermission == false && model.inFreeEpisode) ...[
8.sizeBoxW,
const FreeBadge(),
],
8.sizeBoxW,
const Icon(
Icons.navigate_next,
size: 18,
color: Color(0xffDCDCDC),
)
16.sizeBoxH,
],
),
16.sizeBoxH,
],
)),
));
)),
));
},
),
)
+46 -21
View File
@@ -2,11 +2,11 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/hj_utils/date_time_util.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/widget/net_image_widget.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/hj_utils/date_time_util.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/widget/net_image_widget.dart';
import 'audio_player_bottomsheet.dart';
import 'widget/acg_source_manager.dart';
@@ -16,7 +16,8 @@ class AudioPlayerContent extends StatefulWidget {
final int index;
final AudioPlayerManager manager;
final ACGSourceManager sourceManager;
const AudioPlayerContent(this.sourceManager, {super.key, required this.manager, this.index = 0});
const AudioPlayerContent(this.sourceManager,
{super.key, required this.manager, this.index = 0});
@override
State<AudioPlayerContent> createState() => _AudioPlayerContentState();
@@ -33,7 +34,8 @@ class _AudioPlayerContentState extends State<AudioPlayerContent> {
// - onInit 已 initPlayer
// - onClose 已 dispose
// 此处不要再调 initPlayer,否则 4 个 stream listener 重复注册导致旧 sub 泄漏
manager.play(widget.sourceManager.allEpisodes[widget.index].getRealAudioUrl);
manager
.play(widget.sourceManager.allEpisodes[widget.index].getRealAudioUrl);
}
@override
@@ -60,7 +62,10 @@ class _AudioPlayerContentState extends State<AudioPlayerContent> {
children: [
Text(
'正在播放:第${(audioValue.onPlayIndex ?? 0) + 1}集',
style: TextStyle(color: Colors.white, fontSize: 16.sp, fontWeight: FontWeight.w500),
style: TextStyle(
color: Colors.white,
fontSize: 16.sp,
fontWeight: FontWeight.w500),
),
],
),
@@ -76,7 +81,8 @@ class _AudioPlayerContentState extends State<AudioPlayerContent> {
}
// 进度条行:左右 ±10s 快进退、中间滑块、两侧时间
Widget _progressRow(AudioPlayerValue audioValue, double progress, double max) {
Widget _progressRow(
AudioPlayerValue audioValue, double progress, double max) {
return Row(
children: [
Column(
@@ -96,7 +102,10 @@ class _AudioPlayerContentState extends State<AudioPlayerContent> {
buildMMSS(audioValue.position?.inSeconds ?? 0),
maxLines: 1,
softWrap: false,
style: TextStyle(color: Colors.white.withValues(alpha: .9), fontSize: 12, fontWeight: FontWeight.w500),
style: TextStyle(
color: Colors.white.withValues(alpha: .9),
fontSize: 12,
fontWeight: FontWeight.w500),
),
),
],
@@ -115,7 +124,8 @@ class _AudioPlayerContentState extends State<AudioPlayerContent> {
InkWell(
enableFeedback: false,
onTap: () => manager.seekTenMinsWithDirection(1),
child: Image.asset('noval_time_forword.png'.acgImgPath, width: 24),
child:
Image.asset('noval_time_forword.png'.acgImgPath, width: 24),
),
8.sizeBoxH,
SizedBox(
@@ -158,9 +168,12 @@ class _AudioPlayerContentState extends State<AudioPlayerContent> {
children: [
AnimatedSwitcher(
duration: const Duration(milliseconds: 150),
transitionBuilder: (child, anim) => ScaleTransition(scale: anim, child: child),
transitionBuilder: (child, anim) =>
ScaleTransition(scale: anim, child: child),
child: Image.asset(
isLoop ? 'single_cycle.png'.acgImgPath : 'list_cycle.png'.acgImgPath,
isLoop
? 'single_cycle.png'.acgImgPath
: 'list_cycle.png'.acgImgPath,
// key 必须按状态区分,AnimatedSwitcher 才会把它当成新 child 触发动画
key: ValueKey(isLoop ? 'loop' : 'loop_list'),
width: 24,
@@ -169,7 +182,10 @@ class _AudioPlayerContentState extends State<AudioPlayerContent> {
2.sizeBoxH,
Text(
isLoop ? '单曲循环' : '多集循环',
style: TextStyle(color: Colors.white.withValues(alpha: .9), fontSize: 12, fontWeight: FontWeight.w400),
style: TextStyle(
color: Colors.white.withValues(alpha: .9),
fontSize: 12,
fontWeight: FontWeight.w400),
),
],
),
@@ -188,7 +204,8 @@ class _AudioPlayerContentState extends State<AudioPlayerContent> {
onTap: () => isPlaying ? manager.pause() : manager.resume(),
child: AnimatedSwitcher(
duration: const Duration(milliseconds: 150),
transitionBuilder: (child, anim) => ScaleTransition(scale: anim, child: child),
transitionBuilder: (child, anim) =>
ScaleTransition(scale: anim, child: child),
child: Image.asset(
isPlaying ? 'pause.png'.acgImgPath : 'play.png'.acgImgPath,
key: ValueKey(isPlaying ? 'pause' : 'play'),
@@ -214,7 +231,10 @@ class _AudioPlayerContentState extends State<AudioPlayerContent> {
2.sizeBoxH,
Text(
'播放列表',
style: TextStyle(color: Colors.white.withValues(alpha: .9), fontSize: 12, fontWeight: FontWeight.w400),
style: TextStyle(
color: Colors.white.withValues(alpha: .9),
fontSize: 12,
fontWeight: FontWeight.w400),
),
],
),
@@ -278,7 +298,8 @@ class GradientTrackShape extends SliderTrackShape {
}) {
final trackHeight = sliderTheme.trackHeight ?? 2;
final trackTop = offset.dy + (parentBox.size.height - trackHeight) / 2;
return Rect.fromLTWH(offset.dx, trackTop, parentBox.size.width, trackHeight);
return Rect.fromLTWH(
offset.dx, trackTop, parentBox.size.width, trackHeight);
}
@override
@@ -303,12 +324,14 @@ class GradientTrackShape extends SliderTrackShape {
final inactivePaint = Paint()..color = const Color(0xff3D3D3D);
// 左侧已播放
context.canvas.drawRect(
Rect.fromLTRB(trackRect.left, trackRect.top, thumbCenter.dx, trackRect.bottom),
Rect.fromLTRB(
trackRect.left, trackRect.top, thumbCenter.dx, trackRect.bottom),
activePaint,
);
// 右侧未播放
context.canvas.drawRect(
Rect.fromLTRB(thumbCenter.dx, trackRect.top, trackRect.right, trackRect.bottom),
Rect.fromLTRB(
thumbCenter.dx, trackRect.top, trackRect.right, trackRect.bottom),
inactivePaint,
);
}
@@ -321,7 +344,8 @@ class GradientThumbShape extends SliderComponentShape {
const GradientThumbShape({this.radius = 8});
@override
Size getPreferredSize(bool isEnabled, bool isDiscrete) => Size.fromRadius(radius);
Size getPreferredSize(bool isEnabled, bool isDiscrete) =>
Size.fromRadius(radius);
@override
void paint(
@@ -339,7 +363,8 @@ class GradientThumbShape extends SliderComponentShape {
required double value,
}) {
final canvas = context.canvas;
final outerPaint = Paint()..color = AppColors.actionRed.withValues(alpha: 0.7);
final outerPaint = Paint()
..color = AppColors.actionRed.withValues(alpha: 0.7);
final innerPaint = Paint()..color = Colors.white;
canvas.drawCircle(center, radius, outerPaint);
canvas.drawCircle(center, radius - 3, innerPaint);
@@ -2,9 +2,9 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/hj_utils/const.dart';
import 'package:hgmj/tools_base/event_bus/events.dart';
import 'package:hgmj/tools_base/widget/scroll_positioned_list/src/scrollable_positioned_list.dart';
import 'package:wydj/hj_utils/const.dart';
import 'package:wydj/tools_base/event_bus/events.dart';
import 'package:wydj/tools_base/widget/scroll_positioned_list/src/scrollable_positioned_list.dart';
import '../../../hj_model/acg/comic_chapters_model.dart';
import '../../../hj_model/cartoon_media_info.dart';
@@ -15,7 +15,8 @@ import 'cartoon_read_page.dart';
import 'widget/acg_source_manager.dart';
import 'widget/cartoon_subset_alert.dart';
class CartoonDetailLogic extends GetxController with GetTickerProviderStateMixin {
class CartoonDetailLogic extends GetxController
with GetTickerProviderStateMixin {
String? id;
CartoonMediaInfo? mediaInfo;
@@ -39,7 +40,8 @@ class CartoonDetailLogic extends GetxController with GetTickerProviderStateMixin
late ACGSourceManager manager;
late StreamSubscription subscription;
CartoonDetailLogic({this.id}) : manager = ACGSourceManager(id ?? ''); //初始化,加载子集
CartoonDetailLogic({this.id})
: manager = ACGSourceManager(id ?? ''); //初始化,加载子集
@override
void onReady() async {
@@ -88,7 +90,8 @@ class CartoonDetailLogic extends GetxController with GetTickerProviderStateMixin
play() async {
//判断权限
ComicChapterInfo? info = await manager.getEpisodeHasPermisson(manager.index);
ComicChapterInfo? info =
await manager.getEpisodeHasPermisson(manager.index);
if (info == null) return;
Get.to(() => CartoonReadPage(manager: manager..index = manager.index));
}
+69 -36
View File
@@ -3,15 +3,15 @@ import 'dart:math';
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/extension/extensions.dart';
import 'package:hgmj/tools_base/indicator/custom_tab_indicator.dart';
import 'package:hgmj/tools_base/toast.dart';
import 'package:hgmj/tools_base/unique_tag_mixin.dart';
import 'package:hgmj/tools_base/widget/follow_button.dart';
import 'package:hgmj/tools_base/widget/keep_alive_widget.dart';
import 'package:hgmj/tools_base/widget/net_image_widget.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/extension/extensions.dart';
import 'package:wydj/tools_base/indicator/custom_tab_indicator.dart';
import 'package:wydj/tools_base/toast.dart';
import 'package:wydj/tools_base/unique_tag_mixin.dart';
import 'package:wydj/tools_base/widget/follow_button.dart';
import 'package:wydj/tools_base/widget/keep_alive_widget.dart';
import 'package:wydj/tools_base/widget/net_image_widget.dart';
import 'package:provider/provider.dart';
import '../../../hj_utils/const.dart';
@@ -38,7 +38,8 @@ class CartoonDetailPage extends StatefulWidget {
}
// 详情页可经「推荐页 → 再开详情页」成环并存,用 UniqueTagMixin 给每个实例唯一 tag
class _CartoonDetailPageState extends State<CartoonDetailPage> with UniqueTagMixin {
class _CartoonDetailPageState extends State<CartoonDetailPage>
with UniqueTagMixin {
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -65,7 +66,8 @@ class _CartoonDetailPageState extends State<CartoonDetailPage> with UniqueTagMix
}
// 当前内容对应的推荐类型(小说等无对应 tab 时为 null)
MediaStyle? _selfStyle(CartoonDetailLogic logic) => switch (logic.mediaInfo?.mediaType) {
MediaStyle? _selfStyle(CartoonDetailLogic logic) =>
switch (logic.mediaInfo?.mediaType) {
'video' => MediaStyle.Cartoon,
'image' => MediaStyle.Comics,
_ => null,
@@ -111,7 +113,8 @@ class _CartoonDetailPageState extends State<CartoonDetailPage> with UniqueTagMix
return [
SliverToBoxAdapter(child: _buildImgHeader(logic)), //header
SliverToBoxAdapter(child: _buildMenu(logic)), //目录
SliverToBoxAdapter(child: _buildTabbar(logic, styles)) //推荐 tabbar
SliverToBoxAdapter(
child: _buildTabbar(logic, styles)) //推荐 tabbar
];
},
//推荐
@@ -137,8 +140,10 @@ class _CartoonDetailPageState extends State<CartoonDetailPage> with UniqueTagMix
if (logic.isCartoonType) ...[
Consumer<ACGSourceManager>(
builder: (context, manager, child) {
bool liked = manager.mediaInfo?.mediaStatus?.hasLiked == true;
return InkWell(enableFeedback: false,
bool liked =
manager.mediaInfo?.mediaStatus?.hasLiked == true;
return InkWell(
enableFeedback: false,
onTap: () => manager.onLikeAction(),
child: Container(
width: 108,
@@ -152,13 +157,16 @@ class _CartoonDetailPageState extends State<CartoonDetailPage> with UniqueTagMix
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
liked ? 'acg_like_sel.png'.acgImgPath : 'acg_like_nor.png'.acgImgPath,
liked
? 'acg_like_sel.png'.acgImgPath
: 'acg_like_nor.png'.acgImgPath,
width: 16,
),
10.sizeBoxW,
Text(
'喜欢',
style: textStyle(16, Color(0xff989898), FontWeight.w500),
style: textStyle(
16, Color(0xff989898), FontWeight.w500),
),
],
)),
@@ -168,7 +176,8 @@ class _CartoonDetailPageState extends State<CartoonDetailPage> with UniqueTagMix
12.sizeBoxW,
],
Expanded(
child: InkWell(enableFeedback: false,
child: InkWell(
enableFeedback: false,
onTap: () => logic.play(),
child: Container(
decoration: BoxDecoration(
@@ -268,12 +277,14 @@ class _CartoonDetailPageState extends State<CartoonDetailPage> with UniqueTagMix
if (logic.mediaInfo?.permission == 0) ...[
Text(
'VIP',
style: textStyle(12, Color(0xff989898), FontWeight.w400),
style:
textStyle(12, Color(0xff989898), FontWeight.w400),
),
] else if (logic.mediaInfo?.permission == 1) ...[
Text(
'${logic.mediaInfo?.price ?? 0}金币',
style: textStyle(12, Color(0xff989898), FontWeight.w400),
style:
textStyle(12, Color(0xff989898), FontWeight.w400),
),
],
],
@@ -300,7 +311,8 @@ class _CartoonDetailPageState extends State<CartoonDetailPage> with UniqueTagMix
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
TagsBean? tag = logic.mediaInfo?.tagDetails?[index];
return InkWell(enableFeedback: false,
return InkWell(
enableFeedback: false,
onTap: () {
Get.to(CartoonTagPage(
title: tag?.name ?? '',
@@ -310,8 +322,9 @@ class _CartoonDetailPageState extends State<CartoonDetailPage> with UniqueTagMix
child: Container(
padding: EdgeInsets.symmetric(horizontal: 8),
alignment: Alignment.center,
decoration:
BoxDecoration(color: Colors.white.withValues(alpha: .05), borderRadius: BorderRadius.circular(3)),
decoration: BoxDecoration(
color: Colors.white.withValues(alpha: .05),
borderRadius: BorderRadius.circular(3)),
height: 26,
child: Text(
tag?.name ?? '',
@@ -375,7 +388,8 @@ class _CartoonDetailPageState extends State<CartoonDetailPage> with UniqueTagMix
labelStyle: TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
labelColor: Colors.white.withValues(alpha: 0.9),
unselectedLabelColor: Colors.white.withValues(alpha: .55),
unselectedLabelStyle: TextStyle(fontSize: 14, fontWeight: FontWeight.w400),
unselectedLabelStyle:
TextStyle(fontSize: 14, fontWeight: FontWeight.w400),
indicator: CustomIndicator(
isGradient: true,
width: 13,
@@ -397,7 +411,9 @@ class _CartoonDetailPageState extends State<CartoonDetailPage> with UniqueTagMix
Row(
children: [
Text(
logic.isCartoonType ? '选集' : '共${logic.mediaInfo?.totalEpisode ?? 0}${logic.mediaInfo?.unit}',
logic.isCartoonType
? '选集'
: '共${logic.mediaInfo?.totalEpisode ?? 0}${logic.mediaInfo?.unit}',
style: TextStyle(
color: Colors.white,
fontSize: 18,
@@ -407,10 +423,13 @@ class _CartoonDetailPageState extends State<CartoonDetailPage> with UniqueTagMix
Spacer(),
Row(
children: [
InkWell(enableFeedback: false,
InkWell(
enableFeedback: false,
onTap: logic.onMenuAction,
child: Text(
logic.isCartoonType ? '全${logic.mediaInfo?.totalEpisode ?? 0}${logic.mediaInfo?.unit}' : '目录',
logic.isCartoonType
? '全${logic.mediaInfo?.totalEpisode ?? 0}${logic.mediaInfo?.unit}'
: '目录',
style: TextStyle(
color: Color(0xFFA7A7A7),
fontSize: 14,
@@ -437,10 +456,12 @@ class _CartoonDetailPageState extends State<CartoonDetailPage> with UniqueTagMix
shrinkWrap: true,
itemBuilder: (context, index) {
final epm = provider.allEpisodes[index];
return InkWell(enableFeedback: false,
return InkWell(
enableFeedback: false,
onTap: () => logic.changeEpisode(index, false),
child: Container(
padding: EdgeInsets.symmetric(vertical: logic.isCartoonType ? 6 : 12),
padding: EdgeInsets.symmetric(
vertical: logic.isCartoonType ? 6 : 12),
child: Row(
children: [
Flexible(
@@ -450,13 +471,18 @@ class _CartoonDetailPageState extends State<CartoonDetailPage> with UniqueTagMix
overflow: TextOverflow.ellipsis,
style: textStyle(
16,
provider.index == index ? Colors.white.withValues(alpha: .9) : Colors.white.withValues(alpha: .45),
provider.index == index ? FontWeight.w500 : FontWeight.w400,
provider.index == index
? Colors.white.withValues(alpha: .9)
: Colors.white.withValues(alpha: .45),
provider.index == index
? FontWeight.w500
: FontWeight.w400,
),
),
),
//无任何权限时,前 N 集免费展示「免费」角标
if (provider.mediaInfo?.hasPermission == false && epm.inFreeEpisode) ...[
if (provider.mediaInfo?.hasPermission == false &&
epm.inFreeEpisode) ...[
8.sizeBoxW,
const FreeBadge(),
],
@@ -478,7 +504,8 @@ class _CartoonDetailPageState extends State<CartoonDetailPage> with UniqueTagMix
}
Widget _buildBackView() {
return InkWell(enableFeedback: false,
return InkWell(
enableFeedback: false,
child: Image.asset(
'back_circle_grey.png'.commonImgPath,
width: 24,
@@ -488,7 +515,8 @@ class _CartoonDetailPageState extends State<CartoonDetailPage> with UniqueTagMix
}
Widget _buildShareView(CartoonDetailLogic logic) {
return InkWell(enableFeedback: false,
return InkWell(
enableFeedback: false,
onTap: () {
Get.dialog(
ShareMediaDialog(
@@ -510,20 +538,25 @@ class _CartoonDetailPageState extends State<CartoonDetailPage> with UniqueTagMix
return Offstage(
offstage: logic.showHeader,
child: Container(
padding: EdgeInsets.only(left: 16, right: 16, top: screen.paddingTop),
padding:
EdgeInsets.only(left: 16, right: 16, top: screen.paddingTop),
height: 44 + screen.paddingTop,
color: Color(0xff05000E),
child: Row(
children: [
GestureDetector(
onTap: () => Get.back(),
child: Icon(Icons.arrow_back_ios, size: 24, color: Colors.white),
child:
Icon(Icons.arrow_back_ios, size: 24, color: Colors.white),
),
8.sizeBoxW,
Expanded(
child: Text(
logic.mediaInfo?.title ?? '',
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white),
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.white),
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
),
+10 -7
View File
@@ -2,10 +2,10 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/hj_model/media_content.dart';
import 'package:hgmj/tools_base/toast.dart';
import 'package:hgmj/tools_base/widget/scroll_positioned_list/src/item_positions_listener.dart';
import 'package:hgmj/tools_base/widget/scroll_positioned_list/src/scrollable_positioned_list.dart';
import 'package:wydj/hj_model/media_content.dart';
import 'package:wydj/tools_base/toast.dart';
import 'package:wydj/tools_base/widget/scroll_positioned_list/src/item_positions_listener.dart';
import 'package:wydj/tools_base/widget/scroll_positioned_list/src/scrollable_positioned_list.dart';
import 'widget/acg_source_manager.dart';
@@ -156,9 +156,11 @@ class CartoonReadLogic extends GetxController {
/// [isFirstLoad] 失败时才进错误页
Future<void> _openEpisode(int index, {bool isFirstLoad = false}) async {
// 首次进入页面已有全屏 loading,不再叠遮罩
final model = await manager.getComicsMediaContent(index: index, showLoading: !isFirstLoad);
final model = await manager.getComicsMediaContent(
index: index, showLoading: !isFirstLoad);
if (model == null) {
if (isFirstLoad) detailInfo = MediaContent(); // 空 model → id 为 null → 页面走错误态
if (isFirstLoad)
detailInfo = MediaContent(); // 空 model → id 为 null → 页面走错误态
update();
return;
}
@@ -196,7 +198,8 @@ class CartoonReadLogic extends GetxController {
void _startTimer() {
_timer?.cancel(); // 防重入:先停旧的再建新的,避免重复开启时旧定时器泄漏
_timer = Timer.periodic(const Duration(milliseconds: 500), (_) {
scrollOffsetCtr.animateScroll(offset: 50, duration: const Duration(milliseconds: 500));
scrollOffsetCtr.animateScroll(
offset: 50, duration: const Duration(milliseconds: 500));
});
}
+79 -40
View File
@@ -3,23 +3,23 @@ import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/hj_model/video_model.dart';
import 'package:hgmj/hj_page/comment/comment_alert.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/loading/loading_center_widget.dart';
import 'package:hgmj/tools_base/toast.dart';
import 'package:hgmj/tools_base/widget/follow_button.dart';
import 'package:hgmj/tools_base/widget/net_image_widget.dart';
import 'package:hgmj/tools_base/widget/scroll_positioned_list/src/scrollable_positioned_list.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/hj_model/video_model.dart';
import 'package:wydj/hj_page/comment/comment_alert.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/loading/loading_center_widget.dart';
import 'package:wydj/tools_base/toast.dart';
import 'package:wydj/tools_base/widget/follow_button.dart';
import 'package:wydj/tools_base/widget/net_image_widget.dart';
import 'package:wydj/tools_base/widget/scroll_positioned_list/src/scrollable_positioned_list.dart';
import 'package:provider/provider.dart';
import '../../alert/video/share_media_dialog.dart';
import '../../hj_utils/widget_util.dart';
import 'cartoon_read_logic.dart';
import 'widget/acg_source_manager.dart';
import 'package:hgmj/tools_base/widget/stagger_in_item.dart';
import 'package:wydj/tools_base/widget/stagger_in_item.dart';
// 漫画阅读页面
class CartoonReadPage extends StatelessWidget {
@@ -42,11 +42,13 @@ class CartoonReadPage extends StatelessWidget {
Widget _buildBody(BuildContext context, CartoonReadLogic logic) {
if (logic.detailInfo == null) return const LoadingCenterWidget();
if (logic.detailInfo?.id == null) return CErrorWidget(retryOnTap: logic.loadData);
if (logic.detailInfo?.id == null)
return CErrorWidget(retryOnTap: logic.loadData);
return Stack(
alignment: Alignment.center,
children: [
InkWell(enableFeedback: false,
InkWell(
enableFeedback: false,
onTap: logic.changeShowMenu,
child: ScrollablePositionedList.builder(
scrollAction: logic.onScrollAction,
@@ -85,21 +87,27 @@ class CartoonReadPage extends StatelessWidget {
padding: EdgeInsets.fromLTRB(10, screen.paddingTop + 8, 10, 8),
child: Row(
children: [
InkWell(enableFeedback: false,
InkWell(
enableFeedback: false,
onTap: () => Get.back(),
child: const Icon(Icons.arrow_back_ios_new, size: 24, color: Colors.white),
child: const Icon(Icons.arrow_back_ios_new,
size: 24, color: Colors.white),
),
10.sizeBoxW,
Expanded(
child: Text(
logic.detailInfo?.name ?? '',
style: TextStyle(fontSize: 18.sp, color: Colors.white, fontWeight: FontWeight.w600),
style: TextStyle(
fontSize: 18.sp,
color: Colors.white,
fontWeight: FontWeight.w600),
),
),
21.sizeBoxW,
Consumer<ACGSourceManager>(
builder: (ctx, manager, _) {
final col = manager.mediaInfo?.mediaStatus?.hasCollected ?? false;
final col =
manager.mediaInfo?.mediaStatus?.hasCollected ?? false;
return FollowButton(
mediaId: manager.mediaInfo?.id ?? '',
isFollow: col,
@@ -112,7 +120,8 @@ class CartoonReadPage extends StatelessWidget {
},
),
12.sizeBoxW,
InkWell(enableFeedback: false,
InkWell(
enableFeedback: false,
onTap: () => Get.dialog(
ShareMediaDialog(
videoModel: VideoModel()
@@ -196,8 +205,10 @@ class CartoonReadPage extends StatelessWidget {
);
}
Widget _buildActionItem({String? title, String? icon, VoidCallback? action, Color? color}) {
return InkWell(enableFeedback: false,
Widget _buildActionItem(
{String? title, String? icon, VoidCallback? action, Color? color}) {
return InkWell(
enableFeedback: false,
onTap: action,
child: Column(
children: [
@@ -223,13 +234,15 @@ class CartoonReadPage extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: Row(
children: [
InkWell(enableFeedback: false,
InkWell(
enableFeedback: false,
onTap: () => logic.loadOtherEpisode(false),
child: Column(
children: [
Image.asset('common_back_new.png'.commonImgPath, width: 24),
4.sizeBoxH,
Text('上一篇', style: textStyle(12, Colors.white, FontWeight.w400)),
Text('上一篇',
style: textStyle(12, Colors.white, FontWeight.w400)),
],
),
),
@@ -238,9 +251,12 @@ class CartoonReadPage extends StatelessWidget {
child: SliderTheme(
data: SliderTheme.of(context).copyWith(
trackHeight: 4,
thumbShape: const RoundSliderThumbShape(enabledThumbRadius: 8.0),
overlayShape: const RoundSliderOverlayShape(overlayRadius: 12.0),
tickMarkShape: const RoundSliderTickMarkShape(tickMarkRadius: 10.0),
thumbShape:
const RoundSliderThumbShape(enabledThumbRadius: 8.0),
overlayShape:
const RoundSliderOverlayShape(overlayRadius: 12.0),
tickMarkShape:
const RoundSliderTickMarkShape(tickMarkRadius: 10.0),
trackShape: const RoundedRectSliderTrackShape(),
overlayColor: Colors.white.withValues(alpha: .3),
activeTrackColor: const Color(0xffFFD460),
@@ -261,16 +277,19 @@ class CartoonReadPage extends StatelessWidget {
),
),
13.sizeBoxW,
InkWell(enableFeedback: false,
InkWell(
enableFeedback: false,
onTap: () => logic.loadOtherEpisode(true),
child: Column(
children: [
Transform.rotate(
angle: pi,
child: Image.asset('common_back_new.png'.commonImgPath, width: 24),
child: Image.asset('common_back_new.png'.commonImgPath,
width: 24),
),
4.sizeBoxH,
Text('下一篇', style: textStyle(12, Colors.white, FontWeight.w400)),
Text('下一篇',
style: textStyle(12, Colors.white, FontWeight.w400)),
],
),
),
@@ -290,10 +309,12 @@ class CartoonReadPage extends StatelessWidget {
child: Consumer<ACGSourceManager>(
builder: (_, manager, __) {
final liked = manager.mediaInfo?.mediaStatus?.hasLiked == true;
return InkWell(enableFeedback: false,
return InkWell(
enableFeedback: false,
onTap: manager.onLikeAction,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
padding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
decoration: BoxDecoration(
color: Colors.black.withValues(alpha: .5),
borderRadius: const BorderRadius.only(
@@ -306,12 +327,15 @@ class CartoonReadPage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
liked ? 'acg_like_sel.png'.acgImgPath : 'acg_like_nor.png'.acgImgPath,
liked
? 'acg_like_sel.png'.acgImgPath
: 'acg_like_nor.png'.acgImgPath,
width: 24,
color: liked ? null : Colors.white,
),
5.sizeBoxW,
Text('喜欢', style: textStyle(12, Colors.white, FontWeight.w400)),
Text('喜欢',
style: textStyle(12, Colors.white, FontWeight.w400)),
],
),
),
@@ -344,7 +368,8 @@ class CartoonReadPage extends StatelessWidget {
color: Colors.white,
),
child: Center(
child: Image.asset('cartoon_auto_play.gif'.acgImgPath, width: 24),
child: Image.asset('cartoon_auto_play.gif'.acgImgPath,
width: 24),
),
),
),
@@ -390,9 +415,13 @@ class CartoonReadPage extends StatelessWidget {
children: [
Text(
'共${logic.manager.mediaInfo?.totalEpisode}话 ${logic.manager.mediaInfo?.getDetailUpdateString ?? ''}',
style: const TextStyle(fontSize: 14, color: Color(0xff141414), fontWeight: FontWeight.w400),
style: const TextStyle(
fontSize: 14,
color: Color(0xff141414),
fontWeight: FontWeight.w400),
),
InkWell(enableFeedback: false,
InkWell(
enableFeedback: false,
onTap: logic.toggleSort,
child: Row(
children: [
@@ -400,12 +429,18 @@ class CartoonReadPage extends StatelessWidget {
turns: logic.sortType ? 0 : 0.5,
duration: const Duration(milliseconds: 250),
curve: Curves.easeOutCubic,
child: Image.asset('text_play_sort.png'.acgImgPath, color: const Color(0xff141414), width: 16, height: 16),
child: Image.asset('text_play_sort.png'.acgImgPath,
color: const Color(0xff141414),
width: 16,
height: 16),
),
4.sizeBoxW,
Text(
logic.sortType ? '正序' : '倒序',
style: const TextStyle(fontSize: 14, color: Color(0xff141414), fontWeight: FontWeight.w400),
style: const TextStyle(
fontSize: 14,
color: Color(0xff141414),
fontWeight: FontWeight.w400),
),
],
),
@@ -422,13 +457,15 @@ class CartoonReadPage extends StatelessWidget {
// 不使用 list.reverse(items 不够会从底部排),采用数据倒序方法
final info = logic.sortType
? logic.manager.allEpisodes[index]
: logic.manager.allEpisodes[logic.manager.allEpisodes.length - index - 1];
: logic.manager.allEpisodes[
logic.manager.allEpisodes.length - index - 1];
return StaggerInItem(
index: index,
child: GestureDetector(
onTap: () {
Get.back();
if (logic.detailInfo?.id == info.id) return; //点的就是当前章,不重复加载
if (logic.detailInfo?.id == info.id)
return; //点的就是当前章,不重复加载
logic.loadDataWithIndex(info.id ?? '');
},
child: Container(
@@ -461,7 +498,9 @@ class CartoonReadPage extends StatelessWidget {
title,
style: TextStyle(
fontSize: 16.sp,
color: select ? AppColors.actionRed : Colors.white.withValues(alpha: 0.55),
color: select
? AppColors.actionRed
: Colors.white.withValues(alpha: 0.55),
fontWeight: select ? FontWeight.w500 : FontWeight.w400,
),
maxLines: 1,
@@ -1,7 +1,7 @@
//小说/视频推荐
import 'package:hgmj/hj_utils/api_service/acg_service.dart';
import 'package:hgmj/hj_utils/const.dart';
import 'package:hgmj/tools_base/base_list_controller.dart';
import 'package:wydj/hj_utils/api_service/acg_service.dart';
import 'package:wydj/hj_utils/const.dart';
import 'package:wydj/tools_base/base_list_controller.dart';
import '../../hj_utils/api_service/common_service.dart';
@@ -10,7 +10,8 @@ class CartoonRecommendLogic extends ListBaseLogic<dynamic> {
final MediaStyle mediaStyle; //推荐类型:Video(真人视频) / Cartoon(动漫) / Comics(漫画)
final String? videoTagId; //视频(SP)推荐的 tagId,按当前视频 tag 拉同类
CartoonRecommendLogic({this.mediaId, this.mediaStyle = MediaStyle.Comics, this.videoTagId});
CartoonRecommendLogic(
{this.mediaId, this.mediaStyle = MediaStyle.Comics, this.videoTagId});
@override
void onReady() {
@@ -30,10 +31,15 @@ class CartoonRecommendLogic extends ListBaseLogic<dynamic> {
//按类型分流:视频走 getRecommendList,漫画/动漫走 comicsRecommendList
Future<(List<dynamic>?, bool)> _fetch(int page) async {
if (mediaStyle == MediaStyle.Video) {
final resp = await CommonService.getRecommendList(pageNumber: page, pageSize: 12, tagId: videoTagId, newsType: mediaStyle.rankParam);
final resp = await CommonService.getRecommendList(
pageNumber: page,
pageSize: 12,
tagId: videoTagId,
newsType: mediaStyle.rankParam);
return (resp?.videos, resp?.hasNext == true);
}
final model = await ACGService.comicsRecommendList(page, 12, tagId: mediaId, mediaType: mediaStyle.rankParam);
final model = await ACGService.comicsRecommendList(page, 12,
tagId: mediaId, mediaType: mediaStyle.rankParam);
return (model?.list, model?.hasNext == true);
}
}
@@ -1,11 +1,11 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/hj_model/cartoon_media_info.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/refresh/pull_refresh.dart';
import 'package:hgmj/tools_base/unique_tag_mixin.dart';
import 'package:wydj/hj_model/cartoon_media_info.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/refresh/pull_refresh.dart';
import 'package:wydj/tools_base/unique_tag_mixin.dart';
import '../../hj_model/video_model.dart';
import '../home/home_cell_style/video_simple_cell.dart';
@@ -40,7 +40,8 @@ class CartoonRecommendPage extends StatefulWidget {
State<CartoonRecommendPage> createState() => _CartoonRecommendPageState();
}
class _CartoonRecommendPageState extends State<CartoonRecommendPage> with UniqueTagMixin {
class _CartoonRecommendPageState extends State<CartoonRecommendPage>
with UniqueTagMixin {
@override
Widget build(BuildContext context) {
return GetBuilder<CartoonRecommendLogic>(
@@ -52,7 +53,8 @@ class _CartoonRecommendPageState extends State<CartoonRecommendPage> with Unique
),
builder: (logic) {
if (logic.isLoading) return LoadingCenterWidget();
if (logic.isEmptyData) return CErrorWidget(retryOnTap: () => logic.loadData());
if (logic.isEmptyData)
return CErrorWidget(retryOnTap: () => logic.loadData());
final list = logic.dataList!;
return pullYsRefresh(
onInit: (ctr) => logic.refreshCtr = ctr,
@@ -68,7 +70,9 @@ class _CartoonRecommendPageState extends State<CartoonRecommendPage> with Unique
childAspectRatio: widget.childAspectRatio,
),
itemCount: list.length,
itemBuilder: (_, index) => widget.mediaStyle == MediaStyle.Video ? _videoCell(list[index]) : _acgCell(list[index]),
itemBuilder: (_, index) => widget.mediaStyle == MediaStyle.Video
? _videoCell(list[index])
: _acgCell(list[index]),
),
);
},
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:hgmj/hj_utils/const.dart';
import 'package:hgmj/tools_base/widget/keep_alive_widget.dart';
import 'package:wydj/hj_utils/const.dart';
import 'package:wydj/tools_base/widget/keep_alive_widget.dart';
import 'cartoon_sectionlist_sub_page.dart';
@@ -26,8 +26,10 @@ class CartoonSectionListPage extends StatefulWidget {
State<CartoonSectionListPage> createState() => _CartoonSectionListPageState();
}
class _CartoonSectionListPageState extends State<CartoonSectionListPage> with SingleTickerProviderStateMixin {
late final TabController tabCtr = TabController(length: _sortTabs.length, vsync: this);
class _CartoonSectionListPageState extends State<CartoonSectionListPage>
with SingleTickerProviderStateMixin {
late final TabController tabCtr =
TabController(length: _sortTabs.length, vsync: this);
@override
void dispose() {
@@ -73,7 +75,8 @@ class _CartoonSectionListPageState extends State<CartoonSectionListPage> with Si
decoration: BoxDecoration(
border: index != _sortTabs.length - 1
? Border(
right: BorderSide(width: .5, color: Colors.white.withValues(alpha: .1)),
right: BorderSide(
width: .5, color: Colors.white.withValues(alpha: .1)),
)
: null,
),
@@ -84,7 +87,8 @@ class _CartoonSectionListPageState extends State<CartoonSectionListPage> with Si
labelPadding: EdgeInsets.zero,
labelStyle: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
unselectedLabelColor: Colors.white.withValues(alpha: 0.5),
unselectedLabelStyle: const TextStyle(fontSize: 14, fontWeight: FontWeight.w400),
unselectedLabelStyle:
const TextStyle(fontSize: 14, fontWeight: FontWeight.w400),
indicator: const BoxDecoration(),
),
);
@@ -1,6 +1,6 @@
import 'package:hgmj/hj_model/cartoon_media_info.dart';
import 'package:hgmj/hj_utils/api_service/acg_service.dart';
import 'package:hgmj/tools_base/base_list_controller.dart';
import 'package:wydj/hj_model/cartoon_media_info.dart';
import 'package:wydj/hj_utils/api_service/acg_service.dart';
import 'package:wydj/tools_base/base_list_controller.dart';
class CartoonSectionSubLogic extends ListBaseLogic<CartoonMediaInfo> {
final int? sortType;
@@ -8,13 +8,13 @@ class CartoonSectionSubLogic extends ListBaseLogic<CartoonMediaInfo> {
CartoonSectionSubLogic({this.sortType, this.sectionID});
bool get isCartoon {
if(dataList?.isNotEmpty == true){
if (dataList?.isNotEmpty == true) {
return dataList!.first.mediaType == "video";
}
return false;
}
@override
void onReady() {
super.onReady();
@@ -25,7 +25,6 @@ class CartoonSectionSubLogic extends ListBaseLogic<CartoonMediaInfo> {
void loadMoreData() => fetchData(isRefresh: false, fetch: _fetch);
Future<(List<CartoonMediaInfo>?, bool)> _fetch(int page) async {
final resp = await ACGService.getPreferences(
page,
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/tools_base/loading/loading_center_widget.dart';
import 'package:hgmj/tools_base/refresh/pull_refresh.dart';
import 'package:wydj/tools_base/loading/loading_center_widget.dart';
import 'package:wydj/tools_base/refresh/pull_refresh.dart';
import 'acg_widget_item.dart';
import 'cartoon_sectionlist_sub_logic.dart';
@@ -35,14 +35,15 @@ class CartoonSectionSubPage extends StatelessWidget {
Widget _buildGrid(CartoonSectionSubLogic logic) {
return GridView.builder(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: logic.isCartoon ? 2 : 3,
mainAxisSpacing: 12,
crossAxisSpacing: 5,
childAspectRatio: logic.isCartoon ? 174 /138 : 111 / 190,
childAspectRatio: logic.isCartoon ? 174 / 138 : 111 / 190,
),
itemCount: logic.dataList?.length ?? 0,
itemBuilder: (context, index) => AcgItemWidget(info: logic.dataList?[index]),
itemBuilder: (context, index) =>
AcgItemWidget(info: logic.dataList?[index]),
);
}
}
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:hgmj/hj_model/home/plate_model.dart';
import 'package:hgmj/hj_utils/const.dart';
import 'package:hgmj/tools_base/widget/keep_alive_widget.dart';
import 'package:wydj/hj_model/home/plate_model.dart';
import 'package:wydj/hj_utils/const.dart';
import 'package:wydj/tools_base/widget/keep_alive_widget.dart';
import 'cartoon_sub_grid_page.dart';
@@ -21,6 +21,7 @@ class CartoonSubDetailPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return CartoonSubGridPage(tagData: tagData, type: type, scrollCtr: scroll).keepAlive;
return CartoonSubGridPage(tagData: tagData, type: type, scrollCtr: scroll)
.keepAlive;
}
}
+19 -10
View File
@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:hgmj/hj_model/home/plate_model.dart';
import 'package:hgmj/hj_model/home/module_detail_model.dart';
import 'package:hgmj/hj_utils/api_service/vid_service.dart';
import 'package:hgmj/hj_utils/const.dart';
import 'package:hgmj/tools_base/base_list_controller.dart';
import 'package:wydj/hj_model/home/plate_model.dart';
import 'package:wydj/hj_model/home/module_detail_model.dart';
import 'package:wydj/hj_utils/api_service/vid_service.dart';
import 'package:wydj/hj_utils/const.dart';
import 'package:wydj/tools_base/base_list_controller.dart';
class CartoonSubGridLogic extends ListBaseLogic {
final MediaStyle type; //-1:动漫和漫画 0:图集 1:黄游 2:小说
@@ -30,11 +30,13 @@ class CartoonSubGridLogic extends ListBaseLogic {
String get newsType {
if (tagData?.moduleName == '热门推荐' && tagData?.type == -100) return 'PIC';
if (tagData?.moduleName == '热门推荐' && tagData?.type == -101) return 'SEED_LINK';
if (tagData?.moduleName == '热门推荐' && tagData?.type == -101)
return 'SEED_LINK';
return '';
}
bool get isAcg => type == MediaStyle.Novel || type == MediaStyle.Cartoon; //是否是acg模块
bool get isAcg =>
type == MediaStyle.Novel || type == MediaStyle.Cartoon; //是否是acg模块
CartoonSubGridLogic({this.tagData, this.type = MediaStyle.Pic});
@@ -57,7 +59,11 @@ class CartoonSubGridLogic extends ListBaseLogic {
SortTab('最多收藏', 7),
];
} else if (type == MediaStyle.Pic || type == MediaStyle.Novel) {
sortTabs = const [SortTab('最多观看', 3), SortTab('最新发布', 1), SortTab('最多收藏', 7)];
sortTabs = const [
SortTab('最多观看', 3),
SortTab('最新发布', 1),
SortTab('最多收藏', 7)
];
} else {
sortTabs = const [SortTab('最新', 1), SortTab('最热', 2), SortTab('畅销', 8)];
}
@@ -74,7 +80,8 @@ class CartoonSubGridLogic extends ListBaseLogic {
loadData({int pageNum = 1}) async {
dataList ??= [];
ModuleDetailModel? retModel;
if (tagData?.moduleName == '热门推荐' && (tagData?.type == -100 || tagData?.type == -101)) {
if (tagData?.moduleName == '热门推荐' &&
(tagData?.type == -100 || tagData?.type == -101)) {
//图集
retModel = await VidService.communityRecommend(
pageNum,
@@ -111,7 +118,9 @@ class CartoonSubGridLogic extends ListBaseLogic {
}
update();
refreshCtr?.refreshCompleted();
retModel?.hasNext == true ? refreshCtr?.loadComplete() : refreshCtr?.loadNoData();
retModel?.hasNext == true
? refreshCtr?.loadComplete()
: refreshCtr?.loadNoData();
}
loadMoreData() => loadData(pageNum: currentPage + 1);
+18 -12
View File
@@ -1,12 +1,12 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/hj_model/home/plate_model.dart';
import 'package:hgmj/hj_utils/const.dart';
import 'package:hgmj/hj_utils/sliver_delegate.dart';
import 'package:hgmj/tools_base/banner/ads_grid_view.dart';
import 'package:hgmj/tools_base/loading/loading_center_widget.dart';
import 'package:hgmj/tools_base/refresh/pull_refresh.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/hj_model/home/plate_model.dart';
import 'package:wydj/hj_utils/const.dart';
import 'package:wydj/hj_utils/sliver_delegate.dart';
import 'package:wydj/tools_base/banner/ads_grid_view.dart';
import 'package:wydj/tools_base/loading/loading_center_widget.dart';
import 'package:wydj/tools_base/refresh/pull_refresh.dart';
import '../home/home_cell_style/quick_entry_row.dart';
import '../home/home_cell_style/video_simple_cell.dart';
@@ -89,7 +89,8 @@ class CartoonSubGridPage extends StatelessWidget {
controller: logic.tabCtr,
isScrollable: true,
//选中/未选中只差颜色,unselectedLabelStyle 不传会 fallback 到 labelStyle
labelStyle: const TextStyle(fontSize: 14, fontWeight: FontWeight.w400),
labelStyle:
const TextStyle(fontSize: 14, fontWeight: FontWeight.w400),
labelColor: Colors.white.withValues(alpha: .9),
unselectedLabelColor: Colors.white.withValues(alpha: .55),
indicator: const BoxDecoration(), //去掉默认下划线
@@ -110,11 +111,13 @@ class CartoonSubGridPage extends StatelessWidget {
final list = logic.dataList;
//null 是还没拉过,空 list 才是真没数据
if (list == null) {
return const SliverToBoxAdapter(child: SizedBox(height: 400, child: LoadingCenterWidget()));
return const SliverToBoxAdapter(
child: SizedBox(height: 400, child: LoadingCenterWidget()));
}
if (list.isEmpty) {
return SliverToBoxAdapter(
child: SizedBox(height: 400, child: CErrorWidget(retryOnTap: logic.loadData)),
child: SizedBox(
height: 400, child: CErrorWidget(retryOnTap: logic.loadData)),
);
}
return SliverPadding(
@@ -129,8 +132,11 @@ class CartoonSubGridPage extends StatelessWidget {
delegate: SliverChildBuilderDelegate(
//-1动漫/漫画 0-图集 1-黄游 2-小说
(_, index) => switch (type) {
MediaStyle.Cartoon || MediaStyle.Novel => AcgItemWidget(info: list[index], coverV: true),
MediaStyle.Pic => PhotoGalleryItem(videoModel: list[index], textline: 1),
MediaStyle.Cartoon ||
MediaStyle.Novel =>
AcgItemWidget(info: list[index], coverV: true),
MediaStyle.Pic =>
PhotoGalleryItem(videoModel: list[index], textline: 1),
MediaStyle.Game => VideoSimpleCell(
videoModel: list[index],
isFromHY: true,
@@ -1,11 +1,12 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/config/config.dart';
import 'package:hgmj/hj_model/home/plate_model.dart';
import 'package:hgmj/hj_page/main_page/provider/bottom_bar_provider.dart';
import 'package:hgmj/hj_utils/const.dart';
import 'package:wydj/config/config.dart';
import 'package:wydj/hj_model/home/plate_model.dart';
import 'package:wydj/hj_page/main_page/provider/bottom_bar_provider.dart';
import 'package:wydj/hj_utils/const.dart';
class CartoonSubModuleLogic extends GetxController with GetTickerProviderStateMixin {
class CartoonSubModuleLogic extends GetxController
with GetTickerProviderStateMixin {
final int tabIndex; // 未初始化时,内链跳转需要
final MediaStyle type; //-1:动漫和漫画 0:图集 1:黄游 2:小说
List<ModuleData> tabs = []; //漫画
@@ -39,7 +40,8 @@ class CartoonSubModuleLogic extends GetxController with GetTickerProviderStateMi
@override
void onClose() {
tabController.dispose(); // 自建 TabController,随 logic 释放(含内部 AnimationController + 匿名监听)
tabController
.dispose(); // 自建 TabController,随 logic 释放(含内部 AnimationController + 匿名监听)
super.onClose();
}
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/hj_page/main_page/provider/bottom_bar_provider.dart';
import 'package:hgmj/hj_utils/const.dart';
import 'package:hgmj/tools_base/indicator/custom_tab_indicator.dart';
import 'package:wydj/hj_page/main_page/provider/bottom_bar_provider.dart';
import 'package:wydj/hj_utils/const.dart';
import 'package:wydj/tools_base/indicator/custom_tab_indicator.dart';
import 'cartoon_sub_detail_page.dart';
import 'cartoon_sub_module_logic.dart';
@@ -12,7 +12,8 @@ class CartoonSubModulePage extends StatelessWidget {
final MediaStyle type; //-1:动漫和漫画 0:图集 1:黄游 2:小说
final int tabIndex;
const CartoonSubModulePage({super.key, this.type = MediaStyle.Pic, this.tabIndex = 0});
const CartoonSubModulePage(
{super.key, this.type = MediaStyle.Pic, this.tabIndex = 0});
@override
Widget build(BuildContext context) {
@@ -31,8 +32,11 @@ class CartoonSubModulePage extends StatelessWidget {
tagData: logic.tabs[index],
type: type,
index: index,
scroll: CommunityBottomProvider()
.scrollCtr(type == MediaStyle.Pic ? MediaStyle.Pic : MediaStyle.Novel, index),
scroll: CommunityBottomProvider().scrollCtr(
type == MediaStyle.Pic
? MediaStyle.Pic
: MediaStyle.Novel,
index),
),
),
),
@@ -59,8 +63,10 @@ class CartoonSubModulePage extends StatelessWidget {
labelColor: Colors.white.withValues(alpha: .9),
labelStyle: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
unselectedLabelColor: Colors.white.withValues(alpha: .55),
unselectedLabelStyle: const TextStyle(fontSize: 14, fontWeight: FontWeight.w400),
indicator: CustomIndicator(width: 16, height: 2, offsetY: 6, color: Color(0xFFFFC000)),
unselectedLabelStyle:
const TextStyle(fontSize: 14, fontWeight: FontWeight.w400),
indicator: CustomIndicator(
width: 16, height: 2, offsetY: 6, color: Color(0xFFFFC000)),
);
}
}
+11 -7
View File
@@ -4,9 +4,9 @@ import 'package:pull_to_refresh/pull_to_refresh.dart';
import '../../hj_model/cartoon_media_info.dart';
import '../../hj_utils/api_service/acg_service.dart';
import 'package:hgmj/tools_base/toast.dart';
import 'package:wydj/tools_base/toast.dart';
import '../../hj_utils/history_util.dart';
import 'package:hgmj/hj_utils/const.dart';
import 'package:wydj/hj_utils/const.dart';
import '../../routers/jump_router.dart';
import 'audio_player_bottomsheet.dart';
import 'text_novel_read_page.dart';
@@ -71,12 +71,15 @@ class NovelDetailLogic extends GetxController {
// 获取相关推荐
Future fetchRecommendData() async {
final result = await ACGService.comicsRecommendList(page, 12, tagId: model?.tagDetails?.firstOrNull?.id ?? '', mediaType: 'text');
final result = await ACGService.comicsRecommendList(page, 12,
tagId: model?.tagDetails?.firstOrNull?.id ?? '', mediaType: 'text');
if (result != null) {
page += 1;
recommends.addAll(result.list ?? []);
}
result?.hasNext ?? false ? refreshCtr?.loadComplete() : refreshCtr?.loadNoData();
result?.hasNext ?? false
? refreshCtr?.loadComplete()
: refreshCtr?.loadNoData();
update();
}
@@ -96,11 +99,13 @@ class NovelDetailLogic extends GetxController {
gotoPlay({int index = 0}) async {
final mediaSubType = model?.mediaSubType ?? -1;
final opm = await manager.getEpisodeHasPermisson(index); //通过时内部已切集,不必再 changeEpisodesIndex
final opm = await manager
.getEpisodeHasPermisson(index); //通过时内部已切集,不必再 changeEpisodesIndex
if (opm != null) {
//0-默认文本小说 1-有声小说
if (mediaSubType == 0) {
Get.to(() => TextNovelReadPage(manager: manager), preventDuplicates: false);
Get.to(() => TextNovelReadPage(manager: manager),
preventDuplicates: false);
} else if (mediaSubType == 1) {
Get.to(
() => VoiceNovelReadPage(
@@ -123,5 +128,4 @@ class NovelDetailLogic extends GetxController {
}
pushToCartoonPage(info);
}
}
+29 -16
View File
@@ -2,12 +2,12 @@ import 'dart:math';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/tools_base/toast.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/unique_tag_mixin.dart';
import 'package:hgmj/tools_base/widget/follow_button.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/tools_base/toast.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/unique_tag_mixin.dart';
import 'package:wydj/tools_base/widget/follow_button.dart';
import 'package:provider/provider.dart';
import '../../hj_utils/widget_util.dart';
@@ -87,7 +87,8 @@ class _NovelDetailPageState extends State<NovelDetailPage> with UniqueTagMixin {
padding: EdgeInsets.only(bottom: 80),
sliver: SliverGrid.builder(
itemCount: _.recommends.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
mainAxisSpacing: 12,
crossAxisSpacing: 6,
@@ -112,7 +113,8 @@ class _NovelDetailPageState extends State<NovelDetailPage> with UniqueTagMixin {
),
),
),
InkWell(enableFeedback: false,
InkWell(
enableFeedback: false,
child: Container(
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 10),
height: 44,
@@ -124,7 +126,10 @@ class _NovelDetailPageState extends State<NovelDetailPage> with UniqueTagMixin {
child: Consumer<ACGSourceManager>(
builder: (context, value, child) => Text(
_.manager.actionTitle(),
style: TextStyle(color: Colors.black, fontSize: 16, fontWeight: FontWeight.w500),
style: TextStyle(
color: Colors.black,
fontSize: 16,
fontWeight: FontWeight.w500),
),
)),
onTap: () => _.gotoPlay(index: _.manager.index),
@@ -152,7 +157,8 @@ class _NovelDetailPageState extends State<NovelDetailPage> with UniqueTagMixin {
color: !_.showHeader ? Color(0xff0E141E) : Colors.transparent,
child: Row(
children: [
InkWell(enableFeedback: false,
InkWell(
enableFeedback: false,
child: Image.asset('acg_noval_back.png'.acgImgPath, width: 24),
onTap: () => Get.back(),
),
@@ -165,7 +171,8 @@ class _NovelDetailPageState extends State<NovelDetailPage> with UniqueTagMixin {
Spacer(),
Consumer<ACGSourceManager>(
builder: (context, manager, child) {
bool col = manager.mediaInfo?.mediaStatus?.hasCollected ?? false;
bool col =
manager.mediaInfo?.mediaStatus?.hasCollected ?? false;
return FollowButton(
mediaId: manager.mediaInfo?.id ?? '',
isFollow: col,
@@ -207,7 +214,8 @@ class _NovelDetailPageState extends State<NovelDetailPage> with UniqueTagMixin {
),
),
Spacer(),
InkWell(enableFeedback: false,
InkWell(
enableFeedback: false,
onTap: () => _.episodesBottomSheet(),
child: Row(
children: [
@@ -241,7 +249,8 @@ class _NovelDetailPageState extends State<NovelDetailPage> with UniqueTagMixin {
),
itemBuilder: (BuildContext context, int index) {
final epm = manager.allEpisodes[index];
return InkWell(enableFeedback: false,
return InkWell(
enableFeedback: false,
onTap: () => _.gotoPlay(index: index),
child: Column(
children: [
@@ -251,18 +260,22 @@ class _NovelDetailPageState extends State<NovelDetailPage> with UniqueTagMixin {
Text(
'第${epm.episodeNumber ?? 1}${_.model?.unit}',
style: TextStyle(
color: manager.index == index ? AppColors.actionRed : Color(0xff989898),
color: manager.index == index
? AppColors.actionRed
: Color(0xff989898),
fontSize: 12,
fontWeight: FontWeight.w400,
),
),
//无任何权限时,前 N 集免费展示「免费」角标
if (manager.mediaInfo?.hasPermission == false && epm.inFreeEpisode) ...[
if (manager.mediaInfo?.hasPermission == false &&
epm.inFreeEpisode) ...[
6.sizeBoxW,
const FreeBadge(),
],
Spacer(),
Icon(Icons.navigate_next_sharp, size: 20, color: Colors.white)
Icon(Icons.navigate_next_sharp,
size: 20, color: Colors.white)
],
),
12.sizeBoxH,
+17 -10
View File
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/widget/net_image_widget.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/widget/net_image_widget.dart';
import '../../hj_model/cartoon_media_info.dart';
import '../../hj_model/video_model.dart';
@@ -87,17 +87,20 @@ class NovelHeader extends StatelessWidget {
children: [
Text(
'共${info?.totalEpisode ?? 0}${info?.unit}',
style: textStyle(12, const Color(0xff999999), FontWeight.w400),
style:
textStyle(12, const Color(0xff999999), FontWeight.w400),
),
8.sizeBoxW,
Text(
'/',
style: textStyle(12, const Color(0xff999999), FontWeight.w400),
style:
textStyle(12, const Color(0xff999999), FontWeight.w400),
),
8.sizeBoxW,
Text(
info?.updateDesc ?? '',
style: textStyle(12, info!.getDetailUpdateColor, FontWeight.w400),
style: textStyle(
12, info!.getDetailUpdateColor, FontWeight.w400),
),
],
),
@@ -118,10 +121,13 @@ class NovelHeader extends StatelessWidget {
runSpacing: 10,
maxLines: 1,
children: tags
.map((tag) => InkWell(enableFeedback: false,
onTap: () => Get.to(CartoonTagPage(title: tag.name ?? '', sId: tag.id ?? '')),
.map((tag) => InkWell(
enableFeedback: false,
onTap: () => Get.to(
CartoonTagPage(title: tag.name ?? '', sId: tag.id ?? '')),
child: Container(
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 12),
padding:
const EdgeInsets.symmetric(vertical: 6, horizontal: 12),
decoration: BoxDecoration(
color: const Color(0xff22252D),
borderRadius: BorderRadius.circular(4),
@@ -129,7 +135,8 @@ class NovelHeader extends StatelessWidget {
child: Text(
'#${tag.name ?? ''}',
maxLines: 1,
style: const TextStyle(color: Color(0xFF999999), fontSize: 12),
style:
const TextStyle(color: Color(0xFF999999), fontSize: 12),
),
),
))
+10 -8
View File
@@ -1,11 +1,11 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/hj_model/video_model.dart';
import 'package:hgmj/hj_page/find/pic_collect/pics_detail_page.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/widget/net_image_widget.dart';
import 'package:hgmj/extension/extensions.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/hj_model/video_model.dart';
import 'package:wydj/hj_page/find/pic_collect/pics_detail_page.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/widget/net_image_widget.dart';
import 'package:wydj/extension/extensions.dart';
//图集item
class PhotoGalleryItem extends StatelessWidget {
@@ -13,7 +13,8 @@ class PhotoGalleryItem extends StatelessWidget {
final Function? callback;
final int textline;
const PhotoGalleryItem({super.key,
const PhotoGalleryItem({
super.key,
this.videoModel,
this.callback,
this.textline = 1,
@@ -21,7 +22,8 @@ class PhotoGalleryItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
return InkWell(enableFeedback: false,
return InkWell(
enableFeedback: false,
onTap: () {
if (callback != null) {
callback?.call();
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/hj_model/media_content.dart';
import 'package:hgmj/hj_utils/api_service/acg_service.dart';
import 'package:hgmj/tools_base/toast.dart';
import 'package:wydj/hj_model/media_content.dart';
import 'package:wydj/hj_utils/api_service/acg_service.dart';
import 'package:wydj/tools_base/toast.dart';
import '../../hj_model/acg/comic_chapters_model.dart';
import '../../hj_model/cartoon_media_info.dart';
@@ -49,7 +49,8 @@ class TextNovelReadLogic extends GetxController {
// ========== 公开方法 ==========
// 获取文字小说。返回 Future 不是可有可无:CErrorWidget 靠它做重试 loading 和防连点
Future<void> loadData({bool showLoading = false, bool needToTop = false}) async {
Future<void> loadData(
{bool showLoading = false, bool needToTop = false}) async {
if (showLoading) LoadingHelper.showLoading();
final model = await manager.getComicsMediaContent(index: currentEpisode);
if (showLoading) LoadingHelper.dismissLoading();
@@ -89,7 +90,8 @@ class TextNovelReadLogic extends GetxController {
final epm = await manager.getEpisodeHasPermisson(realIndex);
if (epm == null) return;
LoadingHelper.showLoading();
final model = await ACGService.getMediaDetail(mediaId: manager.mediaInfo?.id, id: id);
final model =
await ACGService.getMediaDetail(mediaId: manager.mediaInfo?.id, id: id);
LoadingHelper.dismissLoading();
if (model != null) {
currentEpisode = realIndex;
+51 -22
View File
@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/widget/stagger_in_item.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/widget/stagger_in_item.dart';
import '../../tools_base/loading/loading_center_widget.dart';
import 'text_novel_read_logic.dart';
@@ -65,7 +65,8 @@ class TextNovelReadPage extends StatelessWidget {
Expanded(
child: SingleChildScrollView(
controller: logic.scrollCtr,
padding: const EdgeInsets.only(bottom: 60), //给底部菜单栏留位,别被挡住最后几行
padding:
const EdgeInsets.only(bottom: 60), //给底部菜单栏留位,别被挡住最后几行
child: Align(
//正文不足一行时居中(长文自然撑满,看不出差别),与旧版 Column 默认的 center 保持一致
alignment: Alignment.topCenter,
@@ -73,7 +74,8 @@ class TextNovelReadPage extends StatelessWidget {
logic.detailInfo?.text ?? '',
style: TextStyle(
fontSize: 16,
color: (logic.isDark ? Colors.white : Colors.black).withValues(alpha: .9),
color: (logic.isDark ? Colors.white : Colors.black)
.withValues(alpha: .9),
),
),
),
@@ -98,7 +100,8 @@ class TextNovelReadPage extends StatelessWidget {
child: Container(
height: height,
color: logic.isDark ? Colors.black : Colors.white,
padding: EdgeInsets.only(top: screen.paddingTop + 5, left: 16, right: 16),
padding:
EdgeInsets.only(top: screen.paddingTop + 5, left: 16, right: 16),
alignment: Alignment.topCenter, //按钮贴状态栏下沿,余量留在底部
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -111,7 +114,8 @@ class TextNovelReadPage extends StatelessWidget {
Expanded(
child: Text(
logic.detailInfo?.name ?? '',
style: TextStyle(fontSize: 18, color: fg, fontWeight: FontWeight.w600),
style: TextStyle(
fontSize: 18, color: fg, fontWeight: FontWeight.w600),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
@@ -124,9 +128,12 @@ class TextNovelReadPage extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 7),
child: AnimatedSwitcher(
duration: const Duration(milliseconds: 200),
transitionBuilder: (child, anim) => ScaleTransition(scale: anim, child: child),
transitionBuilder: (child, anim) =>
ScaleTransition(scale: anim, child: child),
child: Image.asset(
logic.isDark ? 'text_sun.png'.acgImgPath : 'text_moon.png'.acgImgPath,
logic.isDark
? 'text_sun.png'.acgImgPath
: 'text_moon.png'.acgImgPath,
// key 按状态区分,AnimatedSwitcher 才会把它当成新 child 触发动画
key: ValueKey(logic.isDark),
width: 24,
@@ -140,7 +147,8 @@ class TextNovelReadPage extends StatelessWidget {
onTap: () => Scaffold.of(ctx).openEndDrawer(),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 7),
child: Image.asset('text_play_menu.png'.acgImgPath, width: 24, color: fg),
child: Image.asset('text_play_menu.png'.acgImgPath,
width: 24, color: fg),
),
),
],
@@ -151,7 +159,8 @@ class TextNovelReadPage extends StatelessWidget {
// 底部翻章栏,收起时整条移出屏幕下方
Widget _buildFooter(TextNovelReadLogic logic) {
final style = TextStyle(fontSize: 14, color: logic.isDark ? Colors.white : Colors.black);
final style = TextStyle(
fontSize: 14, color: logic.isDark ? Colors.white : Colors.black);
return AnimatedPositioned(
duration: Duration(milliseconds: logic.durationTime),
bottom: logic.showMenu ? 0 : -60,
@@ -170,7 +179,8 @@ class TextNovelReadPage extends StatelessWidget {
onTap: () => logic.loadOtherEpisode(false, showLoading: true),
child: Row(
children: [
Image.asset('text_last.png'.acgImgPath, color: AppColors.actionRed, width: 20, height: 20),
Image.asset('text_last.png'.acgImgPath,
color: AppColors.actionRed, width: 20, height: 20),
12.sizeBoxW,
Text('上一章', style: style),
],
@@ -183,7 +193,8 @@ class TextNovelReadPage extends StatelessWidget {
children: [
Text('下一章', style: style),
12.sizeBoxW,
Image.asset('text_next.png'.acgImgPath, color: AppColors.actionRed, width: 20, height: 20),
Image.asset('text_next.png'.acgImgPath,
color: AppColors.actionRed, width: 20, height: 20),
],
),
),
@@ -207,7 +218,10 @@ class TextNovelReadPage extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
logic.mediaInfo?.title ?? '',
style: TextStyle(fontSize: 16, color: fg.withValues(alpha: .9), fontWeight: FontWeight.w500),
style: TextStyle(
fontSize: 16,
color: fg.withValues(alpha: .9),
fontWeight: FontWeight.w500),
overflow: TextOverflow.ellipsis,
),
),
@@ -221,7 +235,10 @@ class TextNovelReadPage extends StatelessWidget {
children: [
Text(
'共${logic.mediaInfo?.totalEpisode ?? 0}话 ${logic.mediaInfo?.updateDesc ?? ''}',
style: const TextStyle(fontSize: 14, color: Color(0xFF1F2029), fontWeight: FontWeight.w500),
style: const TextStyle(
fontSize: 14,
color: Color(0xFF1F2029),
fontWeight: FontWeight.w500),
),
InkWell(
enableFeedback: false,
@@ -234,12 +251,19 @@ class TextNovelReadPage extends StatelessWidget {
turns: logic.isAscend ? 0 : 0.5,
duration: const Duration(milliseconds: 250),
curve: Curves.easeOutCubic,
child: Image.asset('text_play_sort.png'.acgImgPath, width: 20, color: Color(0xFF1F2029),),
child: Image.asset(
'text_play_sort.png'.acgImgPath,
width: 20,
color: Color(0xFF1F2029),
),
),
4.sizeBoxW,
Text(
logic.isAscend ? '正序' : '倒序',
style: const TextStyle(fontSize: 14, color: Color(0xFF1F2029), fontWeight: FontWeight.w500),
style: const TextStyle(
fontSize: 14,
color: Color(0xFF1F2029),
fontWeight: FontWeight.w500),
),
],
),
@@ -252,7 +276,8 @@ class TextNovelReadPage extends StatelessWidget {
child: GetBuilder<TextNovelReadLogic>(
id: 'list',
builder: (_) => ListView.builder(
key: ValueKey(logic.isAscend), // 切换正/倒序时 key 变化→列表重建→item 重新错峰入场
key:
ValueKey(logic.isAscend), // 切换正/倒序时 key 变化→列表重建→item 重新错峰入场
itemCount: logic.allEpisodes.length,
padding: const EdgeInsets.only(top: 6),
itemBuilder: (_, index) {
@@ -261,7 +286,8 @@ class TextNovelReadPage extends StatelessWidget {
return StaggerInItem(
index: index,
child: InkWell(
enableFeedback: false, //换掉裸 GestureDetector:整行可点,不再只有文字那一小块
enableFeedback:
false, //换掉裸 GestureDetector:整行可点,不再只有文字那一小块
onTap: () {
Get.back();
logic.loadDataWithIndex(info.id ?? '');
@@ -275,8 +301,11 @@ class TextNovelReadPage extends StatelessWidget {
'第${info.episodeNumber ?? 1}${logic.mediaInfo?.unit ?? ''}',
style: TextStyle(
fontSize: 16,
color: select ? AppColors.actionRed : fg.withValues(alpha: .55),
fontWeight: select ? FontWeight.w500 : FontWeight.w400,
color: select
? AppColors.actionRed
: fg.withValues(alpha: .55),
fontWeight:
select ? FontWeight.w500 : FontWeight.w400,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
@@ -1,8 +1,8 @@
import 'dart:async';
import 'package:get/get.dart';
import 'package:hgmj/tools_base/event_bus/event_bus_util.dart';
import 'package:hgmj/tools_base/event_bus/events.dart';
import 'package:wydj/tools_base/event_bus/event_bus_util.dart';
import 'package:wydj/tools_base/event_bus/events.dart';
import 'widget/acg_source_manager.dart';
+14 -10
View File
@@ -2,10 +2,10 @@ import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/hj_utils/widget_util.dart';
import 'package:hgmj/tools_base/loading/loading_center_widget.dart';
import 'package:hgmj/tools_base/unique_tag_mixin.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/hj_utils/widget_util.dart';
import 'package:wydj/tools_base/loading/loading_center_widget.dart';
import 'package:wydj/tools_base/unique_tag_mixin.dart';
import 'package:provider/provider.dart';
import 'audio_player_content.dart';
@@ -34,7 +34,8 @@ class VoiceNovelReadPage extends StatefulWidget {
// 可重复 push(preventDuplicates: false)+ 间接环 NovelDetail→VoiceNovelRead 可能多实例并存,
// 用 UniqueTagMixin 给每个实例分独立 tag 隔离
class _VoiceNovelReadPageState extends State<VoiceNovelReadPage> with UniqueTagMixin {
class _VoiceNovelReadPageState extends State<VoiceNovelReadPage>
with UniqueTagMixin {
@override
Widget build(BuildContext context) {
return GetBuilder<VoiceNovelReadLogic>(
@@ -49,9 +50,11 @@ class _VoiceNovelReadPageState extends State<VoiceNovelReadPage> with UniqueTagM
value: logic.sourceManager,
child: Scaffold(
appBar: AppBar(
leading: InkWell(enableFeedback: false,
leading: InkWell(
enableFeedback: false,
onTap: () => Get.back(),
child: const Icon(Icons.arrow_back_ios, size: 24, color: Colors.white),
child: const Icon(Icons.arrow_back_ios,
size: 24, color: Colors.white),
),
centerTitle: false,
titleSpacing: -10,
@@ -91,17 +94,18 @@ class _VoiceNovelReadPageState extends State<VoiceNovelReadPage> with UniqueTagM
padding: const EdgeInsets.fromLTRB(16, 18, 16, 12),
child: Text(
'相关推荐',
style: textStyle(18, Colors.white.withValues(alpha: .9), FontWeight.w600),
style: textStyle(
18, Colors.white.withValues(alpha: .9), FontWeight.w600),
),
),
),
],
body: CartoonRecommendPage(
mediaId: logic.sourceManager.mediaInfo?.tagDetails?.firstOrNull?.id ?? '',
mediaId:
logic.sourceManager.mediaInfo?.tagDetails?.firstOrNull?.id ?? '',
padding: const EdgeInsets.only(top: 10),
tapAction: () => logic.audioManager.pause(),
),
);
}
}
@@ -1,8 +1,8 @@
//查看更多
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/hj_utils/screen.dart';
import '../../../hj_utils/widget_util.dart';
@@ -33,7 +33,9 @@ class _AcgShowMoreTextWidgetState extends State<AcgShowMoreTextWidget> {
Widget build(BuildContext context) {
//用 LayoutBuilder 拿真实约束宽度测量,避免传入的 maxWidth 与实际渲染宽度不符导致"该展开却没按钮"
return LayoutBuilder(builder: (context, cons) {
final maxWidth = cons.maxWidth.isFinite ? cons.maxWidth : (widget.maxWidth ?? Get.width);
final maxWidth = cons.maxWidth.isFinite
? cons.maxWidth
: (widget.maxWidth ?? Get.width);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -41,7 +43,9 @@ class _AcgShowMoreTextWidgetState extends State<AcgShowMoreTextWidget> {
SizedBox(
width: double.infinity,
child: Text(
widget.summary?.isNotEmpty == true ? widget.summary ?? '' : '暂无简介',
widget.summary?.isNotEmpty == true
? widget.summary ?? ''
: '暂无简介',
textAlign: TextAlign.left,
style: textStyle(12, widget.txColor, FontWeight.w400),
maxLines: _isFold ? widget.maxLine : null,
@@ -59,7 +63,8 @@ class _AcgShowMoreTextWidgetState extends State<AcgShowMoreTextWidget> {
children: [
Text(
_isFold ? '更多简介' : '收起简介',
style: textStyle(12, const Color(0xffEFEFEF), FontWeight.w400),
style: textStyle(
12, const Color(0xffEFEFEF), FontWeight.w400),
),
2.sizeBoxW,
AnimatedRotation(
@@ -93,7 +98,8 @@ class _AcgShowMoreTextWidgetState extends State<AcgShowMoreTextWidget> {
);
}
bool _textExceedMaxLines(String text, TextStyle style, int maxLine, double maxWidth) {
bool _textExceedMaxLines(
String text, TextStyle style, int maxLine, double maxWidth) {
//与 Text 组件保持一致:合并 DefaultTextStyle(letterSpacing/字体等差异会导致测量行数偏少)
final effectiveStyle = DefaultTextStyle.of(context).style.merge(style);
final painter = TextPainter(
@@ -3,13 +3,13 @@ import 'dart:async';
import 'package:audioplayers/audioplayers.dart';
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:hgmj/hj_model/cartoon_media_info.dart';
import 'package:hgmj/hj_model/media_content.dart';
import 'package:hgmj/hj_utils/api_service/common_service.dart';
import 'package:hgmj/tools_base/event_bus/event_bus_util.dart';
import 'package:hgmj/tools_base/event_bus/events.dart';
import 'package:hgmj/tools_base/loading/loading_helper.dart';
import 'package:hgmj/tools_base/toast.dart';
import 'package:wydj/hj_model/cartoon_media_info.dart';
import 'package:wydj/hj_model/media_content.dart';
import 'package:wydj/hj_utils/api_service/common_service.dart';
import 'package:wydj/tools_base/event_bus/event_bus_util.dart';
import 'package:wydj/tools_base/event_bus/events.dart';
import 'package:wydj/tools_base/loading/loading_helper.dart';
import 'package:wydj/tools_base/toast.dart';
import '../../../alert/video/comic_buy_alert.dart';
import '../../../alert/video/vip_acg_dialog.dart';
@@ -44,7 +44,9 @@ class ACGSourceManager extends ChangeNotifier {
final liked = mediaInfo?.mediaStatus?.hasLiked ?? false;
final mid = mediaInfo?.id ?? '';
final type = mediaInfo?.mediaType ?? '';
final suc = liked ? await CommonService.cancelLike(mid, type) : await CommonService.sendLike(mid, type);
final suc = liked
? await CommonService.cancelLike(mid, type)
: await CommonService.sendLike(mid, type);
LoadingHelper.dismissLoading();
if (suc) {
mediaInfo?.mediaStatus?.hasLiked = !liked;
@@ -94,7 +96,8 @@ class ACGSourceManager extends ChangeNotifier {
final list = result.list ?? [];
// 每页拉到就按集号标免费集(与播放放行/角标同一口径),避免全部拉完才标导致角标迟到
for (final e in list) {
e.inFreeEpisode = mediaInfo?.isFreeEpisodeNumber(e.episodeNumber) ?? false;
e.inFreeEpisode =
mediaInfo?.isFreeEpisodeNumber(e.episodeNumber) ?? false;
}
allEpisodes.addAll(list);
notifyListeners();
@@ -146,7 +149,8 @@ class ACGSourceManager extends ChangeNotifier {
}
/// 拉漫画章节详情(带缓存 + 权限校验)
Future<MediaContent?> getComicsMediaContent({int index = 0, bool showLoading = false}) async {
Future<MediaContent?> getComicsMediaContent(
{int index = 0, bool showLoading = false}) async {
final cached = mediaContentCache[index];
if (cached != null) {
changeEpisodesIndex(index); // 命中缓存也要同步当前章,否则退回详情页「续看」还停在旧章
@@ -244,9 +248,11 @@ class AudioPlayerManager {
double playSpeed = 1;
void initPlayer() {
if (_audioPlayer != null) return; // 防重入:已初始化则跳过,避免 5 个 stream 监听重复注册、旧 sub 泄漏
if (_audioPlayer != null)
return; // 防重入:已初始化则跳过,避免 5 个 stream 监听重复注册、旧 sub 泄漏
_audioPlayer = AudioPlayer();
_audioPlayer?.setReleaseMode(playMod == AudioPlayMod.loop ? ReleaseMode.loop : ReleaseMode.stop);
_audioPlayer?.setReleaseMode(
playMod == AudioPlayMod.loop ? ReleaseMode.loop : ReleaseMode.stop);
_audioDurationSub = _audioPlayer?.onDurationChanged.listen((event) {
audioValue.value = AudioPlayerValue.copyWith(value..duration = event);
@@ -270,7 +276,8 @@ class AudioPlayerManager {
audioValue.value = AudioPlayerValue.copyWith(value..isPlaying = true);
break;
case PlayerState.paused:
audioValue.value = AudioPlayerValue.copyWith(value..isPlaying = false);
audioValue.value =
AudioPlayerValue.copyWith(value..isPlaying = false);
break;
default:
break;
@@ -292,7 +299,8 @@ class AudioPlayerManager {
audioValue.value = AudioPlayerValue.copyWith(value..isPlaying = true);
});
audioValue.value = AudioPlayerValue.copyWith(value..isInitialized = _audioPlayer != null);
audioValue.value =
AudioPlayerValue.copyWith(value..isInitialized = _audioPlayer != null);
}
void setPlaySpeed(double speed) {
@@ -355,9 +363,11 @@ class AudioPlayerManager {
}
void setPlayMod(AudioPlayMod mod) {
_audioPlayer?.setReleaseMode(mod == AudioPlayMod.loop ? ReleaseMode.loop : ReleaseMode.stop);
_audioPlayer?.setReleaseMode(
mod == AudioPlayMod.loop ? ReleaseMode.loop : ReleaseMode.stop);
playMod = mod;
audioValue.value = AudioPlayerValue.copyWith(value..isLooping = mod == AudioPlayMod.loop);
audioValue.value =
AudioPlayerValue.copyWith(value..isLooping = mod == AudioPlayMod.loop);
}
Future<void> playWithIndex(int index) async {
@@ -1,12 +1,12 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hgmj/assets_tool/app_colors.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/hj_model/acg/comic_chapters_model.dart';
import 'package:hgmj/hj_model/cartoon_media_info.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/widget/sheet_handle_bar.dart';
import 'package:hgmj/tools_base/widget/stagger_in_item.dart';
import 'package:wydj/assets_tool/app_colors.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/hj_model/acg/comic_chapters_model.dart';
import 'package:wydj/hj_model/cartoon_media_info.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/widget/sheet_handle_bar.dart';
import 'package:wydj/tools_base/widget/stagger_in_item.dart';
import 'acg_source_manager.dart';
import 'free_badge.dart';
@@ -63,7 +63,8 @@ class _CartoonSubSetAlertState extends State<CartoonSubSetAlert> {
16.sizeBoxW,
const Text(
'漫画列表',
style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500),
style: TextStyle(
color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500),
),
10.sizeBoxW,
const Spacer(),
@@ -117,13 +118,16 @@ class _CartoonSubSetAlertState extends State<CartoonSubSetAlert> {
//与详情/阅读抽屉子集 title 一致:第X话(CartoonDetailPage 只处理 image,恒为漫画)
'第${info.episodeNumber ?? ''}${mediaInfo?.unit ?? ''}',
style: TextStyle(
color: sel ? Colors.white.withValues(alpha: .9) : Colors.white.withValues(alpha: .45),
color: sel
? Colors.white.withValues(alpha: .9)
: Colors.white.withValues(alpha: .45),
fontSize: 16,
fontWeight: FontWeight.w400,
),
),
//无任何权限时,前 N 集免费展示「免费」角标
if (mediaInfo?.hasPermission == false && info.inFreeEpisode) ...[
if (mediaInfo?.hasPermission == false &&
info.inFreeEpisode) ...[
8.sizeBoxW,
const FreeBadge(),
],
+39 -25
View File
@@ -2,26 +2,26 @@ import 'dart:math';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:hgmj/assets_tool/images.dart';
import 'package:hgmj/extension/extensions.dart';
import 'package:hgmj/hj_model/comment/comment_model.dart';
import 'package:hgmj/hj_model/comment/reply_model.dart';
import 'package:hgmj/hj_model/video_model.dart';
import 'package:hgmj/hj_page/comment/cell/reply_comment_item.dart';
import 'package:hgmj/hj_utils/api_service/comment_service.dart';
import 'package:hgmj/hj_utils/api_service/common_service.dart';
import 'package:hgmj/hj_utils/date_time_util.dart';
import 'package:hgmj/hj_utils/screen.dart';
import 'package:hgmj/tools_base/debug_log.dart';
import 'package:wydj/assets_tool/images.dart';
import 'package:wydj/extension/extensions.dart';
import 'package:wydj/hj_model/comment/comment_model.dart';
import 'package:wydj/hj_model/comment/reply_model.dart';
import 'package:wydj/hj_model/video_model.dart';
import 'package:wydj/hj_page/comment/cell/reply_comment_item.dart';
import 'package:wydj/hj_utils/api_service/comment_service.dart';
import 'package:wydj/hj_utils/api_service/common_service.dart';
import 'package:wydj/hj_utils/date_time_util.dart';
import 'package:wydj/hj_utils/screen.dart';
import 'package:wydj/tools_base/debug_log.dart';
import 'package:like_button/like_button.dart';
import '../../../tools_base/widget/net_image_widget.dart';
import 'package:hgmj/tools_base/widget/image_browser_page.dart';
import 'package:wydj/tools_base/widget/image_browser_page.dart';
import '../../home/widget/user_avatar.dart';
import '../../home/widget/user_name_view.dart';
import '../widget/comment_rich_text.dart';
import '../widget/comment_top_banner.dart';
import 'package:hgmj/hj_model/banner/comment_top_banner_model.dart';
import 'package:wydj/hj_model/banner/comment_top_banner_model.dart';
/// 一条评论:头像 + 昵称 + 正文(可带图) + 时间/点赞/回复 + 折叠的回复列表
class CommentItem extends StatefulWidget {
@@ -93,7 +93,8 @@ class _CommentItemState extends State<CommentItem> {
),
if ((comment.vipLevel ?? 0) > 0) ...[
4.sizeBoxW,
Image.asset("vip_v.webp".commentPath, width: 16),
Image.asset("vip_v.webp".commentPath,
width: 16),
]
],
),
@@ -108,11 +109,13 @@ class _CommentItemState extends State<CommentItem> {
margin: EdgeInsets.only(top: 6),
alignment: Alignment.centerLeft,
constraints: BoxConstraints(maxWidth: 150),
child: NetworkImageLoader(imageUrl: comment.image ?? ""),
child: NetworkImageLoader(
imageUrl: comment.image ?? ""),
),
),
// 置顶评论配置 Banner(多图轮播,支持 GIF / 内外链)
if (widget.topBanners?.isNotEmpty == true) CommentTopBanner(banners: widget.topBanners!),
if (widget.topBanners?.isNotEmpty == true)
CommentTopBanner(banners: widget.topBanners!),
8.sizeBoxH,
Row(
children: [
@@ -124,7 +127,8 @@ class _CommentItemState extends State<CommentItem> {
),
),
const Spacer(),
if (!comment.isOfficial && !comment.isHideLikeOrComment) ...[
if (!comment.isOfficial &&
!comment.isHideLikeOrComment) ...[
ValueListenableBuilder(
valueListenable: isLikedNof,
builder: (context, value, child) => Row(
@@ -134,7 +138,9 @@ class _CommentItemState extends State<CommentItem> {
onTap: (_) => _toggleLike(),
size: 20,
likeBuilder: (isLiked) {
return Image.asset(isLiked ? 'like_red.webp'.commentPath : 'like_white.webp'.commentPath);
return Image.asset(isLiked
? 'like_red.webp'.commentPath
: 'like_white.webp'.commentPath);
},
),
Text(
@@ -149,15 +155,18 @@ class _CommentItemState extends State<CommentItem> {
),
12.sizeBoxW,
GestureDetector(
onTap: () => widget.replyHandler?.call(comment),
child: Image.asset('msg_icon.png'.commentPath, width: 20),
onTap: () =>
widget.replyHandler?.call(comment),
child: Image.asset('msg_icon.png'.commentPath,
width: 20),
),
],
],
),
_replyList(),
// 展开更多评论
if ((comment.replies?.length ?? 0) > 0) _moreReplyBar(),
if ((comment.replies?.length ?? 0) > 0)
_moreReplyBar(),
],
),
),
@@ -192,7 +201,11 @@ class _CommentItemState extends State<CommentItem> {
children: [
Container(width: 20, height: 1, color: const Color(0xff989898)),
4.sizeBoxW,
Text(text, style: const TextStyle(fontSize: 12, color: Color(0xff989898), fontWeight: FontWeight.w500)),
Text(text,
style: const TextStyle(
fontSize: 12,
color: Color(0xff989898),
fontWeight: FontWeight.w500)),
2.sizeBoxW,
isUp ? Transform.rotate(angle: pi, child: chevron) : chevron,
],
@@ -250,8 +263,8 @@ class _CommentItemState extends State<CommentItem> {
if (comment.hasMoreReply ?? false) {
final curTime = DateTimeUtil.format2utc(DateTime.now());
final fastId = comment.replies!.first.id ?? '';
final result =
await CommentService.getReplyList(widget.objId, comment.id ?? '', curTime, comment.replyPage ?? _page, 5, fastId);
final result = await CommentService.getReplyList(widget.objId,
comment.id ?? '', curTime, comment.replyPage ?? _page, 5, fastId);
comment.hasMoreReply = result?.hasNext ?? false;
comment.replies?.addAll(result?.list ?? []);
if (result?.hasNext == true) {
@@ -296,7 +309,8 @@ class _CommentItemState extends State<CommentItem> {
length,
(i) => ReplyCommentItem(
replies[i],
replyHandler: (reply) => widget.replyHandler?.call(comment, reply: reply),
replyHandler: (reply) =>
widget.replyHandler?.call(comment, reply: reply),
),
),
);

Some files were not shown because too many files have changed in this diff Show More