fix(flutter): feed rail 底部对齐并复用播放页更多

This commit is contained in:
Zhou Weidong committed 2026-10-20 14:23:36 +08:00
1 parent e800f5971f
commit 7e415f6f4f
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();
},
),
],
),
);
}
}