Files
2026-09-15 15:44:13 +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});
static const _bgColor = Color(0xff64CBC2);
@override
Widget build(BuildContext context) {
if (isCorner) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 1),
decoration: const BoxDecoration(
color: _bgColor,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(7),
bottomRight: Radius.circular(7),
),
),
child: const Text(
'免费',
style: TextStyle(color: Colors.white, fontSize: 9, 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: Colors.white, fontSize: 10, fontWeight: FontWeight.w400),
),
);
}
}