merge: 合并 K33-G feed rail 与更多弹窗

This commit is contained in:
Zhou Weidong committed 2026-10-20 14:23:40 +08:00
commit 28ff9a7642
5 files changed
+15 -86

No files matched your search

+1 -3
View File
@@ -434,13 +434,11 @@ class _PlayerPageState extends State<PlayerPage> with WidgetsBindingObserver {
onDownload: () => requestEpisodeDownload(context, episode.id),
onClear: () => setState(() => _chromeVisible = false),
onSearch: widget.onSearch ?? () => logic.showDiscover(context),
onMore: () => _openMore(context, episode),
onScrubStart: ready ? () => logic.beginScrub(videoPort!) : null,
onSeek: ready
? (position) => logic.seekTo(context, videoPort!, position)
: null,
onPip: logic.pictureInPicture.isPlatformSupported
? () => unawaited(logic.enterPip(context))
: null,
)
else
PlayerPlaybackOverlay(
@@ -56,6 +56,7 @@ class HomeFeedOverlay extends StatefulWidget {
required this.onDownload,
required this.onClear,
required this.onSearch,
required this.onMore,
required this.onTogglePlay,
required this.onBoostStart,
required this.onBoostEnd,
@@ -65,7 +66,6 @@ class HomeFeedOverlay extends StatefulWidget {
this.favoriteCount,
this.commentCount,
this.authorNote = '',
this.onPip,
});
final AppLocalizations l10n;
@@ -91,8 +91,8 @@ class HomeFeedOverlay extends StatefulWidget {
final VoidCallback onDownload;
final VoidCallback onClear;
final VoidCallback onSearch;
final VoidCallback onMore;
final VoidCallback onTogglePlay;
final VoidCallback? onPip;
final VoidCallback? onScrubStart;
final ValueChanged<Duration>? onSeek;
final VoidCallback onBoostStart;
@@ -137,9 +137,9 @@ class _HomeFeedOverlayState extends State<HomeFeedOverlay> {
_header(context),
Expanded(
child: Align(
alignment: const Alignment(1.0, 0.80),
alignment: Alignment.bottomRight,
child: Padding(
padding: const EdgeInsets.fromLTRB(0, 0, 10, 16),
padding: const EdgeInsets.fromLTRB(0, 0, 10, 12),
child: _rail(),
),
),
@@ -160,7 +160,7 @@ class _HomeFeedOverlayState extends State<HomeFeedOverlay> {
widget.onBoostStart();
return;
}
_openMore(context);
widget.onMore();
}
Widget _boostHint() {
@@ -209,7 +209,7 @@ class _HomeFeedOverlayState extends State<HomeFeedOverlay> {
glyphSize: _topIconGlyph,
refreshing: _refreshing,
onTap: _refresh,
onLongPress: () => _openMore(context),
onLongPress: widget.onMore,
),
Expanded(
child: Center(
@@ -506,18 +506,4 @@ class _HomeFeedOverlayState extends State<HomeFeedOverlay> {
context,
).showSnackBar(SnackBar(content: Text(widget.l10n.comingSoon)));
}
Future<void> _openMore(BuildContext context) async {
await showModalBottomSheet<void>(
context: context,
backgroundColor: AppColors.card,
showDragHandle: true,
builder: (sheetContext) => _FeedMoreSheet(
l10n: widget.l10n,
onDownload: widget.onDownload,
onPip: widget.onPip,
onClear: widget.onClear,
),
);
}
}
@@ -294,65 +294,3 @@ class _FeedProgressBarState extends State<_FeedProgressBar> {
);
}
}
class _FeedMoreSheet extends StatelessWidget {
const _FeedMoreSheet({
required this.l10n,
required this.onDownload,
required this.onClear,
this.onPip,
});
final AppLocalizations l10n;
final VoidCallback onDownload;
final VoidCallback onClear;
final VoidCallback? onPip;
@override
Widget build(BuildContext context) {
return SafeArea(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
key: const Key('home-feed-download'),
leading: const Icon(
Icons.download_outlined,
color: AppColors.secondary,
),
title: Text(l10n.downloads),
onTap: () {
Navigator.pop(context);
onDownload();
},
),
if (onPip != null)
ListTile(
key: const Key('home-feed-pip'),
leading: const Icon(
Icons.picture_in_picture_alt_outlined,
color: AppColors.secondary,
),
title: Text(l10n.pictureInPicture),
onTap: () {
Navigator.pop(context);
onPip!();
},
),
ListTile(
key: const Key('home-feed-clear'),
leading: const Icon(
Icons.fullscreen_rounded,
color: AppColors.secondary,
),
title: Text(l10n.clearScreen),
onTap: () {
Navigator.pop(context);
onClear();
},
),
],
),
);
}
}
+3
View File
@@ -125,6 +125,7 @@ void main() {
onDownload: () {},
onClear: () {},
onSearch: () {},
onMore: () {},
),
),
),
@@ -215,6 +216,7 @@ void main() {
onDownload: () {},
onClear: () {},
onSearch: () {},
onMore: () {},
onScrubStart: () {},
onSeek: (value) => seeked = value,
),
@@ -356,6 +358,7 @@ void main() {
onDownload: () {},
onClear: () {},
onSearch: () {},
onMore: () {},
),
),
),
+5 -1
View File
@@ -120,6 +120,7 @@ void main() {
expect(railTop, greaterThan(844 * 0.45));
expect(railBottom, lessThanOrEqualTo(infoTop));
expect(infoTop - railBottom, lessThanOrEqualTo(20));
});
testWidgets('should_boost_feed_on_side_long_press', (tester) async {
@@ -151,7 +152,10 @@ void main() {
await gesture.up();
await tester.pumpAndSettle();
expect(find.byKey(const Key('home-feed-clear')), findsOneWidget);
expect(find.byKey(const Key('player-more-sheet')), findsOneWidget);
expect(find.byKey(const Key('home-feed-clear')), findsNothing);
expect(find.byKey(const Key('home-feed-download')), findsNothing);
expect(find.byKey(const Key('home-feed-pip')), findsNothing);
});
testWidgets('should_restore_light_theme_after_leaving_feed_tab', (