fix(flutter): 首页 feed 顶栏固定悬浮
This commit is contained in:
1 parent
1cb4c56261
commit
9175a7f253
6 files changed
+341
-345
No files matched your search
@@ -23,6 +23,7 @@ import '../../core/widgets/download_action.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import 'player_binding.dart';
|
||||
import 'player_logic.dart';
|
||||
import 'widgets/home_feed_header.dart';
|
||||
import 'widgets/home_feed_overlay.dart';
|
||||
import 'widgets/exit_clear_screen_button.dart';
|
||||
import 'widgets/player_center_toggle.dart';
|
||||
@@ -187,6 +188,7 @@ class _PlayerPageState extends State<PlayerPage> with WidgetsBindingObserver {
|
||||
|
||||
Widget _buildPlayer(BuildContext context) {
|
||||
final interactions = context.watch<InteractionController>();
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final indices = logic.visibleIndices;
|
||||
final pages = logic.pages;
|
||||
final content = AnimatedBuilder(
|
||||
@@ -205,21 +207,55 @@ class _PlayerPageState extends State<PlayerPage> with WidgetsBindingObserver {
|
||||
_buildEpisode(context, indices[position], interactions),
|
||||
),
|
||||
);
|
||||
final body = Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
content,
|
||||
if (widget.homeMode && !_boosting && !logic.pip && !logic.pipPreparing)
|
||||
Positioned(
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: SafeArea(
|
||||
bottom: false,
|
||||
child: HomeFeedHeader(
|
||||
l10n: l10n,
|
||||
onRefresh: () async {
|
||||
final ok = await widget.onRefreshFeed?.call() ?? true;
|
||||
if (context.mounted && !ok) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(l10n.catalogError)));
|
||||
}
|
||||
return ok;
|
||||
},
|
||||
onSearch: widget.onSearch ?? () => logic.showDiscover(context),
|
||||
onMore: _openCurrentMore,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
return AnnotatedRegion<SystemUiOverlayStyle>(
|
||||
value: SystemUiOverlayStyle.dark,
|
||||
child: Theme(
|
||||
data: AppTheme.light(),
|
||||
child: widget.embedded
|
||||
? content
|
||||
? body
|
||||
: Scaffold(
|
||||
key: const Key('player-scaffold'),
|
||||
backgroundColor: Colors.transparent,
|
||||
body: content,
|
||||
body: body,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _openCurrentMore() {
|
||||
final entry = logic.queue.entryAt(logic.session.currentIndex);
|
||||
_openMore(context, entry.episode);
|
||||
}
|
||||
|
||||
Widget _buildEpisode(
|
||||
BuildContext context,
|
||||
int index,
|
||||
@@ -417,26 +453,13 @@ class _PlayerPageState extends State<PlayerPage> with WidgetsBindingObserver {
|
||||
},
|
||||
onComments: () => logic.showComments(context, drama),
|
||||
onShare: () => logic.shareDrama(context, drama),
|
||||
onEpisodes: () => logic.showEpisodes(context),
|
||||
onDetail: () => unawaited(logic.openDetail(context)),
|
||||
onOpenFullPlayer: () async {
|
||||
await widget.onOpenFullPlayer?.call(drama, episode);
|
||||
if (!mounted || !widget.active) return;
|
||||
logic.session.setUserWantsPlay(true);
|
||||
},
|
||||
onRefreshFeed: () async {
|
||||
final ok = await widget.onRefreshFeed?.call() ?? true;
|
||||
if (context.mounted && !ok) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(l10n.catalogError)));
|
||||
}
|
||||
return ok;
|
||||
},
|
||||
onDownload: () => requestEpisodeDownload(context, episode.id),
|
||||
onClear: () => setState(() => _chromeVisible = false),
|
||||
onSearch: widget.onSearch ?? () => logic.showDiscover(context),
|
||||
onMore: () => _openMore(context, episode),
|
||||
onMore: _openCurrentMore,
|
||||
onScrubStart: ready ? () => logic.beginScrub(videoPort!) : null,
|
||||
onSeek: ready
|
||||
? (position) => logic.seekTo(context, videoPort!, position)
|
||||
|
||||
Reference in new issue
Block a user