Files
hjsq_android/lib/hj_page/cartoon/widget/free_badge.dart
T
谢宇宁andClaude Opus 5.5 2d26ea8f90 Initial commit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 10:38:11 +07:00

45 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
/// ACG「免费」角标:整本无任何权限(hasPermission == false)且该集落在前 N 集免费区间时展示。
/// 默认行内胶囊(详情页/子集抽屉/有声列表);[isCorner] 为卡片左上角贴边样式(选集面板小方块)。
class FreeBadge extends StatelessWidget {
final bool isCorner;
const FreeBadge({super.key, this.isCorner = false});
Color get _bgColor => Color(0xffFFC000);
@override
Widget build(BuildContext context) {
if (isCorner) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 2),
decoration: BoxDecoration(
color: _bgColor,
borderRadius: BorderRadius.only(
topRight: Radius.circular(7),
bottomLeft: Radius.circular(7),
),
),
child: const Text(
'免费',
style: TextStyle(color: Color(0xff1F2029), fontSize: 8, height: 1.2, fontWeight: FontWeight.w400),
),
);
}
return Container(
height: 20,
alignment: Alignment.center,
padding: const EdgeInsets.symmetric(horizontal: 6),
decoration: BoxDecoration(
color: _bgColor,
borderRadius: BorderRadius.circular(3),
),
child: const Text(
'免费',
style: TextStyle(color: Color(0xff1F2029), fontSize: 10, fontWeight: FontWeight.w400),
),
);
}
}