From 1fc25ec5d1e00598c126ac4db39866c5594b51c2 Mon Sep 17 00:00:00 2001 From: Zhou Weidong <502333560@qq.com> Date: Tue, 20 Oct 2026 13:08:03 +0800 Subject: [PATCH] =?UTF-8?q?fix(flutter):=20=E9=A6=96=E9=A1=B5=E5=89=A7?= =?UTF-8?q?=E5=8D=A1=E7=A7=BB=E9=99=A4=E5=B0=81=E9=9D=A2=E9=94=81=E5=AE=9A?= =?UTF-8?q?=E8=A7=92=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/home/widgets/home_drama_grid.dart | 35 --------------------- test/home/home_card_style_test.dart | 5 ++- 2 files changed, 4 insertions(+), 36 deletions(-) diff --git a/lib/pages/home/widgets/home_drama_grid.dart b/lib/pages/home/widgets/home_drama_grid.dart index 677d848..a5b82ce 100644 --- a/lib/pages/home/widgets/home_drama_grid.dart +++ b/lib/pages/home/widgets/home_drama_grid.dart @@ -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}'), diff --git a/test/home/home_card_style_test.dart b/test/home/home_card_style_test.dart index 04f0495..c205ebd 100644 --- a/test/home/home_card_style_test.dart +++ b/test/home/home_card_style_test.dart @@ -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); // 播放次数角标落在封面内,并按万位格式化。