123 lines
3.9 KiB
Dart
123 lines
3.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:jydj/assets_tool/images.dart';
|
|
import 'package:jydj/hj_utils/screen.dart';
|
|
import 'package:jydj/routers/jump_router.dart';
|
|
import 'package:jydj/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(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();
|
|
}
|
|
|
|
// 金币/VIP 角标:渐变底 + 文字,仅文字与文字色不同
|
|
Widget _levelTag(String text, Color textColor, {List<Color>? bgColor}) {
|
|
return Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 6),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.all(Radius.circular(2)),
|
|
gradient: LinearGradient(colors: bgColor ?? [Color(0xffFFC000), Color(0xffFFC000)]),
|
|
),
|
|
child: Text(
|
|
text,
|
|
style: TextStyle(color: textColor, fontSize: 10, height: 1.6),
|
|
),
|
|
);
|
|
}
|
|
|
|
Color get _statusColor {
|
|
return info?.updateStatus == 1 ? const Color(0xffFFC000) : Colors.white.withValues(alpha: .45);
|
|
}
|
|
}
|