feat(flutter): 重构四 Tab 与浏览页

This commit is contained in:
Zhou Weidong committed 2026-10-20 09:49:42 +08:00
1 parent 99c72e2c32
commit 959edc0a32
41 files changed
+2148 -1179

No files matched your search

@@ -5,12 +5,12 @@ import 'dart:async';
import 'package:flutter/material.dart';
import '../../../core/data/models/home_feed.dart';
import '../../../core/data/models/drama.dart';
import '../../../core/theme/app_colors.dart';
import '../../../core/theme/app_dimens.dart';
import '../../../core/widgets/remote_image.dart';
import '../../../l10n/app_localizations.dart';
const double _carouselHeight = 154;
const double _indicatorHeight = 24;
const double _dotSize = 6;
const double _activeDotWidth = 18;
@@ -25,11 +25,13 @@ class FeedBannerCarousel extends StatefulWidget {
required this.banners,
required this.onOpen,
this.active = true,
this.dramaFor,
});
final List<FeedBanner> banners;
final ValueChanged<FeedBanner> onOpen;
final bool active;
final Drama? Function(FeedBanner banner)? dramaFor;
@override
State<FeedBannerCarousel> createState() => _FeedBannerCarouselState();
@@ -121,7 +123,7 @@ class _FeedBannerCarouselState extends State<FeedBannerCarousel> {
child: Column(
children: [
SizedBox(
height: _carouselHeight,
height: AppDimens.heroBannerHeight,
child: PageView.builder(
controller: _controller,
itemCount: widget.banners.length,
@@ -138,6 +140,7 @@ class _FeedBannerCarouselState extends State<FeedBannerCarousel> {
Widget _bannerCard(int index) {
final banner = widget.banners[index];
final dramaId = banner.dramaId;
final drama = widget.dramaFor?.call(banner);
final card = ClipRRect(
borderRadius: BorderRadius.circular(AppDimens.authCardRadius),
child: Stack(
@@ -149,10 +152,44 @@ class _FeedBannerCarouselState extends State<FeedBannerCarousel> {
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Color(0x00000000), Color(0x8A0B0C10)],
colors: [Color(0x120B0C10), Color(0xE60B0C10)],
),
),
),
if (drama != null)
Positioned(
left: 16,
right: 64,
bottom: 14,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
drama.title,
key: Key('home-hero-title-$index'),
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: const TextStyle(
fontFamily: 'Outfit',
color: AppColors.onSurface,
fontSize: AppDimens.pageTitle,
fontWeight: FontWeight.w800,
),
),
const SizedBox(height: AppDimens.spaceXs),
Text(
drama.synopsis,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(
color: AppColors.muted,
fontSize: AppDimens.caption,
),
),
],
),
),
if (dramaId != null)
const Positioned(right: 14, bottom: 14, child: _PlayMark()),
],