episode badge

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-14 16:36:44 +08:00
parent 3f71e79809
commit 98985a7fa4
3 changed files with 17 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
import 'package:PiliPlus/models/common/badge_type.dart'; import 'package:PiliPlus/models/common/badge_type.dart';
import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/extension.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart';
class PBadge extends StatelessWidget { class PBadge extends StatelessWidget {
final String? text; final String? text;
@@ -68,6 +69,10 @@ class PBadge extends StatelessWidget {
color = theme.secondary; color = theme.secondary;
bgColor = Colors.transparent; bgColor = Colors.transparent;
borderColor = theme.secondary; borderColor = theme.secondary;
case PBadgeType.free:
bgColor =
Get.isDarkMode ? const Color(0xFFD66011) : const Color(0xFFFF7F24);
color = Colors.white;
} }
late EdgeInsets paddingStyle = late EdgeInsets paddingStyle =

View File

@@ -7,6 +7,7 @@ enum PBadgeType {
error, error,
line_primary, line_primary,
line_secondary, line_secondary,
free,
} }
enum PBadgeSize { medium, small } enum PBadgeSize { medium, small }

View File

@@ -430,6 +430,17 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel>
bottom: 6.0, bottom: 6.0,
type: PBadgeType.gray, type: PBadgeType.gray,
), ),
if (episode.badge != null)
PBadge(
text: episode.badge,
top: 6,
right: 6,
type: switch (episode.badge) {
'会员' => PBadgeType.primary,
'限免' => PBadgeType.free,
_ => PBadgeType.gray,
},
),
], ],
); );
}, },
@@ -497,17 +508,6 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel>
], ],
), ),
), ),
if (episode.badge != null) ...[
if (episode.badge == '会员')
Image.asset(
'assets/images/big-vip.png',
height: 20,
semanticLabel: "大会员",
)
else
Text(episode.badge),
const SizedBox(width: 10),
],
], ],
), ),
), ),