fix(flutter): 首页剧卡移除封面锁定角标

This commit is contained in:
Zhou Weidong committed 2026-10-20 13:08:03 +08:00
1 parent 40e23793b4
commit 1fc25ec5d1
2 files changed
+4 -36

No files matched your search

@@ -126,8 +126,6 @@ class HomeDramaCard extends StatelessWidget {
fallbackAspectRatio: _coverAspectRatio,
),
Positioned(top: 8, left: 8, child: _tagBadge()),
if (_lockedCount > 0)
Positioned(top: 8, right: 8, child: _lockedBadge()),
Positioned(left: 8, bottom: 8, child: _viewsBadge()),
Positioned(right: 8, bottom: 8, child: _episodeBadge()),
],
@@ -140,13 +138,6 @@ class HomeDramaCard extends StatelessWidget {
drama.episodes.any((episode) => episode.isFree);
}
int get _lockedCount {
final explicit = drama.episodes.where((episode) => episode.locked).length;
if (explicit > 0) return explicit;
final inferred = drama.episodeCount - drama.freeEpisodes;
return inferred > 0 ? inferred : 0;
}
Widget _tagBadge() {
final label = _isFree ? l10n.free : l10n.originalTag;
return Container(
@@ -170,32 +161,6 @@ class HomeDramaCard extends StatelessWidget {
);
}
Widget _lockedBadge() {
return Container(
key: Key('home-drama-locked-${drama.id}'),
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 3),
decoration: BoxDecoration(
color: AppColors.overlayDark,
borderRadius: BorderRadius.circular(AppDimens.pillRadius),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(Icons.lock_rounded, color: AppColors.onPrimary, size: 11),
const SizedBox(width: 2),
Text(
l10n.lockedEpisodeCount(_lockedCount),
style: const TextStyle(
color: AppColors.onPrimary,
fontSize: 9,
fontWeight: FontWeight.w700,
),
),
],
),
);
}
Widget _episodeBadge() {
return Container(
key: Key('home-drama-episodes-badge-${drama.id}'),
+4 -1
View File
@@ -54,8 +54,11 @@ void main() {
);
expect((tag.decoration! as BoxDecoration).color, AppColors.badgePink);
expect(find.text('Free'), findsOneWidget);
expect(find.text('18 locked'), findsOneWidget);
expect(find.text('All 24'), findsOneWidget);
expect(
find.byKey(const Key('home-drama-locked-style-drama')),
findsNothing,
);
expect(find.byKey(const Key('home-drama-add-style-drama')), findsNothing);
// 播放次数角标落在封面内,并按万位格式化。