mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-31 16:18:22 +08:00
episode badge
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -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 =
|
||||||
|
|||||||
@@ -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 }
|
||||||
|
|||||||
@@ -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),
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user