初始化

This commit is contained in:
谢宇宁
2026-09-15 15:44:13 +07:00
commit a23ba685e9
1065 changed files with 101122 additions and 0 deletions
+130
View File
@@ -0,0 +1,130 @@
import 'package:flutter/material.dart';
import 'package:hgdj/assets_tool/images.dart';
import 'package:hgdj/hj_utils/screen.dart';
import 'package:hgdj/routers/jump_router.dart';
import 'package:hgdj/tools_base/widget/net_image_widget.dart';
import '../../config/config.dart';
import '../../hj_model/cartoon_media_info.dart';
//acg video item组件
class AcgItemWidget extends StatelessWidget {
final CartoonMediaInfo? info;
final bool coverV; //竖屏封面
final bool? heroUI; //是否需要hero动画
final bool? showSymbol; //是否显示角标
final Function()? tapCallback;
const AcgItemWidget({
super.key,
this.info,
this.coverV = true,
this.tapCallback,
this.heroUI = false,
this.showSymbol = true,
});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: tapCallback ?? () => pushToCartoonPage(info),
child: Column(
children: [
Expanded(
child: Stack(
children: [
LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return NetworkImageLoader(
imageUrl: coverV ? info?.coverV ?? '' : info?.coverH ?? '',
width: constraints.maxWidth,
height: constraints.maxHeight,
fit: BoxFit.cover,
);
},
),
Positioned(
right: 6,
top: 6,
child: _buildLevelIcon(),
),
if (info?.isAudiobooks == true)
Positioned(
left: 8,
top: 8,
height: 24,
width: 24,
child: Image.asset('voice_noval_icon.png'.videoPath),
)
],
)),
6.sizeBoxH,
Row(
children: [
Expanded(
child: Text(
info?.title ?? '',
style: TextStyle(
fontSize: 12,
color: Colors.white.withValues(alpha: .9),
fontWeight: FontWeight.w500,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
),
)
],
),
4.sizeBoxH,
Row(
children: [
Expanded(
child: Text(
'${info?.episodeNumberStatus ?? ''} · ${info?.updateDesc}',
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 11,
color: _statusColor,
fontWeight: FontWeight.w400),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
)
],
),
);
}
Widget _buildLevelIcon() {
if (info?.permission == 1 && Config.coinMark)
return _levelTag('金币', const Color(0xff8B3E00));
if (info?.permission == 0 && Config.vipMark)
return _levelTag('VIP', const Color(0xff141414));
return const SizedBox.shrink();
}
// 金币/VIP 角标:渐变底 + 文字,仅文字与文字色不同
Widget _levelTag(String text, Color textColor) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 6),
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(2)),
gradient:
LinearGradient(colors: [Color(0xffFFE580), Color(0xffFACC15)]),
),
child: Text(
text,
style: TextStyle(color: textColor, fontSize: 10, height: 1.6),
),
);
}
Color get _statusColor {
return info?.updateStatus == 1
? const Color(0xffEEC76B)
: Colors.white.withValues(alpha: .45);
}
}