diff --git a/lib/pages/discover/discover_view.dart b/lib/pages/discover/discover_view.dart index 42de61e..4927b76 100644 --- a/lib/pages/discover/discover_view.dart +++ b/lib/pages/discover/discover_view.dart @@ -37,7 +37,7 @@ const double _categoryTabGap = 20; const double _categorySelectedFontSize = 16; const double _categoryFontSize = 15; const double _stickyHeaderHeight = 44; -const Duration _stickyHeaderTransition = Duration(milliseconds: 200); +const Duration _stickyHeaderTransition = Duration(milliseconds: 160); /// K28-A2 剧场页:搜索、分类/语言 chips 与双列剧库。 class DiscoverPage extends StatefulWidget { @@ -113,19 +113,23 @@ class _DiscoverPageState extends State { Widget _page(BuildContext context) { final l10n = AppLocalizations.of(context)!; final categories = context.watch(); - final content = SafeArea( - bottom: !embedded, - child: Column( - children: [ - DiscoverHeader( - controller: logic.search, - focusNode: logic.searchFocus, - onChanged: (_) => logic.onSearchChanged(), - loading: logic.searchLoading, - ), - Expanded(child: _feed(l10n, categories)), - if (!embedded) _bottomNav(l10n), - ], + final content = ColoredBox( + key: const Key('theater-page-surface'), + color: AppColors.ink, + child: SafeArea( + bottom: !embedded, + child: Column( + children: [ + DiscoverHeader( + controller: logic.search, + focusNode: logic.searchFocus, + onChanged: (_) => logic.onSearchChanged(), + loading: logic.searchLoading, + ), + Expanded(child: _feed(l10n, categories)), + if (!embedded) _bottomNav(l10n), + ], + ), ), ); return AnnotatedRegion( @@ -183,7 +187,7 @@ class _DiscoverPageState extends State { } Widget _stickyHeader(AppLocalizations l10n, CategoryController categories) { - // 只有背景随吸顶状态变化,分类行内容(child)不参与重建,避免上滑闪烁。 + // 背景常驻 ink,只有分隔线/阴影随吸顶状态过渡,避免透明→实色的闪动。 return ValueListenableBuilder( valueListenable: _headerPinned, builder: (context, pinned, child) => AnimatedContainer( @@ -191,7 +195,7 @@ class _DiscoverPageState extends State { duration: _stickyHeaderTransition, curve: Curves.easeOut, decoration: BoxDecoration( - color: pinned ? AppColors.ink : Colors.transparent, + color: AppColors.ink, border: Border( bottom: BorderSide( color: pinned ? AppColors.border : Colors.transparent, diff --git a/test/discover/home_all_dramas_grid_test.dart b/test/discover/home_all_dramas_grid_test.dart index aba5f18..4401ea1 100644 --- a/test/discover/home_all_dramas_grid_test.dart +++ b/test/discover/home_all_dramas_grid_test.dart @@ -215,7 +215,7 @@ void main() { final before = tester.getRect( find.byKey(const Key('theater-sticky-header')), ); - expect(header().color, Colors.transparent); + expect(header().color, AppColors.ink); await tester.drag(_verticalFeed, const Offset(0, -220)); await tester.pumpAndSettle(); @@ -227,6 +227,15 @@ void main() { expect(header().color, AppColors.ink); }); + testWidgets('should_paint_theater_surface_with_ink', (tester) async { + await _pumpTheater(tester, categoryRepository: _GridCategoryRepository()); + final surface = tester.widget( + find.byKey(const Key('theater-page-surface')), + ); + + expect(surface.color, AppColors.ink); + }); + testWidgets('should_keep_category_row_stable_across_scrolls', (tester) async { await _pumpTheater( tester,