logo和名称替换
This commit is contained in:
@@ -2,17 +2,17 @@ import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgmj/alert/video/share_media_dialog.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/hj_model/video_model.dart';
|
||||
import 'package:hgmj/hj_page/comment/comment_alert.dart';
|
||||
import 'package:hgmj/hj_utils/api_service/common_service.dart';
|
||||
import 'package:hgmj/hj_utils/api_service/mine_service.dart';
|
||||
import 'package:hgmj/hj_utils/screen.dart';
|
||||
import 'package:hgmj/tools_base/debug_log.dart';
|
||||
import 'package:hgmj/tools_base/toast.dart';
|
||||
import 'package:wydj/alert/video/share_media_dialog.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/hj_model/video_model.dart';
|
||||
import 'package:wydj/hj_page/comment/comment_alert.dart';
|
||||
import 'package:wydj/hj_utils/api_service/common_service.dart';
|
||||
import 'package:wydj/hj_utils/api_service/mine_service.dart';
|
||||
import 'package:wydj/hj_utils/screen.dart';
|
||||
import 'package:wydj/tools_base/debug_log.dart';
|
||||
import 'package:wydj/tools_base/toast.dart';
|
||||
import 'package:like_button/like_button.dart';
|
||||
|
||||
///图集底部操作按钮组
|
||||
@@ -21,7 +21,8 @@ class AlbumActionWidget extends StatefulWidget {
|
||||
final int currentIndex; //当前顶部那张的下标,0 基
|
||||
final int? total; //显示的总张数,未传则取 seriesCover.length
|
||||
|
||||
const AlbumActionWidget({super.key, this.videoModel, this.currentIndex = 0, this.total});
|
||||
const AlbumActionWidget(
|
||||
{super.key, this.videoModel, this.currentIndex = 0, this.total});
|
||||
|
||||
@override
|
||||
State<AlbumActionWidget> createState() => _AlbumActionWidgetState();
|
||||
@@ -49,19 +50,23 @@ class _AlbumActionWidgetState extends State<AlbumActionWidget> {
|
||||
_actionItem(
|
||||
'share_grey_pic.png'.commonImgPath,
|
||||
'分享',
|
||||
onTap: () => Get.dialog(ShareMediaDialog(videoModel: model), useSafeArea: false),
|
||||
onTap: () => Get.dialog(ShareMediaDialog(videoModel: model),
|
||||
useSafeArea: false),
|
||||
),
|
||||
//页码 1/3
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 11, vertical: 2),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20)),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white, borderRadius: BorderRadius.circular(20)),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text('${widget.currentIndex + 1}',
|
||||
style: const TextStyle(color: AppColors.actionRed, fontSize: 12)),
|
||||
style: const TextStyle(
|
||||
color: AppColors.actionRed, fontSize: 12)),
|
||||
Text('/${widget.total ?? model?.seriesCover?.length ?? 0}',
|
||||
style: const TextStyle(color: Color(0xff3D3D3D), fontSize: 12)),
|
||||
style: const TextStyle(
|
||||
color: Color(0xff3D3D3D), fontSize: 12)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -75,13 +80,16 @@ class _AlbumActionWidgetState extends State<AlbumActionWidget> {
|
||||
return LikeButton(
|
||||
size: 20,
|
||||
isLiked: model?.vidStatus?.hasLiked ?? false,
|
||||
circleColor: CircleColor(start: AppColors.actionRed, end: AppColors.actionRed),
|
||||
circleColor:
|
||||
CircleColor(start: AppColors.actionRed, end: AppColors.actionRed),
|
||||
bubblesColor: BubblesColor(
|
||||
dotPrimaryColor: AppColors.actionRed,
|
||||
dotSecondaryColor: AppColors.actionRed,
|
||||
),
|
||||
likeBuilder: (isLiked) => Image.asset(
|
||||
isLiked ? 'like_red.png'.commonImgPath : 'video_like_border.png'.videoPath,
|
||||
isLiked
|
||||
? 'like_red.png'.commonImgPath
|
||||
: 'video_like_border.png'.videoPath,
|
||||
width: 20,
|
||||
height: 20,
|
||||
color: isLiked ? AppColors.actionRed : const Color(0xff989898),
|
||||
@@ -89,7 +97,9 @@ class _AlbumActionWidgetState extends State<AlbumActionWidget> {
|
||||
likeCount: model?.likeCount ?? 0,
|
||||
countBuilder: (count, isLiked, text) => Text(
|
||||
count.countOr('点赞'),
|
||||
style: TextStyle(color: isLiked ? AppColors.actionRed : const Color(0xff989898), fontSize: 12),
|
||||
style: TextStyle(
|
||||
color: isLiked ? AppColors.actionRed : const Color(0xff989898),
|
||||
fontSize: 12),
|
||||
),
|
||||
onTap: (isLiked) async {
|
||||
final hasLiked = model?.vidStatus?.hasLiked ?? false;
|
||||
@@ -118,25 +128,31 @@ class _AlbumActionWidgetState extends State<AlbumActionWidget> {
|
||||
return LikeButton(
|
||||
size: 20,
|
||||
isLiked: model?.vidStatus?.hasCollected ?? false,
|
||||
circleColor: CircleColor(start: AppColors.actionRed, end: AppColors.actionRed),
|
||||
circleColor:
|
||||
CircleColor(start: AppColors.actionRed, end: AppColors.actionRed),
|
||||
bubblesColor: BubblesColor(
|
||||
dotPrimaryColor: AppColors.actionRed,
|
||||
dotSecondaryColor: AppColors.actionRed,
|
||||
),
|
||||
likeBuilder: (isLiked) => Image.asset(
|
||||
isLiked ? 'collect_red.png'.commonImgPath : 'collect_empty.png'.commonImgPath,
|
||||
isLiked
|
||||
? 'collect_red.png'.commonImgPath
|
||||
: 'collect_empty.png'.commonImgPath,
|
||||
width: 20,
|
||||
color: isLiked ? AppColors.actionRed : const Color(0xff989898),
|
||||
),
|
||||
likeCount: model?.collectCount ?? 0,
|
||||
countBuilder: (count, isLiked, text) => Text(
|
||||
count.countOr('收藏'),
|
||||
style: TextStyle(color: isLiked ? AppColors.actionRed : const Color(0xff989898), fontSize: 12),
|
||||
style: TextStyle(
|
||||
color: isLiked ? AppColors.actionRed : const Color(0xff989898),
|
||||
fontSize: 12),
|
||||
),
|
||||
onTap: (isLiked) async {
|
||||
final hasCollected = model?.vidStatus?.hasCollected ?? false;
|
||||
final count = model?.collectCount ?? 0;
|
||||
final isOk = await MineService.postCollect(model?.id, 'PIC', !hasCollected);
|
||||
final isOk =
|
||||
await MineService.postCollect(model?.id, 'PIC', !hasCollected);
|
||||
//失败不动本地状态,返回原值让按钮回弹
|
||||
if (!isOk) return hasCollected;
|
||||
model?.collectCount = max(0, count + (hasCollected ? -1 : 1));
|
||||
@@ -149,7 +165,8 @@ class _AlbumActionWidgetState extends State<AlbumActionWidget> {
|
||||
}
|
||||
|
||||
//图标 + 文字按钮(评论、分享共用)
|
||||
Widget _actionItem(String imagePath, String title, {GestureTapCallback? onTap}) {
|
||||
Widget _actionItem(String imagePath, String title,
|
||||
{GestureTapCallback? onTap}) {
|
||||
return InkWell(
|
||||
enableFeedback: false,
|
||||
onTap: onTap,
|
||||
@@ -160,7 +177,8 @@ class _AlbumActionWidgetState extends State<AlbumActionWidget> {
|
||||
children: [
|
||||
Image.asset(imagePath, width: 20, color: const Color(0xff989898)),
|
||||
3.sizeBoxW,
|
||||
Text(title, style: const TextStyle(color: Color(0xff989898), fontSize: 12)),
|
||||
Text(title,
|
||||
style: const TextStyle(color: Color(0xff989898), fontSize: 12)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgmj/hj_model/video_model.dart';
|
||||
import 'package:hgmj/hj_page/mine/mine_vip/pay_order_source.dart';
|
||||
import 'package:hgmj/hj_utils/api_service/vid_service.dart';
|
||||
import 'package:hgmj/hj_utils/const.dart';
|
||||
import 'package:hgmj/hj_utils/history_util.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/video_model.dart';
|
||||
import 'package:wydj/hj_page/mine/mine_vip/pay_order_source.dart';
|
||||
import 'package:wydj/hj_utils/api_service/vid_service.dart';
|
||||
import 'package:wydj/hj_utils/const.dart';
|
||||
import 'package:wydj/hj_utils/history_util.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 '../../../alert/video/video_buy_bottom_sheet.dart';
|
||||
import '../../mine/mine_vip/mine_charge_vip_page.dart';
|
||||
@@ -36,7 +36,9 @@ class PicsDetailLogic extends GetxController {
|
||||
|
||||
//未解锁时放出几张:freeTime 为 0(后端没配)兜底 8 张,否则按 freeTime,都不超过总张数
|
||||
//freeTime 为 null 走后半段算 0 张,与原逻辑一致
|
||||
int get lockCount => videoModel?.freeTime == 0 ? min(8, covers.length) : min(videoModel?.freeTime ?? 0, covers.length);
|
||||
int get lockCount => videoModel?.freeTime == 0
|
||||
? min(8, covers.length)
|
||||
: min(videoModel?.freeTime ?? 0, covers.length);
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
@@ -56,14 +58,20 @@ class PicsDetailLogic extends GetxController {
|
||||
//解锁:金币走购买弹窗,会员走开通弹窗
|
||||
void showBuy() async {
|
||||
if (isCoinLock) {
|
||||
final res = await Get.bottomSheet(VideoBuyBottomSheet(video: videoModel!));
|
||||
final res =
|
||||
await Get.bottomSheet(VideoBuyBottomSheet(video: videoModel!));
|
||||
if (res == true) {
|
||||
videoModel?.vidStatus?.hasPaid = true;
|
||||
update();
|
||||
}
|
||||
} else if (videoModel?.lockType == 2) {
|
||||
//Get.dialog(VipACGDialog());
|
||||
Get.to(MineChargeVipPage(sourcePage: PaySourcePage.vipCenter,), preventDuplicates: false,);
|
||||
Get.to(
|
||||
MineChargeVipPage(
|
||||
sourcePage: PaySourcePage.vipCenter,
|
||||
),
|
||||
preventDuplicates: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,16 +3,16 @@ import 'dart:ui';
|
||||
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/hj_utils/widget_util.dart';
|
||||
import 'package:hgmj/tools_base/loading/loading_center_widget.dart';
|
||||
import 'package:hgmj/tools_base/toast.dart';
|
||||
import 'package:hgmj/tools_base/unique_tag_mixin.dart';
|
||||
import 'package:hgmj/tools_base/widget/image_browser_page.dart';
|
||||
import 'package:hgmj/tools_base/widget/net_image_widget.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/assets_tool/app_colors.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/toast.dart';
|
||||
import 'package:wydj/tools_base/unique_tag_mixin.dart';
|
||||
import 'package:wydj/tools_base/widget/image_browser_page.dart';
|
||||
import 'package:wydj/tools_base/widget/net_image_widget.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 '../../mine/mine_share/mine_share_page.dart';
|
||||
import 'album_action_widget.dart';
|
||||
@@ -40,7 +40,8 @@ class _PicsDetailPageState extends State<PicsDetailPage> with UniqueTagMixin {
|
||||
builder: (logic) {
|
||||
if (logic.videoModel == null) return LoadingCenterWidget();
|
||||
//拉失败后 videoModel 是空壳,靠 id 判断
|
||||
if (logic.videoModel?.id == null) return CErrorWidget(retryOnTap: () => logic.loadData());
|
||||
if (logic.videoModel?.id == null)
|
||||
return CErrorWidget(retryOnTap: () => logic.loadData());
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -49,13 +50,15 @@ class _PicsDetailPageState extends State<PicsDetailPage> with UniqueTagMixin {
|
||||
InkWell(
|
||||
enableFeedback: false,
|
||||
onTap: () => Get.back(),
|
||||
child: Icon(Icons.arrow_back_ios_new, color: Colors.white, size: 24),
|
||||
child: Icon(Icons.arrow_back_ios_new,
|
||||
color: Colors.white, size: 24),
|
||||
),
|
||||
4.sizeBoxW,
|
||||
Expanded(
|
||||
child: Text(
|
||||
logic.videoModel?.title ?? '',
|
||||
style: textStyle(16, Colors.white.withValues(alpha: .9), FontWeight.w800),
|
||||
style: textStyle(16, Colors.white.withValues(alpha: .9),
|
||||
FontWeight.w800),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
@@ -68,7 +71,9 @@ class _PicsDetailPageState extends State<PicsDetailPage> with UniqueTagMixin {
|
||||
builder: (_, positions, __) => AlbumActionWidget(
|
||||
videoModel: logic.videoModel,
|
||||
currentIndex: positions.isEmpty ? 0 : positions.first.index,
|
||||
total: logic.isUnlocked ? logic.covers.length : logic.lockCount,
|
||||
total: logic.isUnlocked
|
||||
? logic.covers.length
|
||||
: logic.lockCount,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -89,13 +94,19 @@ class _PicsDetailPageState extends State<PicsDetailPage> with UniqueTagMixin {
|
||||
itemScrollController: logic.itemScrollCtr,
|
||||
itemCount: count,
|
||||
itemBuilder: (_, index) {
|
||||
final image = NetworkImageLoader(imageUrl: covers[index], borderRadius: 0);
|
||||
final image =
|
||||
NetworkImageLoader(imageUrl: covers[index], borderRadius: 0);
|
||||
if (isUnlocked) {
|
||||
return GestureDetector(onTap: () => ImageBrowserPage.open(covers, index: index), child: image);
|
||||
return GestureDetector(
|
||||
onTap: () => ImageBrowserPage.open(covers, index: index),
|
||||
child: image);
|
||||
}
|
||||
return Stack(
|
||||
children: [
|
||||
InkWell(enableFeedback: false, onTap: () => showToast('解锁后可查看图片详情'), child: image),
|
||||
InkWell(
|
||||
enableFeedback: false,
|
||||
onTap: () => showToast('解锁后可查看图片详情'),
|
||||
child: image),
|
||||
if (index == count - 1) Positioned.fill(child: _unlockMask(logic)),
|
||||
],
|
||||
);
|
||||
@@ -113,27 +124,41 @@ class _PicsDetailPageState extends State<PicsDetailPage> with UniqueTagMixin {
|
||||
'你只需花费 $coins 金币',
|
||||
defaultStyle: textStyle(16, Colors.white, FontWeight.w400),
|
||||
patternList: [
|
||||
EasyRichTextPattern(targetString: '$coins', style: textStyle(16, AppColors.actionRed, FontWeight.w400)),
|
||||
EasyRichTextPattern(
|
||||
targetString: '$coins',
|
||||
style: textStyle(16, AppColors.actionRed, FontWeight.w400)),
|
||||
],
|
||||
),
|
||||
16.sizeBoxH,
|
||||
Text('即可解锁继续查看', style: textStyle(12, Colors.white, FontWeight.w400)),
|
||||
Text('即可解锁继续查看',
|
||||
style: textStyle(12, Colors.white, FontWeight.w400)),
|
||||
16.sizeBoxH,
|
||||
_maskBtn('立即解锁', 84, [Color(0xffFF6E6E), Color(0xffFF4D4D)], Colors.white, logic.showBuy),
|
||||
_maskBtn('立即解锁', 84, [Color(0xffFF6E6E), Color(0xffFF4D4D)],
|
||||
Colors.white, logic.showBuy),
|
||||
]
|
||||
: [
|
||||
//会员解锁
|
||||
Text('试看结束', style: textStyle(16, Colors.white, FontWeight.w400)),
|
||||
16.sizeBoxH,
|
||||
Text('本内容需开通VIP免费观看', style: textStyle(16, Colors.white, FontWeight.w400)),
|
||||
Text('本内容需开通VIP免费观看',
|
||||
style: textStyle(16, Colors.white, FontWeight.w400)),
|
||||
16.sizeBoxH,
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
_maskBtn('邀请得3日VIP', 110, [Color(0xffFFE8BE), Color(0xffE6B764)], Color(0xff694923),
|
||||
_maskBtn(
|
||||
'邀请得3日VIP',
|
||||
110,
|
||||
[Color(0xffFFE8BE), Color(0xffE6B764)],
|
||||
Color(0xff694923),
|
||||
() => Get.to(() => MineSharePage())),
|
||||
18.sizeBoxW,
|
||||
_maskBtn('开通VIP免费看', 115, [Color(0xffFF6E6E), Color(0xffFF4D4D)], Colors.white, logic.showBuy),
|
||||
_maskBtn(
|
||||
'开通VIP免费看',
|
||||
115,
|
||||
[Color(0xffFF6E6E), Color(0xffFF4D4D)],
|
||||
Colors.white,
|
||||
logic.showBuy),
|
||||
],
|
||||
),
|
||||
];
|
||||
@@ -146,7 +171,9 @@ class _PicsDetailPageState extends State<PicsDetailPage> with UniqueTagMixin {
|
||||
fit: BoxFit.scaleDown,
|
||||
child: SizedBox(
|
||||
width: screen.screenWidth,
|
||||
child: Column(mainAxisAlignment: MainAxisAlignment.center, children: content),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: content),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -155,7 +182,8 @@ class _PicsDetailPageState extends State<PicsDetailPage> with UniqueTagMixin {
|
||||
}
|
||||
|
||||
//蒙层里的胶囊按钮,三处只差宽度/渐变/文字色/回调
|
||||
Widget _maskBtn(String text, double width, List<Color> colors, Color textColor, VoidCallback onTap) {
|
||||
Widget _maskBtn(String text, double width, List<Color> colors,
|
||||
Color textColor, VoidCallback onTap) {
|
||||
return InkWell(
|
||||
enableFeedback: false,
|
||||
onTap: onTap,
|
||||
@@ -163,7 +191,9 @@ class _PicsDetailPageState extends State<PicsDetailPage> with UniqueTagMixin {
|
||||
width: width,
|
||||
height: 30,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(gradient: LinearGradient(colors: colors), borderRadius: BorderRadius.circular(15)),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(colors: colors),
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: Text(text, style: textStyle(12, textColor, FontWeight.w400)),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user